changeset 49482:45675142a18a

8199784: PhaseIdealLoop::place_near_use() might return wrong control with loop strip mining Reviewed-by: kvn
author roland
date Wed, 21 Mar 2018 20:15:00 -0700
parents 8d02d496e785
children d374b1634589
files src/hotspot/share/opto/loopopts.cpp
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/opto/loopopts.cpp	Tue Mar 20 22:54:02 2018 +0800
+++ b/src/hotspot/share/opto/loopopts.cpp	Wed Mar 21 20:15:00 2018 -0700
@@ -1029,11 +1029,18 @@
 //------------------------------place_near_use---------------------------------
 // Place some computation next to use but not inside inner loops.
 // For inner loop uses move it to the preheader area.
-Node *PhaseIdealLoop::place_near_use( Node *useblock ) const {
+Node *PhaseIdealLoop::place_near_use(Node *useblock) const {
   IdealLoopTree *u_loop = get_loop( useblock );
-  return (u_loop->_irreducible || u_loop->_child)
-    ? useblock
-    : u_loop->_head->as_Loop()->skip_strip_mined()->in(LoopNode::EntryControl);
+  if (u_loop->_irreducible) {
+    return useblock;
+  }
+  if (u_loop->_child) {
+    if (useblock == u_loop->_head && u_loop->_head->is_OuterStripMinedLoop()) {
+      return u_loop->_head->in(LoopNode::EntryControl);
+    }
+    return useblock;
+  }
+  return u_loop->_head->as_Loop()->skip_strip_mined()->in(LoopNode::EntryControl);
 }