1 ; RUN: opt -passes=print-alias-sets -S -o - < %s 2>&1 | FileCheck %s --implicit-check-not="Unknown instructions"
3 ; CHECK: Alias sets for function 'test1':
4 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
5 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %a, LocationSize::precise(1))
6 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %b, LocationSize::precise(1))
7 define void @test1(i32 %c) {
9 %a = alloca i8, align 1
10 %b = alloca i8, align 1
11 store i8 1, ptr %a, align 1
12 %cond1 = icmp ne i32 %c, 0
13 call void @llvm.assume(i1 %cond1)
14 store i8 1, ptr %b, align 1
18 ; CHECK: Alias sets for function 'test2':
19 ; CHECK: Alias Set Tracker: 3 alias sets for 2 pointer values.
20 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %a, LocationSize::precise(1))
21 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] may alias, Ref
22 ; CHECK: 1 Unknown instructions: call void (i1, ...) @llvm.experimental.guard(i1 %cond1) [ "deopt"() ]
23 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %b, LocationSize::precise(1))
24 define void @test2(i32 %c) {
26 %a = alloca i8, align 1
27 %b = alloca i8, align 1
28 store i8 1, ptr %a, align 1
29 %cond1 = icmp ne i32 %c, 0
30 call void (i1, ...) @llvm.experimental.guard(i1 %cond1)["deopt"()]
31 store i8 1, ptr %b, align 1
35 ; CHECK: Alias sets for function 'test3':
36 ; CHECK: Alias Set Tracker: 1 alias sets for 2 pointer values.
37 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 3] may alias, Mod/Ref Memory locations: (ptr %a, LocationSize::precise(1)), (ptr %b, LocationSize::precise(1))
38 ; CHECK: 1 Unknown instructions: call void (i1, ...) @llvm.experimental.guard(i1 %cond1) [ "deopt"() ]
39 define void @test3(i32 %c, ptr %a, ptr %b) {
41 store i8 1, ptr %a, align 1
42 %cond1 = icmp ne i32 %c, 0
43 call void (i1, ...) @llvm.experimental.guard(i1 %cond1)["deopt"()]
44 store i8 1, ptr %b, align 1
48 ; CHECK: Alias sets for function 'test4':
49 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
50 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 2] may alias, Mod/Ref Memory locations: (ptr %a, LocationSize::precise(1))
51 ; CHECK: 1 Unknown instructions: call void (i1, ...) @llvm.experimental.guard(i1 %cond1) [ "deopt"() ]
52 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %b, LocationSize::precise(1))
53 define void @test4(i32 %c, ptr %a) {
55 %b = alloca i8, align 1
56 store i8 1, ptr %a, align 1
57 %cond1 = icmp ne i32 %c, 0
58 call void (i1, ...) @llvm.experimental.guard(i1 %cond1)["deopt"()]
59 store i8 1, ptr %b, align 1
63 ; CHECK: Alias sets for function 'test5':
64 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
65 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %a, LocationSize::precise(1))
66 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %b, LocationSize::precise(1))
67 define void @test5() {
69 %a = alloca i8, align 1
70 %b = alloca i8, align 1
71 store i8 1, ptr %a, align 1
72 call void @llvm.experimental.noalias.scope.decl(metadata !0)
73 store i8 1, ptr %b, align 1
77 ; CHECK: Alias sets for function 'test_runtime':
78 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
79 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %a, LocationSize::precise(1))
80 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %b, LocationSize::precise(1))
81 define i1 @test_runtime() local_unnamed_addr {
83 %a = alloca i8, align 1
84 %b = alloca i8, align 1
85 store i8 1, ptr %a, align 1
86 %allow = call i1 @llvm.allow.runtime.check(metadata !"test_check")
87 store i8 1, ptr %b, align 1
91 ; CHECK: Alias sets for function 'test_ubsan':
92 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
93 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %a, LocationSize::precise(1))
94 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %b, LocationSize::precise(1))
95 define i1 @test_ubsan() local_unnamed_addr {
97 %a = alloca i8, align 1
98 %b = alloca i8, align 1
99 store i8 1, ptr %a, align 1
100 %allow = call i1 @llvm.allow.ubsan.check(i8 7)
101 store i8 1, ptr %b, align 1
105 declare i1 @llvm.allow.ubsan.check(i8)
106 declare i1 @llvm.allow.runtime.check(metadata)
107 declare void @llvm.assume(i1)
108 declare void @llvm.experimental.guard(i1, ...)
109 declare void @llvm.experimental.noalias.scope.decl(metadata)
112 !1 = distinct !{ !1, !2, !"test5: var" }
113 !2 = distinct !{ !2, !"test5" }