Home | History | Annotate | Download | only in GVN
      1 ; RUN: opt -gvn -S -o - %s | FileCheck %s
      2 
      3 ; If a branch has two identical successors, we cannot declare either dead.
      4 
      5 define void @widget(i1 %p) {
      6 entry:
      7   br label %bb2
      8 
      9 bb2:
     10   %t1 = phi i64 [ 0, %entry ], [ %t5, %bb7 ]
     11   %t2 = add i64 %t1, 1
     12   %t3 = icmp ult i64 0, %t2
     13   br i1 %t3, label %bb3, label %bb4
     14 
     15 bb3:
     16   %t4 = call i64 @f()
     17   br label %bb4
     18 
     19 bb4:
     20   ; CHECK-NOT: phi {{.*}} undef
     21   %foo = phi i64 [ %t4, %bb3 ], [ 0, %bb2 ]
     22   br i1 %p, label %bb5, label %bb6
     23 
     24 bb5:
     25   br i1 true, label %bb7, label %bb7
     26 
     27 bb6:
     28   br i1 true, label %bb7, label %bb7
     29 
     30 bb7:
     31   %t5 = add i64 %t1, 1
     32   br i1 %p, label %bb2, label %bb8
     33 
     34 bb8:
     35   ret void
     36 }
     37 
     38 declare i64 @f()
     39