OSDN Git Service

[LCSSA] Do not remove used PHI nodes in formLCSSAForInstructions
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Tue, 8 May 2018 06:59:47 +0000 (06:59 +0000)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Tue, 8 May 2018 06:59:47 +0000 (06:59 +0000)
commite5fae2e7c318fb405c693d4c88141eeb221d41d4
treec446f85cda8283510585580ee1b8a7dae336c554
parenta4f2996da071142335b028db33f0468e1535068b
[LCSSA] Do not remove used PHI nodes in formLCSSAForInstructions

Summary:
In formLCSSAForInstructions we speculatively add new PHI
nodes, that sometimes ends up without having any uses. It
has been discovered that sometimes an added PHI node can
appear as being unused in one iteration of the Worklist,
although it can end up being used by a PHI node added in
a later iteration. We now check, a second time, that the
PHI node still is unused before we remove it. This avoids
an assert about "Trying to remove a phi with uses." for the
added test case.

Reviewers: davide, mzolotukhin, mattd, dberlin

Reviewed By: mzolotukhin, dberlin

Subscribers: dberlin, mzolotukhin, davide, bjope, uabelho, llvm-commits

Differential Revision: https://reviews.llvm.org/D46422

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331741 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/LCSSA.cpp
test/Transforms/LCSSA/remove-phis.ll [new file with mode: 0644]