1 ; Test that GCSE uses basicaa to do alias analysis, which is capable of
2 ; disambiguating some obvious cases. All loads should be removable in
5 ; RUN: opt < %s -aa-pipeline=basic-aa -passes=gvn,instcombine,dce -S | FileCheck %s
10 ; CHECK: define i32 @test()
11 ; CHECK-NEXT: store i32 123, ptr @B
12 ; CHECK-NEXT: ret i32 0
15 %A1 = load i32, ptr @A
17 store i32 123, ptr @B ; Store cannot alias @A
19 %A2 = load i32, ptr @A
24 ; CHECK: define i32 @test2()
25 ; CHECK-NEXT: br label %Loop
27 ; CHECK-NEXT: store i32 0, ptr @B
28 ; CHECK-NEXT: br i1 true, label %out, label %Loop
30 ; CHECK-NEXT: ret i32 0
33 %A1 = load i32, ptr @A
36 %AP = phi i32 [0, %0], [%X, %Loop]
37 store i32 %AP, ptr @B ; Store cannot alias @A
39 %A2 = load i32, ptr @A
41 %c = icmp eq i32 %X, 0
42 br i1 %c, label %out, label %Loop
48 declare void @external()
50 ; CHECK: define i32 @test3()
51 ; CHECK-NEXT: call void @external()
52 ; CHECK-NEXT: ret i32 7