[PATCH] D148107: [SCEV] Set nowrap for finite non-strict predicates for addrecs

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 03:46:39 PDT 2023


nikic created this revision.
nikic added reviewers: efriedma, mkazantsev, fhahn, reames.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

While we cannot mark the add 1 as nowrap in general (because we only know that it holds at this specific comparison), we can mark it for addrecs in this loop, because their defining scope (in which nowrap must hold) is limited to that loop (and we also know that there are no other normal or abnormal exits, so we're definitely executing this comparison).

This fixes the regression reported in https://reviews.llvm.org/D145510#4259519.


https://reviews.llvm.org/D148107

Files:
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/test/Analysis/ScalarEvolution/finite-trip-count.ll
  llvm/test/Transforms/IndVarSimplify/rewrite-loop-exit-value.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148107.512752.patch
Type: text/x-patch
Size: 9371 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230412/0579dcba/attachment.bin>


More information about the llvm-commits mailing list