Fix PR5391: support early clobber physical register def tied with a use (ewwww)
[oota-llvm.git] / test / CodeGen / X86 / 2009-09-07-CoalescerBug.ll
1 ; RUN: llc < %s -mtriple=x86_64-unknown-freebsd7.2 -code-model=kernel | FileCheck %s
2 ; PR4689
3
4 %struct.__s = type { [8 x i8] }
5 %struct.pcb = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i16, i8* }
6 %struct.pcpu = type { i32*, i32*, i32*, i32*, %struct.pcb*, i64, i32, i32, i32, i32 }
7
8 define i64 @hammer_time(i64 %modulep, i64 %physfree) nounwind ssp noredzone noimplicitfloat {
9 ; CHECK: hammer_time:
10 ; CHECK: movq $Xrsvd, %rax
11 ; CHECK: movq $Xrsvd, %rdi
12 ; CHECK: movq $Xrsvd, %r8
13 entry:
14   br i1 undef, label %if.then, label %if.end
15
16 if.then:                                          ; preds = %entry
17   br label %if.end
18
19 if.end:                                           ; preds = %if.then, %entry
20   br label %for.body
21
22 for.body:                                         ; preds = %for.inc, %if.end
23   switch i32 undef, label %if.then76 [
24     i32 9, label %for.inc
25     i32 10, label %for.inc
26     i32 11, label %for.inc
27     i32 12, label %for.inc
28   ]
29
30 if.then76:                                        ; preds = %for.body
31   unreachable
32
33 for.inc:                                          ; preds = %for.body, %for.body, %for.body, %for.body
34   br i1 undef, label %for.end, label %for.body
35
36 for.end:                                          ; preds = %for.inc
37   call void asm sideeffect "mov $1,%gs:$0", "=*m,r,~{dirflag},~{fpsr},~{flags}"(%struct.__s* bitcast (%struct.pcb** getelementptr (%struct.pcpu* null, i32 0, i32 4) to %struct.__s*), i64 undef) nounwind
38   br label %for.body170
39
40 for.body170:                                      ; preds = %for.body170, %for.end
41   store i64 or (i64 and (i64 or (i64 ptrtoint (void (i32, i32, i32, i32)* @Xrsvd to i64), i64 2097152), i64 2162687), i64 or (i64 or (i64 and (i64 shl (i64 ptrtoint (void (i32, i32, i32, i32)* @Xrsvd to i64), i64 32), i64 -281474976710656), i64 140737488355328), i64 15393162788864)), i64* undef
42   br i1 undef, label %for.end175, label %for.body170
43
44 for.end175:                                       ; preds = %for.body170
45   unreachable
46 }
47
48 declare void @Xrsvd(i32, i32, i32, i32) ssp noredzone noimplicitfloat