1 ; RUN: opt -scoped-noalias -basicaa -gvn -S < %s | FileCheck %s
3 define i32 @test1(i32* %p, i32* %q) {
4 ; CHECK-LABEL: @test1(i32* %p, i32* %q)
5 ; CHECK: load i32, i32* %p
7 ; CHECK: %c = add i32 %a, %a
8 %a = load i32, i32* %p, !noalias !0
14 define i32 @test2(i32* %p, i32* %q) {
15 ; CHECK-LABEL: @test2(i32* %p, i32* %q)
16 ; CHECK: load i32, i32* %p, !alias.scope !0
17 ; CHECK: %c = add i32 %a, %a
18 %a = load i32, i32* %p, !alias.scope !0
19 %b = load i32, i32* %p, !alias.scope !0
24 ; FIXME: In this case we can do better than intersecting the scopes, and can
25 ; concatenate them instead. Both loads are in the same basic block, the first
26 ; makes the second safe to speculatively execute, and there are no calls that may
28 define i32 @test3(i32* %p, i32* %q) {
29 ; CHECK-LABEL: @test3(i32* %p, i32* %q)
30 ; CHECK: load i32, i32* %p, !alias.scope !1
31 ; CHECK: %c = add i32 %a, %a
32 %a = load i32, i32* %p, !alias.scope !1
33 %b = load i32, i32* %p, !alias.scope !2
38 declare i32 @foo(i32*) readonly