Home | History | Annotate | Download | only in CorrelatedValuePropagation
      1 ; RUN: opt -correlated-propagation -S %s | FileCheck %s
      2 ; RUN: opt -passes=correlated-propagation -S %s | FileCheck %s
      3 
      4 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
      5 target triple = "x86_64-apple-macosx10.10.0"
      6 
      7 ; Function Attrs: noreturn
      8 declare void @check1(i1) #1
      9 
     10 ; Function Attrs: noreturn
     11 declare void @check2(i1) #1
     12 
     13 ; Make sure we propagate the value of %tmp35 to the true/false cases
     14 ; CHECK-LABEL: @test1
     15 ; CHECK: call void @check1(i1 false)
     16 ; CHECK: call void @check2(i1 true)
     17 define void @test1(i64 %tmp35) {
     18 bb:
     19   %tmp36 = icmp sgt i64 %tmp35, 0
     20   br i1 %tmp36, label %bb_true, label %bb_false
     21 
     22 bb_true:
     23   %tmp47 = icmp slt i64 %tmp35, 0
     24   tail call void @check1(i1 %tmp47) #4
     25   unreachable
     26 
     27 bb_false:
     28   %tmp48 = icmp sle i64 %tmp35, 0
     29   tail call void @check2(i1 %tmp48) #4
     30   unreachable
     31 }
     32 
     33 ; Function Attrs: noreturn
     34 ; This is the same as test1 but with a diamond to ensure we
     35 ; get %tmp36 from both true and false BBs.
     36 ; CHECK-LABEL: @test2
     37 ; CHECK: call void @check1(i1 false)
     38 ; CHECK: call void @check2(i1 true)
     39 define void @test2(i64 %tmp35, i1 %inner_cmp) {
     40 bb:
     41   %tmp36 = icmp sgt i64 %tmp35, 0
     42   br i1 %tmp36, label %bb_true, label %bb_false
     43 
     44 bb_true:
     45   br i1 %inner_cmp, label %inner_true, label %inner_false
     46 
     47 inner_true:
     48   br label %merge
     49 
     50 inner_false:
     51   br label %merge
     52 
     53 merge:
     54   %tmp47 = icmp slt i64 %tmp35, 0
     55   tail call void @check1(i1 %tmp47) #0
     56   unreachable
     57 
     58 bb_false:
     59   %tmp48 = icmp sle i64 %tmp35, 0
     60   tail call void @check2(i1 %tmp48) #4
     61   unreachable
     62 }
     63 
     64 attributes #4 = { noreturn }
     65