blob: db06b329f9b9093319f6d6e763b7f3970fab991d [file] [log] [blame]
Jakob Stoklund Olesen8dce8422010-04-15 23:19:16 +00001; RUN: llc < %s | FileCheck %s
Bill Wendling1a4c2e32010-06-03 07:54:20 +00002; XFAIL: *
3;
4; See <rdar://problem/8030636>. This test isn't valid after we made machine
5; sinking more conservative about sinking instructions that define a preg into a
6; block when we don't know if the preg is killed within the current block.
7
Jakob Stoklund Olesen8dce8422010-04-15 23:19:16 +00008target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
9target triple = "x86_64-apple-darwin10.0.0"
10
11define i32 @f(i32 %x) nounwind ssp {
12entry:
13 %shl.i = shl i32 %x, 12
14 %neg.i = xor i32 %shl.i, -1
15 %add.i = add nsw i32 %neg.i, %x
16 %shr.i = ashr i32 %add.i, 22
17 %xor.i = xor i32 %shr.i, %add.i
18 %shl5.i = shl i32 %xor.i, 13
19 %neg6.i = xor i32 %shl5.i, -1
20 %add8.i = add nsw i32 %xor.i, %neg6.i
21 %shr10.i = ashr i32 %add8.i, 8
22 %xor12.i = xor i32 %shr10.i, %add8.i
23 %add16.i = mul i32 %xor12.i, 9
24 %shr18.i = ashr i32 %add16.i, 15
25 %xor20.i = xor i32 %shr18.i, %add16.i
26 %shl22.i = shl i32 %xor20.i, 27
27 %neg23.i = xor i32 %shl22.i, -1
28 %add25.i = add nsw i32 %xor20.i, %neg23.i
29 %shr27.i = ashr i32 %add25.i, 31
30 %rem = srem i32 %x, 7
31 %cmp = icmp eq i32 %rem, 3
32 br i1 %cmp, label %land.lhs.true, label %do.body.preheader
33
34land.lhs.true:
35 %call3 = tail call i32 @g(i32 %x) nounwind
36 %cmp4 = icmp eq i32 %call3, 10
37 br i1 %cmp4, label %do.body.preheader, label %if.then
38
39; %shl.i should be sinked all the way down to do.body.preheader, but not into the loop.
40; CHECK: do.body.preheader
41; CHECK-NOT: do.body
42; CHECK: shll $12
43
44do.body.preheader:
45 %xor29.i = xor i32 %shr27.i, %add25.i
46 br label %do.body
47
48if.then:
49 %add = add nsw i32 %x, 11
50 ret i32 %add
51
52do.body:
53 %x.addr.1 = phi i32 [ %add9, %do.body ], [ %x, %do.body.preheader ]
54 %xor = xor i32 %xor29.i, %x.addr.1
55 %add9 = add nsw i32 %xor, %x.addr.1
56 %and = and i32 %add9, 13
57 %tobool = icmp eq i32 %and, 0
58 br i1 %tobool, label %if.end, label %do.body
59
60if.end:
61 ret i32 %add9
62}
63
64declare i32 @g(i32)