• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -scoped-noalias-aa -basic-aa -newgvn -S < %s | FileCheck %s
2
3define i32 @test1(i32* %p, i32* %q) {
4; CHECK-LABEL: @test1(i32* %p, i32* %q)
5; CHECK: load i32, i32* %p
6; CHECK-NOT: noalias
7; CHECK: %c = add i32 %a, %a
8  %a = load i32, i32* %p, !noalias !3
9  %b = load i32, i32* %p
10  %c = add i32 %a, %b
11  ret i32 %c
12}
13
14define i32 @test2(i32* %p, i32* %q) {
15; CHECK-LABEL: @test2(i32* %p, i32* %q)
16; CHECK: load i32, i32* %p, align 4, !alias.scope ![[SCOPE1:[0-9]+]]
17; CHECK: %c = add i32 %a, %a
18  %a = load i32, i32* %p, !alias.scope !3
19  %b = load i32, i32* %p, !alias.scope !3
20  %c = add i32 %a, %b
21  ret i32 %c
22}
23
24define i32 @test3(i32* %p, i32* %q) {
25; CHECK-LABEL: @test3(i32* %p, i32* %q)
26; CHECK: load i32, i32* %p, align 4, !alias.scope ![[SCOPE2:[0-9]+]]
27; CHECK: %c = add i32 %a, %a
28  %a = load i32, i32* %p, !alias.scope !4
29  %b = load i32, i32* %p, !alias.scope !5
30  %c = add i32 %a, %b
31  ret i32 %c
32}
33
34; CHECK:   ![[SCOPE1]] = !{!{{[0-9]+}}}
35; CHECK:   ![[SCOPE2]] = !{!{{[0-9]+}}, !{{[0-9]+}}}
36declare i32 @foo(i32*) readonly
37
38!0 = distinct !{!0, !2, !"callee0: %a"}
39!1 = distinct !{!1, !2, !"callee0: %b"}
40!2 = distinct !{!2, !"callee0"}
41
42!3 = !{!0}
43!4 = !{!1}
44!5 = !{!0, !1}
45