[PATCH] D154415: [LV] Change the test cases to ensure that the trip count is not zero. (NFC)

Mel Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 19:56:09 PDT 2023


Mel-Chen added inline comments.


================
Comment at: llvm/test/Transforms/LoopVectorize/select-min-index.ll:23
   %min.idx.next = select i1 %cmp, i64 %iv, i64 %min.idx
   %iv.next = add nuw nsw i64 %iv, 1
+  %exitcond.not = icmp eq i64 %iv.next, %n
----------------
Ayal wrote:
> Note that checking if %iv.next is zero after bumping it with no-wrap flags (having initialized it to zero) is undefined. As is the case now if %n is zero.
If %n is less than or equal to 0, the loop will result in an infinite loop. To handle such cases, what else can I do for these cases?  Maybe adding a loop guard to ensure that %n is greater than 0?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154415/new/

https://reviews.llvm.org/D154415



More information about the llvm-commits mailing list