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
8 int %test1(int %A, bool %b) {
9 BB0: br bool %b, label %BB1, label %BB2
11 %B = phi int [%A, %BB0] ; Combine away one argument PHI nodes
17 int %test2(int %A, bool %b) {
18 BB0: br bool %b, label %BB1, label %BB2
22 %B = phi int [%A, %BB0], [%A, %BB1] ; Combine away PHI nodes with same values
26 int %test3(int %A, bool %b) {
30 %B = phi int [%A, %BB0], [%B, %Loop] ; PHI has same value always.
31 br bool %b, label %Loop, label %Exit
37 BB0: ret int 7 ; Loop is unreachable
40 %B = phi int [%B, %L2], [%B, %Loop] ; PHI has same value always.
41 br bool %b, label %L2, label %Loop
46 int %test5(int %A, bool %b) {
50 %B = phi int [%A, %BB0], [undef, %Loop] ; PHI has same value always.
51 br bool %b, label %Loop, label %Exit
56 uint %test6(int %A, bool %b) {
58 %X = cast int %A to uint
59 br bool %b, label %BB1, label %BB2
61 %Y = cast int %A to uint
64 %B = phi uint [%X, %BB0], [%Y, %BB1] ;; Suck casts into phi
68 int %test7(int %A, bool %b) {
72 %B = phi int [%A, %BB0], [%C, %Loop] ; PHI is dead.
74 br bool %b, label %Loop, label %Exit