Home | History | Annotate | Download | only in CorrelatedValuePropagation
      1 ; RUN: opt < %s -correlated-propagation -S | FileCheck %s
      2 ; PR2581
      3 
      4 ; CHECK: @test1
      5 define i32 @test1(i1 %C) nounwind  {
      6         br i1 %C, label %exit, label %body
      7 
      8 body:           ; preds = %0
      9 ; CHECK-NOT: select
     10         %A = select i1 %C, i32 10, i32 11               ; <i32> [#uses=1]
     11 ; CHECK: ret i32 11
     12         ret i32 %A
     13 
     14 exit:           ; preds = %0
     15 ; CHECK: ret i32 10
     16         ret i32 10
     17 }
     18 
     19 ; PR4420
     20 declare i1 @ext()
     21 ; CHECK: @test2
     22 define i1 @test2() {
     23 entry:
     24         %cond = tail call i1 @ext()             ; <i1> [#uses=2]
     25         br i1 %cond, label %bb1, label %bb2
     26 
     27 bb1:            ; preds = %entry
     28         %cond2 = tail call i1 @ext()            ; <i1> [#uses=1]
     29         br i1 %cond2, label %bb3, label %bb2
     30 
     31 bb2:            ; preds = %bb1, %entry
     32 ; CHECK-NOT: phi i1
     33         %cond_merge = phi i1 [ %cond, %entry ], [ false, %bb1 ]         ; <i1> [#uses=1]
     34 ; CHECK: ret i1 false
     35         ret i1 %cond_merge
     36 
     37 bb3:            ; preds = %bb1
     38         %res = tail call i1 @ext()              ; <i1> [#uses=1]
     39 ; CHECK: ret i1 %res
     40         ret i1 %res
     41 }
     42 
     43 ; PR4855
     44 @gv = internal constant i8 7
     45 ; CHECK: @test3
     46 define i8 @test3(i8* %a) nounwind {
     47 entry:
     48         %cond = icmp eq i8* %a, @gv
     49         br i1 %cond, label %bb2, label %bb
     50 
     51 bb:             ; preds = %entry
     52         ret i8 0
     53 
     54 bb2:            ; preds = %entry
     55 ; CHECK: %should_be_const = load i8* @gv
     56         %should_be_const = load i8* %a
     57         ret i8 %should_be_const
     58 }
     59 
     60 ; PR1757
     61 ; CHECK: @test4
     62 define i32 @test4(i32) {
     63 EntryBlock:
     64 ; CHECK: icmp sgt i32 %0, 2  
     65   %.demorgan = icmp sgt i32 %0, 2    
     66   br i1 %.demorgan, label %GreaterThanTwo, label %LessThanOrEqualToTwo
     67 
     68 GreaterThanTwo:
     69 ; CHECK-NOT: icmp eq i32 %0, 2
     70   icmp eq i32 %0, 2
     71 ; CHECK: br i1 false
     72   br i1 %1, label %Impossible, label %NotTwoAndGreaterThanTwo
     73 
     74 NotTwoAndGreaterThanTwo:
     75   ret i32 2
     76 
     77 Impossible:
     78   ret i32 1
     79 
     80 LessThanOrEqualToTwo:
     81   ret i32 0
     82 }