1 ; This test makes sure that these instructions are properly eliminated.
3 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep phi
7 int %test1(int %A, bool %b) {
8 BB0: br bool %b, label %BB1, label %BB2
10 %B = phi int [%A, %BB0] ; Combine away one argument PHI nodes
16 int %test2(int %A, bool %b) {
17 BB0: br bool %b, label %BB1, label %BB2
21 %B = phi int [%A, %BB0], [%A, %BB1] ; Combine away PHI nodes with same values
25 int %test3(int %A, bool %b) {
29 %B = phi int [%A, %BB0], [%B, %Loop] ; PHI has same value always.
30 br bool %b, label %Loop, label %Exit
36 BB0: ret int 7 ; Loop is unreachable
39 %B = phi int [%B, %L2], [%B, %Loop] ; PHI has same value always.
40 br bool %b, label %L2, label %Loop
45 int %test5(int %A, bool %b) {
49 %B = phi int [%A, %BB0], [undef, %Loop] ; PHI has same value always.
50 br bool %b, label %Loop, label %Exit
55 uint %test6(int %A, bool %b) {
57 %X = cast int %A to uint
58 br bool %b, label %BB1, label %BB2
60 %Y = cast int %A to uint
63 %B = phi uint [%X, %BB0], [%Y, %BB1] ;; Suck casts into phi
67 int %test7(int %A, bool %b) {
71 %B = phi int [%A, %BB0], [%C, %Loop] ; PHI is dead.
73 br bool %b, label %Loop, label %Exit