[PATCH] D105723: [LSR] Do not hoist IV if it is not post increment case. PR43678

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 9 12:29:09 PDT 2021


skatkov created this revision.
skatkov added reviewers: efriedma, mkazantsev, ebrevnov, reames, qcolombet.
Herald added subscribers: javed.absar, hiraditya.
skatkov requested review of this revision.
Herald added a project: LLVM.

Hosting IV in SCEV expander of non post-increment IV seems unprofitable.
Moreover it is dangerous as it might appear that the SCEV represents an instruction
which LSR plans to update to replace its operand. In this case instruction to change is hoisted
while the value to replace operand will be expanded in the older place.
It ends up with incorrect SSA form.

Two attached tests shows the bad behavior.


https://reviews.llvm.org/D105723

Files:
  llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
  llvm/test/Transforms/LoopStrengthReduce/pr43678-2.ll
  llvm/test/Transforms/LoopStrengthReduce/pr43678.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105723.357594.patch
Type: text/x-patch
Size: 5240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210709/903937a5/attachment.bin>


More information about the llvm-commits mailing list