-
Enhancement
-
Resolution: Fixed
-
P4
-
repo-valhalla
C2 currently creates two allocations in the following case:
// Create value type and force allocation
MyValue3 vt = MyValue3.create();
va[0] = vt;
val77 = vt;
vt.verify(val77);
// Value type is now allocated, make a copy and force allocation.
MyValue3 copy = MyValue3.setC(vt, vt.c);
va[0] = copy;
But because copy is equal to vt, C2 should eliminate this redundant allocation.
// Create value type and force allocation
MyValue3 vt = MyValue3.create();
va[0] = vt;
val77 = vt;
vt.verify(val77);
// Value type is now allocated, make a copy and force allocation.
MyValue3 copy = MyValue3.setC(vt, vt.c);
va[0] = copy;
But because copy is equal to vt, C2 should eliminate this redundant allocation.