summaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-09-23 14:16:38 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-09-23 14:16:38 +0000
commitbaca5334db904819e6c0d26cd5f5203f82c44f6e (patch)
tree5a0d51b9e5de6d2c3e8c316092805f3f8781ce1c /test/Transforms
parent9a1aaeb012e593fba977015c5d8b6b1aa41a908c (diff)
downloadllvm-baca5334db904819e6c0d26cd5f5203f82c44f6e.tar.gz
llvm-baca5334db904819e6c0d26cd5f5203f82c44f6e.tar.bz2
llvm-baca5334db904819e6c0d26cd5f5203f82c44f6e.tar.xz
InstSimplify: Fold equality comparisons between non-inbounds GEPs.
Overflow doesn't affect the correctness of equalities. Computing this is cheap, we just reuse the computation for the inbounds case and try to peel of more non-inbounds GEPs. This pattern is unlikely to ever appear in code generated by Clang, but SCEV occasionally produces it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191200 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstSimplify/compare.ll9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll
index 095794923b..73188aa697 100644
--- a/test/Transforms/InstSimplify/compare.ll
+++ b/test/Transforms/InstSimplify/compare.ll
@@ -717,3 +717,12 @@ define i1 @alloca_gep(i64 %a, i64 %b) {
ret i1 %cmp
; CHECK-NEXT: ret i1 false
}
+
+define i1 @non_inbounds_gep_compare(i64* %a) {
+; CHECK-LABEL: @non_inbounds_gep_compare(
+; Equality compares with non-inbounds GEPs can be folded.
+ %x = getelementptr i64* %a, i64 42
+ %cmp = icmp eq i64* %a, %x
+ ret i1 %cmp
+; CHECK-NEXT: ret i1 false
+}