diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-09-08 02:23:31 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-09-08 02:23:31 +0000 |
commit | 81ac8ddc674d1589dbba97f752ec77750901f510 (patch) | |
tree | ef0a07cd2eeaa849a61b2e3368d9e4efe9859ba7 /test/Analysis | |
parent | e64fb28da191bc978ab99ea397e6108a15c364f8 (diff) | |
download | external_llvm-81ac8ddc674d1589dbba97f752ec77750901f510.zip external_llvm-81ac8ddc674d1589dbba97f752ec77750901f510.tar.gz external_llvm-81ac8ddc674d1589dbba97f752ec77750901f510.tar.bz2 |
Fix the logic in BasicAliasAnalysis::aliasGEP for comparing GEP's with variable differences so that it actually does something sane. Fixes PR10881.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139276 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r-- | test/Analysis/BasicAA/gep-alias.ll | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/Analysis/BasicAA/gep-alias.ll b/test/Analysis/BasicAA/gep-alias.ll index 69f7faf..4bb2832 100644 --- a/test/Analysis/BasicAA/gep-alias.ll +++ b/test/Analysis/BasicAA/gep-alias.ll @@ -169,3 +169,35 @@ define i8 @test10([4 x i8] *%P, i32 %i) { ; CHECK: @test10 ; CHECK: ret i8 0 } + +; (This was a miscompilation.) +define float @test11(i32 %indvar, [4 x [2 x float]]* %q) nounwind ssp { + %tmp = mul i32 %indvar, -1 + %dec = add i32 %tmp, 3 + %scevgep = getelementptr [4 x [2 x float]]* %q, i32 0, i32 %dec + %scevgep35 = bitcast [2 x float]* %scevgep to i64* + %arrayidx28 = getelementptr inbounds [4 x [2 x float]]* %q, i32 0, i32 0 + %y29 = getelementptr inbounds [2 x float]* %arrayidx28, i32 0, i32 1 + store float 1.0, float* %y29, align 4 + store i64 0, i64* %scevgep35, align 4 + %tmp30 = load float* %y29, align 4 + ret float %tmp30 + ; CHECK: @test11 + ; CHECK: ret float %tmp30 +} + +; (This was a miscompilation.) +define i32 @test12(i32 %x, i32 %y, i8* %p) nounwind { + %a = bitcast i8* %p to [13 x i8]* + %b = getelementptr [13 x i8]* %a, i32 %x + %c = bitcast [13 x i8]* %b to [15 x i8]* + %d = getelementptr [15 x i8]* %c, i32 %y, i32 8 + %castd = bitcast i8* %d to i32* + %castp = bitcast i8* %p to i32* + store i32 1, i32* %castp + store i32 0, i32* %castd + %r = load i32* %castp + ret i32 %r + ; CHECK: @test12 + ; CHECK: ret i32 %r +} |