changeset 57744:5bb84e036c14

8235584: UseProfiledLoopPredicate fails with assert(_phase->get_loop(c) == loop) failed: have to be in the same loop Reviewed-by: thartmann, neliasso
author roland
date Fri, 10 Jan 2020 17:50:51 +0100
parents d19d1a02d1b2
children 4bb6c4bf72bf
files src/hotspot/share/opto/loopPredicate.cpp src/hotspot/share/opto/loopnode.cpp
diffstat 2 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/opto/loopPredicate.cpp	Thu Jan 09 19:12:16 2020 +0800
+++ b/src/hotspot/share/opto/loopPredicate.cpp	Fri Jan 10 17:50:51 2020 +0100
@@ -1389,8 +1389,9 @@
     // an early loop exit. Try them with profile data.
     while (if_proj_list.size() > 0) {
       Node* proj = if_proj_list.pop();
+      float f = pf.to(proj);
       if (proj->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none) &&
-          pf.to(proj) * loop_trip_cnt >= 1) {
+          f * loop_trip_cnt >= 1) {
         hoisted = loop_predication_impl_helper(loop, proj->as_Proj(), profile_predicate_proj, cl, zero, invar, Deoptimization::Reason_profile_predicate) | hoisted;
       }
     }
--- a/src/hotspot/share/opto/loopnode.cpp	Thu Jan 09 19:12:16 2020 +0800
+++ b/src/hotspot/share/opto/loopnode.cpp	Fri Jan 10 17:50:51 2020 +0100
@@ -946,19 +946,19 @@
 
 #ifdef ASSERT
 void LoopNode::verify_strip_mined(int expect_skeleton) const {
-  if (!is_valid_counted_loop()) {
-    return; // Skip malformed counted loop
-  }
   const OuterStripMinedLoopNode* outer = NULL;
   const CountedLoopNode* inner = NULL;
   if (is_strip_mined()) {
+    if (!is_valid_counted_loop()) {
+      return; // Skip malformed counted loop
+    }
     assert(is_CountedLoop(), "no Loop should be marked strip mined");
     inner = as_CountedLoop();
     outer = inner->in(LoopNode::EntryControl)->as_OuterStripMinedLoop();
   } else if (is_OuterStripMinedLoop()) {
     outer = this->as_OuterStripMinedLoop();
     inner = outer->unique_ctrl_out()->as_CountedLoop();
-    assert(inner->is_valid_counted_loop(), "OuterStripMinedLoop should have been removed");
+    assert(inner->is_valid_counted_loop() && inner->is_strip_mined(), "OuterStripMinedLoop should have been removed");
     assert(!is_strip_mined(), "outer loop shouldn't be marked strip mined");
   }
   if (inner != NULL || outer != NULL) {
@@ -1240,7 +1240,7 @@
 }
 
 LoopNode* CountedLoopNode::skip_strip_mined(int expect_skeleton) {
-  if (is_strip_mined()) {
+  if (is_strip_mined() && is_valid_counted_loop()) {
     verify_strip_mined(expect_skeleton);
     return in(EntryControl)->as_Loop();
   }