summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/2010-03-03-ExtElim.ll
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2010-03-04 06:54:10 +0000
committerNick Lewycky <nicholas@mxc.ca>2010-03-04 06:54:10 +0000
commit5bf7f88ea28dae0cad4f311cc5ef708b6ce50e8f (patch)
tree005f199aaeb501a5c3aa7b633117886e9847abff /test/Transforms/InstCombine/2010-03-03-ExtElim.ll
parente57898ce5596a65579b6259e7d2e65c42a7e364e (diff)
downloadllvm-5bf7f88ea28dae0cad4f311cc5ef708b6ce50e8f.tar.gz
llvm-5bf7f88ea28dae0cad4f311cc5ef708b6ce50e8f.tar.bz2
llvm-5bf7f88ea28dae0cad4f311cc5ef708b6ce50e8f.tar.xz
Make the 'icmp pred trunc(ext(X)), CST --> icmp pred X, ext(trunc(CST))'
transformation much more careful. Truncating binary '01' to '1' sounds like it's safe until you realize that it switched from positive to negative under a signed interpretation, and that depends on the icmp predicate. Also a few miscellaneous cleanups. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97721 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/2010-03-03-ExtElim.ll')
-rw-r--r--test/Transforms/InstCombine/2010-03-03-ExtElim.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/2010-03-03-ExtElim.ll b/test/Transforms/InstCombine/2010-03-03-ExtElim.ll
new file mode 100644
index 0000000000..2df12d670a
--- /dev/null
+++ b/test/Transforms/InstCombine/2010-03-03-ExtElim.ll
@@ -0,0 +1,18 @@
+; RUN: opt -instcombine -S %s | FileCheck %s
+; PR6486
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
+target triple = "i386-unknown-linux-gnu"
+
+@g_92 = common global [2 x i32*] zeroinitializer, align 4 ; <[2 x i32*]*> [#uses=1]
+@g_177 = constant i32** bitcast (i8* getelementptr (i8* bitcast ([2 x i32*]* @g_92 to i8*), i64 4) to i32**), align 4 ; <i32***> [#uses=1]
+
+define i1 @test() nounwind {
+; CHECK: @test
+ %tmp = load i32*** @g_177 ; <i32**> [#uses=1]
+ %cmp = icmp ne i32** null, %tmp ; <i1> [#uses=1]
+ %conv = zext i1 %cmp to i32 ; <i32> [#uses=1]
+ %cmp1 = icmp sle i32 0, %conv ; <i1> [#uses=1]
+ ret i1 %cmp1
+; CHECK: ret i1 true
+}