[PATCH] D70786: [SimpleLoopUnswitch] Invalidate the topmost loop with ExitBB as exiting.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 27 07:50:00 PST 2019


fhahn created this revision.
fhahn added reviewers: skatkov, reames, asbirlea, chandlerc.
Herald added subscribers: javed.absar, hiraditya.
Herald added a project: LLVM.

SCEV caches the exiting blocks when computing exit counts. In
SimpleLoopUnswitch, we split the exit block of the loop to unswitch.

Currently we only invalidate the loop containing that exit block, but if
that block is the exiting block for a parent loop, we have stale cache
entries. We have to invalidate the top-most loop that contains the exit
block as exiting block. We might also be able to skip invalidating the
loop containing the exit block, if the exit block is not an exiting
block of that loop.

There are also 2 more places in SimpleLoopUnswitch, that use a similar
problematic approach to get the loop to invalidate. If the patch makes
sense, I will also update those places to a similar approach (they deal
with multiple exit blocks, so we cannot directly re-use
getTopMostExitingLoop).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70786

Files:
  llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
  llvm/test/Transforms/SimpleLoopUnswitch/preserve-scev-exiting-multiple-loops.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70786.231262.patch
Type: text/x-patch
Size: 4052 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191127/2c71aa03/attachment.bin>


More information about the llvm-commits mailing list