1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -basic-aa -dse -S | FileCheck %s
4 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
7 define void @test4(i32* noalias %P) {
9 ; CHECK-NEXT: store i32 0, i32* [[P:%.*]], align 4
10 ; CHECK-NEXT: br i1 true, label [[BB1:%.*]], label [[BB2:%.*]]
12 ; CHECK-NEXT: br label [[BB3:%.*]]
14 ; CHECK-NEXT: [[X:%.*]] = load i32, i32* [[P]], align 4
15 ; CHECK-NEXT: br label [[BB3]]
17 ; CHECK-NEXT: store i32 1, i32* [[P]], align 4
18 ; CHECK-NEXT: ret void
21 br i1 true, label %bb1, label %bb2
25 %x = load i32, i32* %P
32 define void @test5(i32* noalias %P) {
33 ; CHECK-LABEL: @test5(
34 ; CHECK-NEXT: br i1 true, label [[BB1:%.*]], label [[BB2:%.*]]
36 ; CHECK-NEXT: br label [[BB3:%.*]]
38 ; CHECK-NEXT: br label [[BB3]]
40 ; CHECK-NEXT: store i32 0, i32* [[P:%.*]], align 4
41 ; CHECK-NEXT: ret void
43 br i1 true, label %bb1, label %bb2
55 define void @test8(i32* %P, i32* %Q) {
56 ; CHECK-LABEL: @test8(
57 ; CHECK-NEXT: br i1 true, label [[BB1:%.*]], label [[BB2:%.*]]
59 ; CHECK-NEXT: br label [[BB3:%.*]]
61 ; CHECK-NEXT: store i32 1, i32* [[Q:%.*]], align 4
62 ; CHECK-NEXT: br label [[BB3]]
64 ; CHECK-NEXT: store i32 0, i32* [[P:%.*]], align 4
65 ; CHECK-NEXT: ret void
67 br i1 true, label %bb1, label %bb2
79 define void @test10(i32* noalias %P) {
80 ; CHECK-LABEL: @test10(
81 ; CHECK-NEXT: store i32 1, i32* [[P:%.*]], align 4
82 ; CHECK-NEXT: br i1 true, label [[BB1:%.*]], label [[BB2:%.*]]
84 ; CHECK-NEXT: br label [[BB3:%.*]]
86 ; CHECK-NEXT: br label [[BB3]]
88 ; CHECK-NEXT: ret void
90 %P2 = bitcast i32* %P to i8*
92 br i1 true, label %bb1, label %bb2
104 ; Check a function with a MemoryPhi with 3 incoming values.
105 define void @widget(i32* %Ptr, i1 %c1, i1 %c2, i32 %v1, i32 %v2, i32 %v3) {
106 ; CHECK-LABEL: @widget(
108 ; CHECK-NEXT: tail call void @hoge()
109 ; CHECK-NEXT: br i1 [[C1:%.*]], label [[BB3:%.*]], label [[BB1:%.*]]
111 ; CHECK-NEXT: br i1 [[C2:%.*]], label [[BB2:%.*]], label [[BB3]]
113 ; CHECK-NEXT: br label [[BB3]]
115 ; CHECK-NEXT: br label [[BB4:%.*]]
117 ; CHECK-NEXT: switch i32 [[V1:%.*]], label [[BB8:%.*]] [
118 ; CHECK-NEXT: i32 0, label [[BB5:%.*]]
119 ; CHECK-NEXT: i32 1, label [[BB6:%.*]]
120 ; CHECK-NEXT: i32 2, label [[BB7:%.*]]
123 ; CHECK-NEXT: store i32 0, i32* [[PTR:%.*]], align 4
124 ; CHECK-NEXT: br label [[BB8]]
126 ; CHECK-NEXT: store i32 1, i32* [[PTR]], align 4
127 ; CHECK-NEXT: br label [[BB8]]
129 ; CHECK-NEXT: store i32 2, i32* [[PTR]], align 4
130 ; CHECK-NEXT: br label [[BB8]]
132 ; CHECK-NEXT: br label [[BB4]]
135 tail call void @hoge()
136 br i1 %c1, label %bb3, label %bb1
139 br i1 %c2, label %bb2, label %bb3
142 store i32 -1, i32* %Ptr, align 4
145 bb3: ; preds = %bb2, %bb1, %bb
148 bb4: ; preds = %bb8, %bb3
149 switch i32 %v1, label %bb8 [
156 store i32 0, i32* %Ptr, align 4
160 store i32 1, i32* %Ptr, align 4
164 store i32 2, i32* %Ptr, align 4
167 bb8: ; preds = %bb7, %bb6, %bb5, %bb4
172 declare void @fn1_test11()
173 declare void @fn2_test11()
175 define void @test11(i1 %c, i8** %ptr.1) {
176 ; CHECK-LABEL: @test11(
178 ; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_THEN:%.*]], label [[EXIT:%.*]]
180 ; CHECK-NEXT: tail call void @fn2_test11() #0
181 ; CHECK-NEXT: br label [[EXIT]]
183 ; CHECK-NEXT: store i8* null, i8** [[PTR_1:%.*]], align 8
184 ; CHECK-NEXT: tail call void @fn2_test11() #0
185 ; CHECK-NEXT: ret void
188 br i1 %c, label %if.then, label %exit
190 if.then: ; preds = %entry
191 tail call void @fn2_test11() #1
195 store i8* null, i8** %ptr.1, align 8
196 tail call void @fn2_test11() #1
200 attributes #1 = { nounwind }