ipa.ll
3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-unknown-linux"
attributes #0 = { noinline sanitize_memtag "target-features"="+mte,+neon" }
define dso_local void @Write1(i8* %p) #0 {
entry:
store i8 0, i8* %p, align 1
ret void
}
define dso_local void @Write4(i8* %p) #0 {
entry:
%0 = bitcast i8* %p to i32*
store i32 0, i32* %0, align 1
ret void
}
define dso_local void @Write4_2(i8* %p, i8* %q) #0 {
entry:
%0 = bitcast i8* %p to i32*
store i32 0, i32* %0, align 1
%1 = bitcast i8* %q to i32*
store i32 0, i32* %1, align 1
ret void
}
define dso_local void @Write8(i8* %p) #0 {
entry:
%0 = bitcast i8* %p to i64*
store i64 0, i64* %0, align 1
ret void
}
define dso_local i8* @WriteAndReturn8(i8* %p) #0 {
entry:
store i8 0, i8* %p, align 1
ret i8* %p
}
declare dso_local void @ExternalCall(i8* %p)
define dso_preemptable void @PreemptableWrite1(i8* %p) #0 {
entry:
store i8 0, i8* %p, align 1
ret void
}
define linkonce dso_local void @InterposableWrite1(i8* %p) #0 {
entry:
store i8 0, i8* %p, align 1
ret void
}
define dso_local i8* @ReturnDependent(i8* %p) #0 {
entry:
%p2 = getelementptr i8, i8* %p, i64 2
ret i8* %p2
}
; access range [2, 6)
define dso_local void @Rec0(i8* %p) #0 {
entry:
%p1 = getelementptr i8, i8* %p, i64 2
call void @Write4(i8* %p1)
ret void
}
; access range [3, 7)
define dso_local void @Rec1(i8* %p) #0 {
entry:
%p1 = getelementptr i8, i8* %p, i64 1
call void @Rec0(i8* %p1)
ret void
}
; access range [-2, 2)
define dso_local void @Rec2(i8* %p) #0 {
entry:
%p1 = getelementptr i8, i8* %p, i64 -5
call void @Rec1(i8* %p1)
ret void
}
; Recursive function that passes %acc unchanged => access range [0, 4).
define dso_local void @RecursiveNoOffset(i32* %p, i32 %size, i32* %acc) {
entry:
%cmp = icmp eq i32 %size, 0
br i1 %cmp, label %return, label %if.end
if.end:
%0 = load i32, i32* %p, align 4
%1 = load i32, i32* %acc, align 4
%add = add nsw i32 %1, %0
store i32 %add, i32* %acc, align 4
%add.ptr = getelementptr inbounds i32, i32* %p, i64 1
%sub = add nsw i32 %size, -1
tail call void @RecursiveNoOffset(i32* %add.ptr, i32 %sub, i32* %acc)
ret void
return:
ret void
}
; Recursive function that advances %acc on each iteration => access range unlimited.
define dso_local void @RecursiveWithOffset(i32 %size, i32* %acc) {
entry:
%cmp = icmp eq i32 %size, 0
br i1 %cmp, label %return, label %if.end
if.end:
store i32 0, i32* %acc, align 4
%acc2 = getelementptr inbounds i32, i32* %acc, i64 1
%sub = add nsw i32 %size, -1
tail call void @RecursiveWithOffset(i32 %sub, i32* %acc2)
ret void
return:
ret void
}
define dso_local i64* @ReturnAlloca() {
entry:
%x = alloca i64, align 4
ret i64* %x
}
define dso_local void @Write1Private(i8* %p) #0 {
entry:
call void @Private(i8* %p)
ret void
}
define dso_local void @Write1SameModule(i8* %p) #0 {
entry:
call void @Write1(i8* %p)
ret void
}
declare void @Write1Module0(i8* %p)
define dso_local void @Write1DiffModule(i8* %p) #0 {
entry:
call void @Write1Module0(i8* %p)
ret void
}
define private dso_local void @Private(i8* %p) #0 {
entry:
%p1 = getelementptr i8, i8* %p, i64 -1
store i8 0, i8* %p1, align 1
ret void
}
define dso_local void @Write1Weak(i8* %p) #0 {
entry:
call void @Weak(i8* %p)
ret void
}
define weak dso_local void @Weak(i8* %p) #0 {
entry:
%p1 = getelementptr i8, i8* %p, i64 -1
store i8 0, i8* %p1, align 1
ret void
}