Fix PR5391: support early clobber physical register def tied with a use (ewwww)
[oota-llvm.git] / test / CodeGen / X86 / 2009-12-01-EarlyClobberBug.ll
1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
2 ; pr5391
3
4 define void @t() nounwind ssp {
5 entry:
6 ; CHECK: t:
7 ; CHECK: movl %ecx, %eax
8 ; CHECK: %eax = foo (%eax, %ecx)
9   %b = alloca i32                                 ; <i32*> [#uses=2]
10   %a = alloca i32                                 ; <i32*> [#uses=1]
11   %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
12   %0 = load i32* %b, align 4                      ; <i32> [#uses=1]
13   %1 = load i32* %b, align 4                      ; <i32> [#uses=1]
14   %asmtmp = call i32 asm "$0 = foo ($1, $2)", "=&{ax},%0,r,~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 %1) nounwind ; <i32> [#uses=1]
15   store i32 %asmtmp, i32* %a
16   br label %return
17
18 return:                                           ; preds = %entry
19   ret void
20 }
21
22 define void @t2() nounwind ssp {
23 entry:
24 ; CHECK: t2:
25 ; CHECK: movl %eax, %ecx
26 ; CHECK: %ecx = foo (%ecx, %eax)
27   %b = alloca i32                                 ; <i32*> [#uses=2]
28   %a = alloca i32                                 ; <i32*> [#uses=1]
29   %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
30   %0 = load i32* %b, align 4                      ; <i32> [#uses=1]
31   %1 = load i32* %b, align 4                      ; <i32> [#uses=1]
32   %asmtmp = call i32 asm "$0 = foo ($1, $2)", "=&r,%0,r,~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 %1) nounwind ; <i32> [#uses=1]
33   store i32 %asmtmp, i32* %a
34   br label %return
35
36 return:                                           ; preds = %entry
37   ret void
38 }