[PATCH] D46422: [LCSSA] Iteratively remove unused PHI nodes in formLCSSAForInstructions

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 4 03:55:07 PDT 2018


bjope created this revision.
bjope added reviewers: davide, mzolotukhin, mattd.

At the end of formLCSSAForInstructions we remove PHI nodes that
were added speculatively, but ended up as never being used.
In the past we determined if a node should be removed before
the whole Worklist had been processed. So we could end up
adding a PHI node (currently not being used) to the PHIsToRemove
list, and then before doing the actual removal we could introduce
new uses of the PHI node when speculatively adding new PHI nodes.

Now we create a list of all PHI nodes that has been added while
processing the Worklist, and then we iteratively remove unused
PHI nodes at the end of formLCSSAForInstructions. This will
avoid the assertion about "Trying to remove a phi with uses" as
well as catching the situation when one added (and unused) PHI
node is using another added (but otherwise unused) PHI node.


Repository:
  rL LLVM

https://reviews.llvm.org/D46422

Files:
  lib/Transforms/Utils/LCSSA.cpp
  test/Transforms/LCSSA/remove-phis.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46422.145170.patch
Type: text/x-patch
Size: 12722 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180504/1b36c8fb/attachment.bin>


More information about the llvm-commits mailing list