Add a triple to switch.ll test.
[oota-llvm.git] / test / CodeGen / X86 / pr20020.ll
1 ; RUN: llc < %s -mtriple=x86_64-apple-macosx -disable-lsr -post-RA-scheduler=1 -break-anti-dependencies=critical  | FileCheck %s
2
3 ; In PR20020, the critical anti-dependency breaker algorithm mistakenly
4 ; changes the register operands of an 'xorl %eax, %eax' to 'xorl %ecx, %ecx'
5 ; and then immediately reloads %rcx with a value based on the wrong %rax
6
7 ; CHECK-NOT: xorl %ecx, %ecx
8 ; CHECK: leaq 1(%rax), %rcx
9
10
11 %struct.planet = type { double, double, double }
12
13 ; Function Attrs: nounwind ssp uwtable
14 define void @advance(i32 %nbodies, %struct.planet* nocapture %bodies) #0 {
15 entry:
16   %cmp4 = icmp sgt i32 %nbodies, 0
17   br i1 %cmp4, label %for.body.preheader, label %for.end38
18
19 for.body.preheader:                               ; preds = %entry
20   %gep = getelementptr %struct.planet, %struct.planet* %bodies, i64 1, i32 1
21   %gep13 = bitcast double* %gep to %struct.planet*
22   %0 = add i32 %nbodies, -1
23   br label %for.body
24
25 for.body:                                         ; preds = %for.body.preheader, %for.inc20
26   %iv19 = phi i32 [ %0, %for.body.preheader ], [ %iv.next, %for.inc20 ]
27   %iv = phi %struct.planet* [ %gep13, %for.body.preheader ], [ %gep14, %for.inc20 ]
28   %iv9 = phi i64 [ %iv.next10, %for.inc20 ], [ 0, %for.body.preheader ]
29   %iv.next10 = add nuw nsw i64 %iv9, 1
30   %1 = trunc i64 %iv.next10 to i32
31   %cmp22 = icmp slt i32 %1, %nbodies
32   br i1 %cmp22, label %for.body3.lr.ph, label %for.inc20
33
34 for.body3.lr.ph:                                  ; preds = %for.body
35   %x = getelementptr inbounds %struct.planet, %struct.planet* %bodies, i64 %iv9, i32 0
36   %y = getelementptr inbounds %struct.planet, %struct.planet* %bodies, i64 %iv9, i32 1
37   %vx = getelementptr inbounds %struct.planet, %struct.planet* %bodies, i64 %iv9, i32 2
38   br label %for.body3
39
40 for.body3:                                        ; preds = %for.body3, %for.body3.lr.ph
41   %iv20 = phi i32 [ %iv.next21, %for.body3 ], [ %iv19, %for.body3.lr.ph ]
42   %iv15 = phi %struct.planet* [ %gep16, %for.body3 ], [ %iv, %for.body3.lr.ph ]
43   %iv1517 = bitcast %struct.planet* %iv15 to double*
44   %2 = load double, double* %x, align 8
45   %gep18 = getelementptr double, double* %iv1517, i64 -1
46   %3 = load double, double* %gep18, align 8
47   %sub = fsub double %2, %3
48   %4 = load double, double* %y, align 8
49   %5 = load double, double* %iv1517, align 8
50   %sub8 = fsub double %4, %5
51   %add10 = fadd double %sub, %sub8
52   %call = tail call double @sqrt(double %sub8) #2
53   store double %add10, double* %vx, align 8
54   %gep16 = getelementptr %struct.planet, %struct.planet* %iv15, i64 1
55   %iv.next21 = add i32 %iv20, -1
56   %exitcond = icmp eq i32 %iv.next21, 0
57   br i1 %exitcond, label %for.inc20, label %for.body3
58
59 for.inc20:                                        ; preds = %for.body3, %for.body
60   %lftr.wideiv11 = trunc i64 %iv.next10 to i32
61   %gep14 = getelementptr %struct.planet, %struct.planet* %iv, i64 1
62   %iv.next = add i32 %iv19, -1
63   %exitcond12 = icmp eq i32 %lftr.wideiv11, %nbodies
64   br i1 %exitcond12, label %for.end38, label %for.body
65
66 for.end38:                                        ; preds = %for.inc20, %entry
67   ret void
68 }
69
70 ; Function Attrs: nounwind
71 declare double @sqrt(double) #1
72
73 attributes #0 = { "no-frame-pointer-elim-non-leaf" }