Skip to content

Commit 917983d

Browse files
davleopoelkorchi
authored andcommitted
reuse loopex.absStrideIsOne
(cherry picked from commit 429b3f9fb983e98bd87b8d440c43195e4d75f0d1)
1 parent 212002d commit 917983d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/loop/phases/LoopPredicationPhase.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,8 @@ protected void run(StructuredGraph graph, MidTierContext context) {
112112
final InductionVariable counter = counted.getLimitCheckedIV();
113113
final Condition condition = ((CompareNode) counted.getLimitTest().condition()).condition().asCondition();
114114
final boolean inverted = loop.counted().isInverted();
115-
if ((((IntegerStamp) counter.valueNode().stamp(NodeView.DEFAULT)).getBits() == 32) &&
116-
!counted.isUnsignedCheck() &&
117-
// math.abs can overflow here but only to min again which is
118-
// never == 1
119-
((condition != NE && condition != EQ) || (counter.isConstantStride() && Math.abs(counter.constantStride()) == 1)) &&
115+
if ((((IntegerStamp) counter.valueNode().stamp(NodeView.DEFAULT)).getBits() == 32) && !counted.isUnsignedCheck() &&
116+
((condition != NE && condition != EQ) || (counter.isConstantStride() && LoopEx.absStrideIsOne(counter))) &&
120117
(loop.loopBegin().isMainLoop() || loop.loopBegin().isSimpleLoop())) {
121118
NodeIterable<GuardNode> guards = loop.whole().nodes().filter(GuardNode.class);
122119
if (LoopPredicationMainPath.getValue(graph.getOptions())) {

0 commit comments

Comments
 (0)