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