summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/fold-load.ll
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2012-08-02 00:56:42 +0000
committerManman Ren <mren@apple.com>2012-08-02 00:56:42 +0000
commit5759d012309a3fedab83ad0db16934c5f708d00f (patch)
tree2e8ad671d543c3ae9adfd4b4f018587a62d4d3e9 /llvm/test/CodeGen/X86/fold-load.ll
parent4c4fe84b25a8c866d396d08f3000e7e56ccc0c7d (diff)
downloadbcm5719-llvm-5759d012309a3fedab83ad0db16934c5f708d00f.tar.gz
bcm5719-llvm-5759d012309a3fedab83ad0db16934c5f708d00f.zip
X86 Peephole: fold loads to the source register operand if possible.
Machine CSE and other optimizations can remove instructions so folding is possible at peephole while not possible at ISel. This patch is a rework of r160919 and was tested on clang self-host on my local machine. rdar://10554090 and rdar://11873276 llvm-svn: 161152
Diffstat (limited to 'llvm/test/CodeGen/X86/fold-load.ll')
-rw-r--r--llvm/test/CodeGen/X86/fold-load.ll26
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/fold-load.ll b/llvm/test/CodeGen/X86/fold-load.ll
index e03cb7edb58..c961f7576f9 100644
--- a/llvm/test/CodeGen/X86/fold-load.ll
+++ b/llvm/test/CodeGen/X86/fold-load.ll
@@ -45,3 +45,29 @@ L:
}
+; rdar://10554090
+; xor in exit block will be CSE'ed and load will be folded to xor in entry.
+define i1 @test3(i32* %P, i32* %Q) nounwind {
+; CHECK: test3:
+; CHECK: movl 8(%esp), %eax
+; CHECK: xorl (%eax),
+; CHECK: j
+; CHECK-NOT: xor
+entry:
+ %0 = load i32* %P, align 4
+ %1 = load i32* %Q, align 4
+ %2 = xor i32 %0, %1
+ %3 = and i32 %2, 65535
+ %4 = icmp eq i32 %3, 0
+ br i1 %4, label %exit, label %land.end
+
+exit:
+ %shr.i.i19 = xor i32 %1, %0
+ %5 = and i32 %shr.i.i19, 2147418112
+ %6 = icmp eq i32 %5, 0
+ br label %land.end
+
+land.end:
+ %7 = phi i1 [ %6, %exit ], [ false, %entry ]
+ ret i1 %7
+}
OpenPOWER on IntegriCloud