Home | History | Annotate | Download | only in ConstProp
      1 ; RUN: opt < %s -constprop -die -S | FileCheck %s
      2 
      3 ; This is a basic sanity check for constant propagation.  The add instruction
      4 ; should be eliminated.
      5 define i32 @test1(i1 %B) {
      6         br i1 %B, label %BB1, label %BB2
      7 
      8 BB1:      
      9         %Val = add i32 0, 0
     10         br label %BB3
     11 
     12 BB2:      
     13         br label %BB3
     14 
     15 BB3:     
     16 ; CHECK: @test1
     17 ; CHECK: %Ret = phi i32 [ 0, %BB1 ], [ 1, %BB2 ]
     18         %Ret = phi i32 [ %Val, %BB1 ], [ 1, %BB2 ] 
     19         ret i32 %Ret
     20 }
     21 
     22 
     23 ; PR6197
     24 define i1 @test2(i8* %f) nounwind {
     25 entry:
     26   %V = icmp ne i8* blockaddress(@test2, %bb), null
     27   br label %bb
     28 bb:
     29   ret i1 %V
     30   
     31 ; CHECK: @test2
     32 ; CHECK: ret i1 true
     33 }
     34 
     35 define i1 @TNAN() {
     36 ; CHECK: @TNAN
     37 ; CHECK: ret i1 true
     38   %A = fcmp uno double 0x7FF8000000000000, 1.000000e+00
     39   %B = fcmp uno double 1.230000e+02, 1.000000e+00
     40   %C = or i1 %A, %B
     41   ret i1 %C
     42 }
     43