summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-04-22 18:47:44 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-04-22 18:47:44 +0000
commit341c11da3bda1a3f877a3dc6e96f7d1f866f703f (patch)
tree228b68cdcf3a22072f811465d3ab9fbcf8ab2523 /llvm/test/CodeGen
parentad45d911bb63141f0904b00c41a5f4f992f0ef33 (diff)
downloadbcm5719-llvm-341c11da3bda1a3f877a3dc6e96f7d1f866f703f.tar.gz
bcm5719-llvm-341c11da3bda1a3f877a3dc6e96f7d1f866f703f.zip
DAGCombine: fold "(zext x) == C" into "x == (trunc C)" if the trunc is lossless.
On x86 this allows to fold a load into the cmp, greatly reducing register pressure. movzbl (%rdi), %eax cmpl $47, %eax -> cmpb $47, (%rdi) This shaves 8k off gcc.o on i386. I'll leave applying the patch in README.txt to Chris :) llvm-svn: 130005
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/X86/shrink-compare.ll36
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/shrink-compare.ll b/llvm/test/CodeGen/X86/shrink-compare.ll
new file mode 100644
index 00000000000..7eaf9411c1b
--- /dev/null
+++ b/llvm/test/CodeGen/X86/shrink-compare.ll
@@ -0,0 +1,36 @@
+; RUN: llc < %s -march=x86-64 | FileCheck %s
+
+declare void @bar()
+
+define void @test1(i32* nocapture %X) nounwind {
+entry:
+ %tmp1 = load i32* %X, align 4
+ %and = and i32 %tmp1, 255
+ %cmp = icmp eq i32 %and, 47
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then:
+ tail call void @bar() nounwind
+ br label %if.end
+
+if.end:
+ ret void
+; CHECK: test1:
+; CHECK: cmpb $47, (%rdi)
+}
+
+define void @test2(i32 %X) nounwind {
+entry:
+ %and = and i32 %X, 255
+ %cmp = icmp eq i32 %and, 47
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then:
+ tail call void @bar() nounwind
+ br label %if.end
+
+if.end:
+ ret void
+; CHECK: test2:
+; CHECK: cmpb $47, %dil
+}
OpenPOWER on IntegriCloud