8343137: C2: VerifyLoopOptimizations fails with "Was reachable in only one"
Reviewed-by: thartmann, kvn
This commit is contained in:
parent
0abfa3ba8f
commit
e389f82b1b
@ -4488,7 +4488,9 @@ void PhaseIdealLoop::eliminate_useless_template_assertion_predicates(Unique_Node
|
||||
OpaqueTemplateAssertionPredicateNode* opaque_node =
|
||||
C->template_assertion_predicate_opaq_node(i - 1)->as_OpaqueTemplateAssertionPredicate();
|
||||
if (!useful_predicates.member(opaque_node)) { // not in the useful list
|
||||
_igvn.replace_node(opaque_node, _igvn.intcon(1));
|
||||
ConINode* one = _igvn.intcon(1);
|
||||
set_ctrl(one, C->root());
|
||||
_igvn.replace_node(opaque_node, one);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8343137
|
||||
* @requires vm.debug == true & vm.compiler2.enabled
|
||||
* @summary Test that set_ctrl() is properly set for true constant when folding useless Template Assertion Predicate.
|
||||
* @run main/othervm -Xcomp -XX:+VerifyLoopOptimizations
|
||||
* -XX:CompileCommand=compileonly,compiler.predicates.assertion.TestMissingSetCtrlForTrueConstant::test
|
||||
* compiler.predicates.assertion.TestMissingSetCtrlForTrueConstant
|
||||
*/
|
||||
|
||||
package compiler.predicates.assertion;
|
||||
|
||||
public class TestMissingSetCtrlForTrueConstant {
|
||||
static long iFld;
|
||||
static int[] iArrFld = new int[100];
|
||||
static double[] dArrFld = new double[100];
|
||||
|
||||
public static void main(String[] strArr) {
|
||||
test();
|
||||
}
|
||||
|
||||
static void test() {
|
||||
long l = 34;
|
||||
for (int i = 78; i > 8; --i) {
|
||||
switch (i) {
|
||||
case 24:
|
||||
l += iFld - 34;
|
||||
case 25:
|
||||
iFld = iArrFld[i] += i;
|
||||
}
|
||||
dArrFld[i + 1] += i;
|
||||
}
|
||||
}
|
||||
}
|
@ -29,14 +29,14 @@
|
||||
* completely with JDK-8288981 and 8314116 just mitigates the problem.
|
||||
* @requires vm.compiler2.enabled
|
||||
* @run main/othervm -Xbatch -XX:-TieredCompilation
|
||||
* -XX:CompileCommand=compileonly,compiler.predicates.TestTemplateAssertionPredicateNotRemoved::*
|
||||
* compiler.predicates.TestTemplateAssertionPredicateNotRemoved
|
||||
* -XX:CompileCommand=compileonly,compiler.predicates.assertion.TestTemplateAssertionPredicateNotRemoved::*
|
||||
* compiler.predicates.assertion.TestTemplateAssertionPredicateNotRemoved
|
||||
* @run main/othervm -Xbatch -XX:-TieredCompilation -XX:LoopMaxUnroll=0
|
||||
* -XX:CompileCommand=compileonly,compiler.predicates.TestTemplateAssertionPredicateNotRemoved::*
|
||||
* compiler.predicates.TestTemplateAssertionPredicateNotRemoved
|
||||
* -XX:CompileCommand=compileonly,compiler.predicates.assertion.TestTemplateAssertionPredicateNotRemoved::*
|
||||
* compiler.predicates.assertion.TestTemplateAssertionPredicateNotRemoved
|
||||
*/
|
||||
|
||||
package compiler.predicates;
|
||||
package compiler.predicates.assertion;
|
||||
|
||||
public class TestTemplateAssertionPredicateNotRemoved {
|
||||
static int[] iArrFld = new int[10];
|
@ -27,11 +27,11 @@
|
||||
* @bug 8342287
|
||||
* @summary Test that a fail path projection of a Template Assertion Predicate is not treated as success path projection.
|
||||
* @run main/othervm -XX:-TieredCompilation -Xbatch
|
||||
* -XX:CompileCommand=compileonly,compiler.predicates.TestTemplateAssertionPredicateWithTwoUCTs::test
|
||||
* compiler.predicates.TestTemplateAssertionPredicateWithTwoUCTs
|
||||
* -XX:CompileCommand=compileonly,compiler.predicates.assertion.TestTemplateAssertionPredicateWithTwoUCTs::test
|
||||
* compiler.predicates.assertion.TestTemplateAssertionPredicateWithTwoUCTs
|
||||
*/
|
||||
|
||||
package compiler.predicates;
|
||||
package compiler.predicates.assertion;
|
||||
|
||||
public class TestTemplateAssertionPredicateWithTwoUCTs {
|
||||
static int iFld;
|
Loading…
Reference in New Issue
Block a user