summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/fast-isel-x86-64.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-04-22 21:59:37 +0000
committerChris Lattner <sabre@nondot.org>2011-04-22 21:59:37 +0000
commitb686af053e6544191420978f6a3adc7e74ab0192 (patch)
tree7c76d9e2e5856a04e8f4002e6ec0613eae766c05 /test/CodeGen/X86/fast-isel-x86-64.ll
parent597fa65373b824c840212cf238a73ae13dc35494 (diff)
downloadllvm-b686af053e6544191420978f6a3adc7e74ab0192.tar.gz
llvm-b686af053e6544191420978f6a3adc7e74ab0192.tar.bz2
llvm-b686af053e6544191420978f6a3adc7e74ab0192.tar.xz
Recommit the fix for rdar://9289512 with a couple tweaks to
fix bugs exposed by the gcc dejagnu testsuite: 1. The load may actually be used by a dead instruction, which would cause an assert. 2. The load may not be used by the current chain of instructions, and we could move it past a side-effecting instruction. Change how we process uses to define the problem away. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130018 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/fast-isel-x86-64.ll')
-rw-r--r--test/CodeGen/X86/fast-isel-x86-64.ll47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/CodeGen/X86/fast-isel-x86-64.ll b/test/CodeGen/X86/fast-isel-x86-64.ll
index 5762ef3312..d45a54fb14 100644
--- a/test/CodeGen/X86/fast-isel-x86-64.ll
+++ b/test/CodeGen/X86/fast-isel-x86-64.ll
@@ -14,6 +14,28 @@ define i32 @test1(i32 %i) nounwind ssp {
; CHECK: andl $8,
+; rdar://9289512 - The load should fold into the compare.
+define void @test2(i64 %x) nounwind ssp {
+entry:
+ %x.addr = alloca i64, align 8
+ store i64 %x, i64* %x.addr, align 8
+ %tmp = load i64* %x.addr, align 8
+ %cmp = icmp sgt i64 %tmp, 42
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %entry
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ ret void
+; CHECK: test2:
+; CHECK: movq %rdi, -8(%rsp)
+; CHECK: cmpq $42, -8(%rsp)
+}
+
+
+
+
@G = external global i32
define i64 @test3() nounwind {
%A = ptrtoint i32* @G to i64
@@ -178,3 +200,28 @@ block2:
call void (...)* @test16callee(double 1.000000e+00)
ret void
}
+
+
+declare void @foo() unnamed_addr ssp align 2
+
+; Verify that we don't fold the load into the compare here. That would move it
+; w.r.t. the call.
+define i32 @test17(i32 *%P) ssp nounwind {
+entry:
+ %tmp = load i32* %P
+ %cmp = icmp ne i32 %tmp, 5
+ call void @foo()
+ br i1 %cmp, label %if.then, label %if.else
+
+if.then: ; preds = %entry
+ ret i32 1
+
+if.else: ; preds = %entry
+ ret i32 2
+; CHECK: test17:
+; CHECK: movl (%rdi), %eax
+; CHECK: callq _foo
+; CHECK: cmpl $5, %eax
+; CHECK-NEXT: je
+}
+