This is an archive of the discontinued LLVM Phabricator instance.

LoopVectorize/iv-select-cmp: add test for decreasing IV, const start
ClosedPublic

Authored by artagnon on Jul 24 2023, 10:32 AM.

Details

Summary

The most straightforward extension to D150851 would involve a loop with
decreasing induction variable, with a constant start value.
iv-select-cmp.ll only contains a negative test for the decreasing
induction variable case when the start value is variable, namely
not_vectorized_select_decreasing_induction_icmp. Hence, add a test for
the most straightforward extension to D150851, in preparation to
vectorize:

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

Diff Detail

Event Timeline

artagnon created this revision.Jul 24 2023, 10:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2023, 10:32 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
artagnon requested review of this revision.Jul 24 2023, 10:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2023, 10:32 AM
artagnon updated this revision to Diff 543973.Jul 25 2023, 7:43 AM

Remove noundef in argument.

Mel-Chen accepted this revision.Jul 25 2023, 8:30 PM

LG

llvm/test/Transforms/LoopVectorize/iv-select-cmp.ll
218–219

nit:

; CHECK-LABEL: @not_vectorized_select_decreasing_induction_icmp_const_start
; CHECK-NOT:   vector.body
;
This revision is now accepted and ready to land.Jul 25 2023, 8:30 PM
This revision was landed with ongoing or failed builds.Jul 26 2023, 6:15 AM
This revision was automatically updated to reflect the committed changes.