[PATCH] D111495: [IndVars] Invalidate SCEV when IR is changed in rewriteLoopExitValue.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 9 08:49:08 PDT 2021


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

At the moment, rewriteLoopExitValue forgets the current phi node in the
loop that collects phis to rewrite. A few lines after the value is
forgotten, SCEV is used again to analyze incoming values and
potentially expand SCEV expression. This means that another SCEV is
created for PN, before the IR is actually updated in the next loop.

This leads to accessing invalid cached expression in combination with

1.

PN should only be changed once the actual incoming exit value is set in
the next loop. Moving invalidation there should ensure that PN is
invalidated in all relevant cases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111495

Files:
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/test/Transforms/IndVarSimplify/elim-extend.ll
  llvm/test/Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111495.378457.patch
Type: text/x-patch
Size: 7433 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211009/817bf714/attachment.bin>


More information about the llvm-commits mailing list