ugfix for conditional-move creation, if the CMOV is getting
created inside an inner-most loop or has inputs which are hung
off the converted if-node.
==== //java/main-dev/java/hotspot5/src/share/vm/opto/loopopts.cpp#14 (text) ====
@@ -534,8 +534,12 @@
set_ctrl(inp, cmov_ctrl);
}
}
- Node *cmov = CMoveNode::make( cmov_ctrl->in(0), iff->in(1), phi->in(1+flip), phi->in(2-flip), _igvn.type(phi) );
- register_new_node( cmov, cmov_ctrl->in(0) );
+ Node *cmov = CMoveNode::make( region, iff->in(1), phi->in(1+flip), phi->in(2-flip), _igvn.type(phi) );
+ register_new_node( cmov, region );
+ // Since we are inside loop optimizations and just created a new node, we need to check if it belongs to innermost loop
+ // and in this case update additional structure
+ IdealLoopTree *loop = get_loop(region);
+ if (!loop->_child) loop->_body.push(cmov);
_igvn.hash_delete(phi);
_igvn.subsume_node( phi, cmov );
#ifndef PRODUCT