diff --git a/src/hotspot/share/opto/phaseX.cpp b/src/hotspot/share/opto/phaseX.cpp index b5b15275e21..5fcb2a62682 100644 --- a/src/hotspot/share/opto/phaseX.cpp +++ b/src/hotspot/share/opto/phaseX.cpp @@ -2566,13 +2566,16 @@ void PhaseIterGVN::add_users_of_use_to_worklist(Node* n, Node* use, Unique_Node_ // ConvI2F->ConvF2I->ConvI2F // Note: there may be other 3-nodes conversion chains that would require to be added here, but these // are the only ones that are known to trigger missed optimizations otherwise - if ((n->Opcode() == Op_ConvD2L && use_op == Op_ConvL2D) || - (n->Opcode() == Op_ConvF2I && use_op == Op_ConvI2F) || - (n->Opcode() == Op_ConvF2L && use_op == Op_ConvL2F) || - (n->Opcode() == Op_ConvI2F && use_op == Op_ConvF2I)) { + if (use_op == Op_ConvL2D || + use_op == Op_ConvI2F || + use_op == Op_ConvL2F || + use_op == Op_ConvF2I) { for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) { Node* u = use->fast_out(i2); - if (u->Opcode() == n->Opcode()) { + if ((use_op == Op_ConvL2D && u->Opcode() == Op_ConvD2L) || + (use_op == Op_ConvI2F && u->Opcode() == Op_ConvF2I) || + (use_op == Op_ConvL2F && u->Opcode() == Op_ConvF2L) || + (use_op == Op_ConvF2I && u->Opcode() == Op_ConvI2F)) { worklist.push(u); } } diff --git a/src/hotspot/share/opto/phaseX.hpp b/src/hotspot/share/opto/phaseX.hpp index 300c8fc2757..083e77bf6d9 100644 --- a/src/hotspot/share/opto/phaseX.hpp +++ b/src/hotspot/share/opto/phaseX.hpp @@ -528,7 +528,23 @@ public: // Add users of 'n' to worklist static void add_users_to_worklist0(Node* n, Unique_Node_List& worklist); + + // Add one or more users of 'use' to the worklist if it appears that a + // known optimization could be applied to those users. + // Node 'n' is a node that was modified or is about to get replaced, + // and 'use' is one use of 'n'. + // Certain optimizations have dependencies that extend beyond a node's + // direct inputs, so it is necessary to ensure the appropriate + // notifications are made here. static void add_users_of_use_to_worklist(Node* n, Node* use, Unique_Node_List& worklist); + + // Add users of 'n', and any other nodes that could be directly + // affected by changes to 'n', to the worklist. + // Node 'n' may be a node that is about to get replaced. In this + // case, 'n' should not be considered part of the new graph. + // Passing the old node (as 'n'), rather than the new node, + // prevents unnecessary notifications when the new node already + // has other users. void add_users_to_worklist(Node* n); // Replace old node with new one. diff --git a/test/hotspot/jtreg/compiler/c2/TestEliminateRedundantConversionSequences.java b/test/hotspot/jtreg/compiler/c2/TestEliminateRedundantConversionSequences.java index b452b8f67dd..f7bcaa94230 100644 --- a/test/hotspot/jtreg/compiler/c2/TestEliminateRedundantConversionSequences.java +++ b/test/hotspot/jtreg/compiler/c2/TestEliminateRedundantConversionSequences.java @@ -23,13 +23,20 @@ /* * @test - * @bug 8359603 + * @bug 8359603 8369646 * @summary Redundant ConvX2Y->ConvY2X->ConvX2Y sequences should be * simplified to a single ConvX2Y operation when applicable * VerifyIterativeGVN checks that this optimization was applied * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions * -XX:CompileCommand=compileonly,compiler.c2.TestEliminateRedundantConversionSequences::test* - * -XX:-TieredCompilation -Xbatch -XX:VerifyIterativeGVN=1110 compiler.c2.TestEliminateRedundantConversionSequences + * -XX:-TieredCompilation -Xbatch -XX:VerifyIterativeGVN=1110 + * -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN + * compiler.c2.TestEliminateRedundantConversionSequences + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions + * -XX:CompileCommand=compileonly,compiler.c2.TestEliminateRedundantConversionSequences::test* + * -XX:-TieredCompilation -Xbatch -XX:VerifyIterativeGVN=1110 + * -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN -XX:StressSeed=115074401 + * compiler.c2.TestEliminateRedundantConversionSequences * @run main compiler.c2.TestEliminateRedundantConversionSequences * */