File tree Expand file tree Collapse file tree 3 files changed +42
-4
lines changed
test/hotspot/jtreg/compiler/valhalla/inlinetypes Expand file tree Collapse file tree 3 files changed +42
-4
lines changed Original file line number Diff line number Diff line change @@ -1476,6 +1476,10 @@ Node* PhiNode::Identity(PhaseGVN* phase) {
1476
1476
if (uin != nullptr ) {
1477
1477
return uin;
1478
1478
}
1479
+ uin = unique_input_recursive (phase);
1480
+ if (uin != nullptr ) {
1481
+ return uin;
1482
+ }
1479
1483
1480
1484
int true_path = is_diamond_phi ();
1481
1485
// Delay CMove'ing identity if Ideal has not had the chance to handle unsafe cases, yet.
@@ -1575,6 +1579,39 @@ Node* PhiNode::unique_input(PhaseValues* phase, bool uncast) {
1575
1579
return nullptr ;
1576
1580
}
1577
1581
1582
+ // Find the unique input, try to look recursively through input Phis
1583
+ Node* PhiNode::unique_input_recursive (PhaseGVN* phase) {
1584
+ if (!phase->is_IterGVN ()) {
1585
+ return nullptr ;
1586
+ }
1587
+
1588
+ ResourceMark rm;
1589
+ Node* unique = nullptr ;
1590
+ Unique_Node_List visited;
1591
+ visited.push (this );
1592
+
1593
+ for (uint visited_idx = 0 ; visited_idx < visited.size (); visited_idx++) {
1594
+ Node* current = visited.at (visited_idx);
1595
+ for (uint i = 1 ; i < current->req (); i++) {
1596
+ Node* phi_in = current->in (i);
1597
+ if (phi_in == nullptr ) {
1598
+ continue ;
1599
+ }
1600
+
1601
+ if (phi_in->is_Phi ()) {
1602
+ visited.push (phi_in);
1603
+ } else {
1604
+ if (unique == nullptr ) {
1605
+ unique = phi_in;
1606
+ } else if (unique != phi_in) {
1607
+ return nullptr ;
1608
+ }
1609
+ }
1610
+ }
1611
+ }
1612
+ return unique;
1613
+ }
1614
+
1578
1615
// ------------------------------is_x2logic-------------------------------------
1579
1616
// Check for simple convert-to-boolean pattern
1580
1617
// If:(C Bool) Region:(IfF IfT) Phi:(Region 0 1)
Original file line number Diff line number Diff line change @@ -232,6 +232,7 @@ class PhiNode : public TypeNode {
232
232
}
233
233
return uin;
234
234
}
235
+ Node* unique_input_recursive (PhaseGVN* phase);
235
236
236
237
// Check for a simple dead loop.
237
238
enum LoopSafety { Safe = 0 , Unsafe, UnsafeLoop };
Original file line number Diff line number Diff line change @@ -4156,13 +4156,14 @@ public void test150_verifier() {
4156
4156
Asserts .assertEquals (test150 (), testValue2 .hash ());
4157
4157
}
4158
4158
4159
- // TODO 8336003 This triggers # assert(false) failed: Should have been buffered
4160
- /*
4161
- // Same as test150 but with val not being allocated in the scope of the method
4159
+ // Same as test150 but with a real loop and val not being allocated in the scope of the method
4162
4160
@ Test
4161
+ // Dynamic call does not null check the receiver, so it cannot be strength reduced to a static
4162
+ // call without an explicit null check
4163
4163
@ IR (failOn = {compiler .lib .ir_framework .IRNode .DYNAMIC_CALL_OF_METHOD , "MyValue2::hash" },
4164
4164
counts = {compiler .lib .ir_framework .IRNode .STATIC_CALL_OF_METHOD , "MyValue2::hash" , "= 1" })
4165
4165
public long test151 (MyValue2 val ) {
4166
+ val = Objects .requireNonNull (val );
4166
4167
MyAbstract receiver = MyValue1 .createWithFieldsInline (rI , rL );
4167
4168
4168
4169
for (int i = 0 ; i < 100 ; i ++) {
@@ -4180,7 +4181,6 @@ public long test151(MyValue2 val) {
4180
4181
public void test151_verifier () {
4181
4182
Asserts .assertEquals (test151 (testValue2 ), testValue2 .hash ());
4182
4183
}
4183
- */
4184
4184
4185
4185
static interface MyInterface2 {
4186
4186
public int val ();
You can’t perform that action at this time.
0 commit comments