[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 15:56:35 PDT 2018
bjope added a comment.
In https://reviews.llvm.org/D46422#1088686, @dberlin wrote:
> Is there an intermediate IR dump you can send me of where you end up with
> phis using phis that are useless?
>
> (I'd also like to understand if you ever get cycles of that happening as
> well)
This is what the function looks like if dumping it just before we start to remove unused PHI:s.
The PHI nodes that are removed are marked with `<--------------`
define void @test() {
entry:
br label %gazank
gazank: ; preds = %gazonk, %entry
%value = phi i16 [ 0, %entry ], [ undef, %gazonk ]
br i1 undef, label %gazink, label %qqq
gazink: ; preds = %gazank
br i1 undef, label %gazonk, label %infinite.loop.pred
gazonk: ; preds = %gazink
br i1 undef, label %exit1, label %gazank
qqq: ; preds = %www, %gazank
%value.lcssa = phi i16 [ %value.lcssa, %www ], [ %value, %gazank ]
br i1 undef, label %www, label %exit2
www: ; preds = %qqq
br i1 undef, label %qqq, label %foo.pred
foo.pred: ; preds = %www
%value.lcssa.lcssa5 = phi i16 [ %value.lcssa, %www ]
br label %foo
foo: ; preds = %unreachable1, %bar, %foo.pred
%value3 = phi i16 [ undef, %unreachable1 ], [ %value3, %bar ], [ %value.lcssa.lcssa5, %foo.pred ]
br i1 undef, label %bar, label %exit1.pred
bar: ; preds = %foo
br i1 undef, label %foo, label %exit2.pred
unreachable1: ; No predecessors!
br i1 undef, label %foo, label %exit2.pred
exit1.pred: ; preds = %foo
%value3.lcssa = phi i16 [ %value3, %foo ] <-----------------
br label %exit1
exit1: ; preds = %exit1.pred, %gazonk
%value.lcssa2 = phi i16 [ %value3.lcssa, %exit1.pred ], [ %value, %gazonk ] <-----------------
ret void
exit2.pred: ; preds = %unreachable1, %bar
%value3.lcssa4 = phi i16 [ undef, %unreachable1 ], [ %value3, %bar ] <-----------------
br label %exit2
exit2: ; preds = %exit2.pred, %qqq
%value.lcssa.lcssa = phi i16 [ %value3.lcssa4, %exit2.pred ], [ %value.lcssa, %qqq ] <-----------------
ret void
infinite.loop.pred: ; preds = %gazink
%value.lcssa1 = phi i16 [ %value, %gazink ]
br label %infinite.loop
infinite.loop: ; preds = %infinite.loop, %infinite.loop.pred
%dead = phi i16 [ %value.lcssa1, %infinite.loop.pred ], [ 0, %infinite.loop ]
br label %infinite.loop
}
Repository:
rL LLVM
https://reviews.llvm.org/D46422
More information about the llvm-commits
mailing list