Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt < %s -S -instcombine | FileCheck %s
      2 @A = extern_weak global i32, align 4
      3 @B = extern_weak global i32, align 4
      4 
      5 define i32 @foo(i1 %which) {
      6 entry:
      7   br i1 %which, label %final, label %delay
      8 
      9 delay:
     10   br label %final
     11 
     12 ; CHECK-LABEL: final:
     13 ; CHECK: phi i32 [ 1, %entry ], [ select (i1 icmp eq (i32* @A, i32* @B), i32 2, i32 1), %delay ]
     14 final:
     15   %use2 = phi i1 [ false, %entry ], [ icmp eq (i32* @A, i32* @B), %delay ]
     16   %value = select i1 %use2, i32 2, i32 1
     17   ret i32 %value
     18 }
     19 
     20