summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstSimplify/compare.ll
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-08-07 07:58:10 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-08-07 07:58:10 +0000
commitdc8767a49afe43b8d4bd5d9ad7e812bb662881fc (patch)
treee951145017ee36fe612dd7a8fe942600fb40a211 /llvm/test/Transforms/InstSimplify/compare.ll
parent4e4f4437c27744de40acb2f79e51a7617352d7b6 (diff)
downloadbcm5719-llvm-dc8767a49afe43b8d4bd5d9ad7e812bb662881fc.tar.gz
bcm5719-llvm-dc8767a49afe43b8d4bd5d9ad7e812bb662881fc.zip
[InstSimplify] Try hard to simplify pointer comparisons
Simplify ptrtoint comparisons involving operands with different source types. llvm-svn: 277951
Diffstat (limited to 'llvm/test/Transforms/InstSimplify/compare.ll')
-rw-r--r--llvm/test/Transforms/InstSimplify/compare.ll13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/compare.ll b/llvm/test/Transforms/InstSimplify/compare.ll
index 5c1bbc0c61c..bf22dbda4f1 100644
--- a/llvm/test/Transforms/InstSimplify/compare.ll
+++ b/llvm/test/Transforms/InstSimplify/compare.ll
@@ -206,6 +206,19 @@ define i1 @gep16(i8* %ptr, i32 %a) {
; CHECK-NEXT: ret i1 false
}
+define i1 @gep17() {
+; CHECK-LABEL: @gep17(
+ %alloca = alloca i32, align 4
+ %bc = bitcast i32* %alloca to [4 x i8]*
+ %gep1 = getelementptr inbounds i32, i32* %alloca, i32 1
+ %pti1 = ptrtoint i32* %gep1 to i32
+ %gep2 = getelementptr inbounds [4 x i8], [4 x i8]* %bc, i32 0, i32 1
+ %pti2 = ptrtoint i8* %gep2 to i32
+ %cmp = icmp ugt i32 %pti1, %pti2
+ ret i1 %cmp
+; CHECK-NEXT: ret i1 true
+}
+
define i1 @zext(i32 %x) {
; CHECK-LABEL: @zext(
%e1 = zext i32 %x to i64
OpenPOWER on IntegriCloud