diff options
author | Vedant Kumar <vsk@apple.com> | 2016-05-11 15:45:43 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2016-05-11 15:45:43 +0000 |
commit | ee20294af55e73f12829aefd0b6519cf81efe93d (patch) | |
tree | 77be1cf4e8cecb08ca9aca9adbc6daad5f2aeb99 /llvm/test/Analysis/BasicAA/struct-geps.ll | |
parent | 45533b4060c781a7925faec9f9a933e568e0480b (diff) | |
download | bcm5719-llvm-ee20294af55e73f12829aefd0b6519cf81efe93d.tar.gz bcm5719-llvm-ee20294af55e73f12829aefd0b6519cf81efe93d.zip |
[BasicAA] Compare GEP indices based on value (Fix PR27418)
Equivalent GEP indices with different types are treated as different
indices altogether, leading to an incorrect AA result. Fix the issue
by comparing indices based on their values.
Thanks to Mikael Holmén for reporting the issue!
Differential Revision: http://reviews.llvm.org/D19935
llvm-svn: 269197
Diffstat (limited to 'llvm/test/Analysis/BasicAA/struct-geps.ll')
-rw-r--r-- | llvm/test/Analysis/BasicAA/struct-geps.ll | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/test/Analysis/BasicAA/struct-geps.ll b/llvm/test/Analysis/BasicAA/struct-geps.ll index d63c71a3278..2d85e1dd017 100644 --- a/llvm/test/Analysis/BasicAA/struct-geps.ll +++ b/llvm/test/Analysis/BasicAA/struct-geps.ll @@ -162,3 +162,12 @@ define void @test_struct_in_array(%struct2* %st, i64 %i, i64 %j, i64 %k) { %y = getelementptr %struct2, %struct2* %st, i32 0, i32 0, i32 1, i32 1 ret void } + +; PR27418 - Treat GEP indices with the same value but different types the same +; CHECK-LABEL: test_different_index_types +; CHECK: MustAlias: i16* %tmp1, i16* %tmp2 +define void @test_different_index_types([2 x i16]* %arr) { + %tmp1 = getelementptr [2 x i16], [2 x i16]* %arr, i16 0, i32 1 + %tmp2 = getelementptr [2 x i16], [2 x i16]* %arr, i16 0, i16 1 + ret void +} |