Commit 7aed9b6 1 parent 26e6cb3 commit 7aed9b6 Copy full SHA for 7aed9b6
File tree 1 file changed +17
-1
lines changed
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -1605,7 +1605,23 @@ Node* IfNode::simple_subsuming(PhaseIterGVN* igvn) {
1605
1605
}
1606
1606
#endif
1607
1607
// Replace condition with constant True(1)/False(0).
1608
- set_req (1 , igvn->intcon (br == tb ? 1 : 0 ));
1608
+ bool is_always_true = br == tb;
1609
+ set_req (1 , igvn->intcon (is_always_true ? 1 : 0 ));
1610
+
1611
+ // Update any data dependencies to the directly dominating test. This subsumed test is not immediately removed by igvn
1612
+ // and therefore subsequent optimizations might miss these data dependencies otherwise. There might be a dead loop
1613
+ // ('always_taken_proj' == 'pre') that is cleaned up later. Skip this case to make the iterator work properly.
1614
+ Node* always_taken_proj = proj_out (is_always_true);
1615
+ if (always_taken_proj != pre) {
1616
+ for (DUIterator_Fast imax, i = always_taken_proj->fast_outs (imax); i < imax; i++) {
1617
+ Node* u = always_taken_proj->fast_out (i);
1618
+ if (!u->is_CFG ()) {
1619
+ igvn->replace_input_of (u, 0 , pre);
1620
+ --i;
1621
+ --imax;
1622
+ }
1623
+ }
1624
+ }
1609
1625
1610
1626
if (bol->outcnt () == 0 ) {
1611
1627
igvn->remove_dead_node (bol); // Kill the BoolNode.
You can’t perform that action at this time.
0 commit comments