[PATCH] D129214: [IndVars] Call replaceLoopPHINodesWithPreheaderValues() for already constant exits

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 6 08:30:25 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.

Currently we only call replaceLoopPHINodesWithPreheaderValues() if optimizeLoopExits() replaces the exit with an unconditional exit. However, it is very common that this already happens as part of eliminateIVComparison(), in which case we're leaving behind the dead header phi.

Tweak the early bailout for already-constant exits to also call replaceLoopPHINodesWithPreheaderValues().


https://reviews.llvm.org/D129214

Files:
  llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
  llvm/test/Transforms/IndVarSimplify/X86/loop-invariant-conditions.ll
  llvm/test/Transforms/IndVarSimplify/X86/pr35406.ll
  llvm/test/Transforms/IndVarSimplify/eliminate-comparison.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
  llvm/test/Transforms/LoopVectorize/X86/pr54413-select-interleave-count-loop-with-cost-zero.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129214.442596.patch
Type: text/x-patch
Size: 18057 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220706/84dace05/attachment.bin>


More information about the llvm-commits mailing list