[PATCH] D129293: [IndVars] Simplify instructions after replacing header phi with preheader value

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 08:10:32 PDT 2022


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

After replacing a loop phi with the preheader value, it's usually possible to simplify some of the using instructions, so do that as part of replaceLoopPHINodesWithPreheaderValues().

Doing this as part of IndVars is valuable, because it may make GEPs in the loop have constant offsets and allow the following SROA run to succeed. (I can add a phase ordering test for this if desired.)

Depends on D129214 <https://reviews.llvm.org/D129214>.


https://reviews.llvm.org/D129293

Files:
  llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
  llvm/test/Transforms/IndVarSimplify/X86/pr35406.ll
  llvm/test/Transforms/IndVarSimplify/eliminate-backedge.ll
  llvm/test/Transforms/IndVarSimplify/eliminate-exit-no-dl.ll
  llvm/test/Transforms/IndVarSimplify/floating-point-iv.ll
  llvm/test/Transforms/IndVarSimplify/lcssa-preservation.ll
  llvm/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
  llvm/test/Transforms/IndVarSimplify/pr22222.ll
  llvm/test/Transforms/IndVarSimplify/pr40454.ll
  llvm/test/Transforms/IndVarSimplify/scev-expander-preserve-lcssa.ll
  llvm/test/Transforms/IndVarSimplify/sentinel.ll
  llvm/test/Transforms/LoopDeletion/pr53969.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129293.442921.patch
Type: text/x-patch
Size: 17123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220707/de86f536/attachment.bin>


More information about the llvm-commits mailing list