Skip to content

Commit

Permalink
reuse loopex.absStrideIsOne
Browse files Browse the repository at this point in the history
(cherry picked from commit 429b3f9fb983e98bd87b8d440c43195e4d75f0d1)
  • Loading branch information
davleopo authored and elkorchi committed Feb 11, 2024
1 parent 212002d commit 917983d
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,8 @@ protected void run(StructuredGraph graph, MidTierContext context) {
final InductionVariable counter = counted.getLimitCheckedIV();
final Condition condition = ((CompareNode) counted.getLimitTest().condition()).condition().asCondition();
final boolean inverted = loop.counted().isInverted();
if ((((IntegerStamp) counter.valueNode().stamp(NodeView.DEFAULT)).getBits() == 32) &&
!counted.isUnsignedCheck() &&
// math.abs can overflow here but only to min again which is
// never == 1
((condition != NE && condition != EQ) || (counter.isConstantStride() && Math.abs(counter.constantStride()) == 1)) &&
if ((((IntegerStamp) counter.valueNode().stamp(NodeView.DEFAULT)).getBits() == 32) && !counted.isUnsignedCheck() &&
((condition != NE && condition != EQ) || (counter.isConstantStride() && LoopEx.absStrideIsOne(counter))) &&
(loop.loopBegin().isMainLoop() || loop.loopBegin().isSimpleLoop())) {
NodeIterable<GuardNode> guards = loop.whole().nodes().filter(GuardNode.class);
if (LoopPredicationMainPath.getValue(graph.getOptions())) {
Expand Down

0 comments on commit 917983d

Please sign in to comment.