diff --git a/src/hotspot/share/opto/phaseX.cpp b/src/hotspot/share/opto/phaseX.cpp index ce5160c5984aa..63cd07da2952c 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 300c8fc27574d..b4aea5270c0a2 100644 --- a/src/hotspot/share/opto/phaseX.hpp +++ b/src/hotspot/share/opto/phaseX.hpp @@ -528,7 +528,21 @@ class PhaseIterGVN : public PhaseGVN { // 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. 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. + // This function may be called with a node that is about to be + // replaced as argument 'n'. 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 b452b8f67ddda..f7bcaa942305a 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 * */