From 6a7fbf19d775ab8fa710a8f4913468c50a948314 Mon Sep 17 00:00:00 2001 Subject: 8136926: phi == NULL assert in PhaseIdealLoop::try_move_store_after_loop --- hotspot/src/share/vm/opto/loopopts.cpp | 8 +++++--- .../test/compiler/loopopts/TestMoveStoresOutOfLoops.java | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/opto/loopopts.cpp b/hotspot/src/share/vm/opto/loopopts.cpp index cacad2a1a..aa838c1de 100644 --- a/hotspot/src/share/vm/opto/loopopts.cpp +++ b/hotspot/src/share/vm/opto/loopopts.cpp @@ -822,13 +822,15 @@ void PhaseIdealLoop::try_move_store_after_loop(Node* n) { } if (u->is_Phi() && u->in(0) == n_loop->_head) { assert(_igvn.type(u) == Type::MEMORY, "bad phi"); - assert(phi == NULL, "already found"); + // multiple phis on the same slice are possible + if (phi != NULL) { + return; + } phi = u; continue; } } - phi = NULL; - break; + return; } if (phi != NULL) { // Nothing in the loop before the store (next iteration) diff --git a/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java b/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java index 4eea5d5e4..0ed9a2925 100644 --- a/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java +++ b/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java @@ -26,7 +26,7 @@ * @test * @bug 8080289 * @summary Sink stores out of loops if possible - * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+PrintCompilation -XX:CompileCommand=dontinline,TestMoveStoresOutOfLoops::test* TestMoveStoresOutOfLoops + * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestMoveStoresOutOfLoops::test* TestMoveStoresOutOfLoops * */ -- 2.22.0