[PATCH] D132704: [LCSSA] Re-use suitable PHI if available instead creating new ones.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 14:19:03 PDT 2022


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

If ExitBB already contains a phi with a constant incoming value, re-use
it instead of creating a new phi. If the incoming value of the re-used
phi node is not yet in LCSSA form it will get formed in subsequent
iterations, like for newly created ones.

This means we won't end up with multiple LCSSA phi nodes when an
existing PHI can already be re-used. This is in particular relevant for
code that needs to re-build LCSSA for some values on demand, like
SCEVExpander.

This patch ensures that only be a single LCSSA phi will be created and
re-used when expanding the same expressions multiple times.

Fixes #57000.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132704

Files:
  llvm/lib/Transforms/Utils/LCSSA.cpp
  llvm/test/Transforms/IndVarSimplify/lcssa-preservation.ll
  llvm/test/Transforms/LoopUnroll/rebuild_lcssa.ll
  llvm/test/Transforms/LoopVectorize/create-induction-resume.ll
  llvm/test/Transforms/LoopVectorize/skeleton-lcssa-crash.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132704.455713.patch
Type: text/x-patch
Size: 9506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220825/50a340b5/attachment.bin>


More information about the llvm-commits mailing list