aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2012-03-13 14:07:05 +0000
committerDuncan Sands <baldrick@free.fr>2012-03-13 14:07:05 +0000
commitbd0fe5642544d4ec3aee1ede7af60c006bae5cbf (patch)
treed45f0f6639dd84e8c9d8ac651d4a77ccdb46e2e7 /test
parentc347b6f4b600368751f6f79d270bf58f7d54a348 (diff)
downloadexternal_llvm-bd0fe5642544d4ec3aee1ede7af60c006bae5cbf.zip
external_llvm-bd0fe5642544d4ec3aee1ede7af60c006bae5cbf.tar.gz
external_llvm-bd0fe5642544d4ec3aee1ede7af60c006bae5cbf.tar.bz2
Generalize the "trunc(ptrtoint(x)) - trunc(ptrtoint(y)) ->
trunc(ptrtoint(x-y))" optimization introduced by Chandler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152626 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstSimplify/reassociate.ll9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/reassociate.ll b/test/Transforms/InstSimplify/reassociate.ll
index 3c8169e..e659e6f 100644
--- a/test/Transforms/InstSimplify/reassociate.ll
+++ b/test/Transforms/InstSimplify/reassociate.ll
@@ -184,3 +184,12 @@ define i32 @udiv5(i32 %x, i32 %y) {
; CHECK: ret i32 %x
}
+define i16 @trunc1(i32 %x) {
+; CHECK: @trunc1
+ %y = add i32 %x, 1
+ %tx = trunc i32 %x to i16
+ %ty = trunc i32 %y to i16
+ %d = sub i16 %ty, %tx
+ ret i16 %d
+; CHECK: ret i16 1
+}