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 -basicaa -gvn -instcombine -dce -S | FileCheck %s
10 ; CHECK: define i32 @test()
11 ; CHECK-NEXT: store i32 123, i32* @B
12 ; CHECK-NEXT: ret i32 0
15 %A1 = load i32, i32* @A
17 store i32 123, i32* @B ; Store cannot alias @A
19 %A2 = load i32, i32* @A
24 ; CHECK: define i32 @test2()
25 ; CHECK-NEXT: br label %Loop
27 ; CHECK-NEXT: store i32 0, i32* @B
28 ; CHECK-NEXT: br i1 true, label %out, label %Loop
30 ; CHECK-NEXT: ret i32 0
33 %A1 = load i32, i32* @A
36 %AP = phi i32 [0, %0], [%X, %Loop]
37 store i32 %AP, i32* @B ; Store cannot alias @A
39 %A2 = load i32, i32* @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
58 %V = load i32, i32* %X