[TwoAddressInstructionPass] When looking for a 3 addr conversion after commuting...
[oota-llvm.git] / test / CodeGen / X86 / 2012-03-26-PostRALICMBug.ll
1 ; REQUIRES: asserts
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -stats 2>&1 | \
3 ; RUN:   not grep "Number of machine instructions hoisted out of loops post regalloc"
4
5 ; rdar://11095580
6
7 %struct.ref_s = type { %union.color_sample, i16, i16 }
8 %union.color_sample = type { i64 }
9
10 @table = external global [3891 x i64]
11
12 declare i32 @foo()
13
14 define i32 @zarray(%struct.ref_s* nocapture %op) nounwind ssp {
15 entry:
16   %call = tail call i32 @foo()
17   %tmp = ashr i32 %call, 31
18   %0 = and i32 %tmp, 1396
19   %index9 = add i32 %0, 2397
20   indirectbr i8* undef, [label %return, label %if.end]
21
22 if.end:                                           ; preds = %entry
23   %size5 = getelementptr inbounds %struct.ref_s, %struct.ref_s* %op, i64 0, i32 2
24   %tmp6 = load i16, i16* %size5, align 2
25   %tobool1 = icmp eq i16 %tmp6, 0
26   %1 = select i1 %tobool1, i32 1396, i32 -1910
27   %index10 = add i32 %index9, %1
28   indirectbr i8* undef, [label %return, label %while.body.lr.ph]
29
30 while.body.lr.ph:                                 ; preds = %if.end
31   %refs = bitcast %struct.ref_s* %op to %struct.ref_s**
32   %tmp9 = load %struct.ref_s*, %struct.ref_s** %refs, align 8
33   %tmp4 = zext i16 %tmp6 to i64
34   %index13 = add i32 %index10, 1658
35   %2 = sext i32 %index13 to i64
36   %3 = getelementptr [3891 x i64], [3891 x i64]* @table, i64 0, i64 %2
37   %blockaddress14 = load i64, i64* %3, align 8
38   %4 = inttoptr i64 %blockaddress14 to i8*
39   indirectbr i8* %4, [label %while.body]
40
41 while.body:                                       ; preds = %while.body, %while.body.lr.ph
42   %index7 = phi i32 [ %index15, %while.body ], [ %index13, %while.body.lr.ph ]
43   %indvar = phi i64 [ %indvar.next, %while.body ], [ 0, %while.body.lr.ph ]
44   %type_attrs = getelementptr %struct.ref_s, %struct.ref_s* %tmp9, i64 %indvar, i32 1
45   store i16 32, i16* %type_attrs, align 2
46   %indvar.next = add i64 %indvar, 1
47   %exitcond5 = icmp eq i64 %indvar.next, %tmp4
48   %tmp7 = select i1 %exitcond5, i32 1648, i32 0
49   %index15 = add i32 %index7, %tmp7
50   %tmp8 = select i1 %exitcond5, i64 13, i64 0
51   %5 = sext i32 %index15 to i64
52   %6 = getelementptr [3891 x i64], [3891 x i64]* @table, i64 0, i64 %5
53   %blockaddress16 = load i64, i64* %6, align 8
54   %7 = inttoptr i64 %blockaddress16 to i8*
55   indirectbr i8* %7, [label %return, label %while.body]
56
57 return:                                           ; preds = %while.body, %if.end, %entry
58   %retval.0 = phi i32 [ %call, %entry ], [ 0, %if.end ], [ 0, %while.body ]
59   ret i32 %retval.0
60 }