1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/Transforms/LCSSA/remove-phis.ll
Bjorn Pettersson 6b2e39a77a [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

llvm-svn: 331741
2018-05-08 06:59:47 +00:00

57 lines
989 B
LLVM

; RUN: opt < %s -lcssa -verify -S -o /dev/null
; This bugpoint reduced test case used to assert when removing unused PHI nodes.
; Just verify that we do not assert/crash.
define void @test() {
entry:
br label %gazank
gazank:
%value = phi i16 [ 0, %entry ], [ undef, %gazonk ]
br i1 undef, label %gazink, label %qqq
gazink:
br i1 undef, label %gazonk, label %infinite.loop.pred
gazonk:
br i1 undef, label %exit1, label %gazank
qqq:
br i1 undef, label %www, label %exit2
www:
br i1 undef, label %qqq, label %foo.pred
foo.pred:
br label %foo
foo:
br i1 undef, label %bar, label %exit1.pred
bar:
br i1 undef, label %foo, label %exit2.pred
unreachable1:
br i1 undef, label %foo, label %exit2.pred
exit1.pred:
br label %exit1
exit1:
ret void
exit2.pred:
br label %exit2
exit2:
ret void
infinite.loop.pred:
br label %infinite.loop
infinite.loop:
%dead = phi i16 [ %value, %infinite.loop.pred ], [ 0, %infinite.loop ]
br label %infinite.loop
}