[PATCH] D129753: [SCEV] Prove condition invariance via context

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 04:45:07 PDT 2022


mkazantsev created this revision.
mkazantsev added reviewers: nikic, lebedev.ri, reames, skatkov.
Herald added a subscriber: hiraditya.
Herald added a project: All.
mkazantsev requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Contextual knowledge may be used to prove invariance of some conditions.
For example, in this case:

  ; %len >= 0
  guard(%iv = {start,+,1}<nuw> <s %len)
  guard(%iv = {start,+,1}<nuw> <u %len)

the 2nd check always fails if `start` is negative and always passes otherwise.

It looks like there is more opportunities of this kind that are still to be implemented.


https://reviews.llvm.org/D129753

Files:
  llvm/include/llvm/Analysis/ScalarEvolution.h
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
  llvm/test/Transforms/IndVarSimplify/cycled_phis.ll
  llvm/test/Transforms/IndVarSimplify/outer_phi.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129753.444591.patch
Type: text/x-patch
Size: 7290 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220714/302db390/attachment.bin>


More information about the llvm-commits mailing list