[PATCH] D147662: [LoopPredication] Fix where we generate widened condition. PR61963

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 14:34:25 PDT 2023


anna created this revision.
anna added reviewers: mkazantsev, reames, apilipenko.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
anna requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Loop predication's predicateLoopExit pass does two incorrect things:

It sinks the widenable call into the loop, thereby converting an invariant condition to a variant one
It widens the widenable call at a branch thereby converting it into a loop-varying one.

The latter is problematic when the branch may have been a loop-invariant
branch and prior optimizations (such as indvars) may have relied on this
fact, and updated the deopt state accordingly.

Now, when we widen this with a loop-varying condition, the deopt state
is no longer correct. See
https://github.com/llvm/llvm-project/issues/61963.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147662

Files:
  llvm/lib/Transforms/Scalar/LoopPredication.cpp
  llvm/test/Transforms/LoopPredication/pr61963.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147662.511210.patch
Type: text/x-patch
Size: 8453 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230405/259657be/attachment.bin>


More information about the llvm-commits mailing list