[PATCH] D66890: [IndVarSimplify] Do not use SCEV expander for IVCount in LFTR when possible.

Alexander Us via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 09:26:09 PDT 2019


aus_intel created this revision.
aus_intel added reviewers: sanjoy, llvm-commits.
aus_intel added a project: LLVM.
Herald added subscribers: javed.absar, hiraditya.

SCEV analysis cannot properly cache instruction with poison flags
(for example, add nsw outside of loop will not be reused by expander).
This can lead to generating of additional instructions by SCEV expander.

Example IR:

  ...
  %maxval = add nuw nsw i32 %a1, %a2
  ...

for.body:

  ...
  %cmp22 = icmp ult i32 %ivadd, %maxval
  br i1 %cmp22, label %for.body, label %for.end
  ...

SCEV expander will generate copy of %maxval in preheader but without
nuw/nsw flags. This can be avoided by explicit check that iv count
value gives the same SCEV expression as calculated by LFTR.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66890

Files:
  llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
  llvm/test/Transforms/IndVarSimplify/add_nsw.ll
  llvm/test/Transforms/IndVarSimplify/lftr-reuse.ll
  llvm/test/Transforms/IndVarSimplify/udiv.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66890.217664.patch
Type: text/x-patch
Size: 4569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190828/a5a195d4/attachment.bin>


More information about the llvm-commits mailing list