[llvm] b084b98 - [BasicAA] Make test more robust (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 1 13:57:11 PDT 2021
Author: Nikita Popov
Date: 2021-10-01T22:57:01+02:00
New Revision: b084b98abe07455fe190fba933d14f0dc365dd25
URL: https://github.com/llvm/llvm-project/commit/b084b98abe07455fe190fba933d14f0dc365dd25
DIFF: https://github.com/llvm/llvm-project/commit/b084b98abe07455fe190fba933d14f0dc365dd25.diff
LOG: [BasicAA] Make test more robust (NFC)
When taking into account the fact that GEP indices are truncated
to 32-bits in this test, the "path dependence" goes away, so
inferring MustAlias for all pointers would be correct. As this
goes against the spirit of the test, change it to extend from
i16 instead.
Added:
Modified:
llvm/test/Analysis/BasicAA/q.bad.ll
Removed:
################################################################################
diff --git a/llvm/test/Analysis/BasicAA/q.bad.ll b/llvm/test/Analysis/BasicAA/q.bad.ll
index ac27143c57d1..e2a36cb15d67 100644
--- a/llvm/test/Analysis/BasicAA/q.bad.ll
+++ b/llvm/test/Analysis/BasicAA/q.bad.ll
@@ -47,20 +47,20 @@ define void @based_on_pr18068(i32 %loaded, i8* %mem) {
; CHECK: MayAlias: i8* %a, i8* %b
; CHECK: MustAlias: i8* %a, i8* %c
; CHECK: MayAlias: i8* %a, i8* %d
-define void @test_path_dependence(i32 %p, i8* %mem) {
- %p.minus1 = add i32 %p, -1 ; this will always unsigned-wrap, unless %p == 0
- %p.minus1.64 = zext i32 %p.minus1 to i64
- %p.64.again = add i64 %p.minus1.64, 1 ; either %p (if we wrapped) or 4294967296 (if we didn't)
+define void @test_path_dependence(i16 %p, i8* %mem) {
+ %p.minus1 = add i16 %p, -1 ; this will always unsigned-wrap, unless %p == 0
+ %p.minus1.64 = zext i16 %p.minus1 to i64
+ %p.64.again = add i64 %p.minus1.64, 1 ; either %p (if we wrapped) or 65536 (if we didn't)
- %p.nsw.nuw.minus1 = sub nsw nuw i32 %p, 1 ; as nuw we know %p >= 1, and as nsw %p <= 2147483647
- %p.nsw.nuw.minus1.64 = zext i32 %p.nsw.nuw.minus1 to i64
+ %p.nsw.nuw.minus1 = sub nsw nuw i16 %p, 1 ; as nuw we know %p >= 1, and as nsw %p <= 32767
+ %p.nsw.nuw.minus1.64 = zext i16 %p.nsw.nuw.minus1 to i64
%p.nsw.nuw.64.again = add nsw nuw i64 %p.nsw.nuw.minus1.64, 1 ; ...so always exactly %p
- %p.nsw.minus1 = sub nsw i32 %p, 1 ; only nsw, so can only guarantee %p != 0x10000000
- %p.nsw.minus1.64 = zext i32 %p.nsw.minus1 to i64 ; when %p > 0x10000000 (ie <= 0 as a signed number) then the zext will make this a huge positive number
+ %p.nsw.minus1 = sub nsw i16 %p, 1 ; only nsw, so can only guarantee %p != 0x1000
+ %p.nsw.minus1.64 = zext i16 %p.nsw.minus1 to i64 ; when %p > 0x1000 (ie <= 0 as a signed number) then the zext will make this a huge positive number
%p.nsw.64.again = add nsw i64 %p.nsw.minus1.64, 1 ; ...and so this is very much != %p
- %p.64 = zext i32 %p to i64
+ %p.64 = zext i16 %p to i64
%a = getelementptr inbounds i8, i8* %mem, i64 %p.64
%b = getelementptr inbounds i8, i8* %mem, i64 %p.64.again
%c = getelementptr inbounds i8, i8* %mem, i64 %p.nsw.nuw.64.again
More information about the llvm-commits
mailing list