Skip to content

Commit 2ae67c9

Browse files
committed
[BasicAA] Add range test with multiple indices (NFC)
1 parent 35c767a commit 2ae67c9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

llvm/test/Analysis/BasicAA/range.ll

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,25 @@ define void @zeroext_index([256 x i32]* %s, i8* %q) {
178178
ret void
179179
}
180180

181+
; CHECK-LABEL: Function: multiple
182+
; CHECK: MayAlias: i32* %p, i32* %p.01
183+
; CHECK: MayAlias: i32* %p, i32* %p.02
184+
; CHECK: MayAlias: i32* %p.01, i32* %p.02
185+
; CHECK: NoAlias: i32* %p.01, i32* %p.2
186+
; CHECK: MayAlias: i32* %p.02, i32* %p.2
187+
; CHECK: NoAlias: i32* %p.01, i32* %p.3
188+
; TODO: This can be NoAlias.
189+
; CHECK: MayAlias: i32* %p.02, i32* %p.3
190+
define void @multiple(i32* %p, i32* %o1_ptr, i32* %o2_ptr) {
191+
%o1 = load i32, i32* %o1_ptr, !range !0
192+
%o2 = load i32, i32* %o2_ptr, !range !0
193+
%p.01 = getelementptr i32, i32* %p, i32 %o1 ; p + [0, 1]
194+
%p.02 = getelementptr i32, i32* %p.01, i32 %o2 ; p + [0, 2]
195+
%p.2 = getelementptr i32, i32* %p, i32 2
196+
%p.3 = getelementptr i32, i32* %p, i32 3
197+
ret void
198+
}
199+
181200

182201
!0 = !{ i32 0, i32 2 }
183202
!1 = !{ i32 0, i32 1 }

0 commit comments

Comments
 (0)