This is an archive of the discontinued LLVM Phabricator instance.

LoopVectorize/iv-select-cmp: add test for decreasing IV out-of-bound
ClosedPublic

Authored by artagnon on Aug 15 2023, 5:15 AM.

Details

Summary

The most straightforward extension to D150851 would involve handling the
decreasing IV case, for which tests have been added in 110ec1863a
(LoopVectorize/iv-select-cmp: add test for decreasing IV, const start).
However, the commit missed a testcase for the out-of-bound sentinel
value LONG_MAX, which should not be vectorized. Fix this by adding a
test corresponding to the following program:

long test(long *a) {
  long rdx = 331;
  for (long i = LONG_MAX; i >= 0; i--) {
    if (a[i] > 3)
      rdx = i;
  }
  return rdx;
}

Diff Detail

Event Timeline

artagnon created this revision.Aug 15 2023, 5:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 15 2023, 5:15 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
artagnon requested review of this revision.Aug 15 2023, 5:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 15 2023, 5:15 AM
Mel-Chen accepted this revision.Sep 25 2023, 4:20 AM

LG, thanks.

This revision is now accepted and ready to land.Sep 25 2023, 4:20 AM
This revision was landed with ongoing or failed builds.Sep 25 2023, 5:20 AM
This revision was automatically updated to reflect the committed changes.
fhahn added a comment.Sep 25 2023, 5:34 AM

Thanks for adding the extra test coverage, LG!

llvm/test/Transforms/LoopVectorize/iv-select-cmp.ll
455

might be helpful for future readers to add a quick comment to say what this test

artagnon added inline comments.Sep 25 2023, 6:04 AM
llvm/test/Transforms/LoopVectorize/iv-select-cmp.ll
455

Thanks. Added in ad415e3095.