Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s | FileCheck %s
      2 target 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"
      3 target triple = "x86_64-apple-darwin10.0.0"
      4 
      5 define i32 @f(i32 %x) nounwind ssp {
      6 entry:
      7   %shl.i = shl i32 %x, 12
      8   %neg.i = xor i32 %shl.i, -1
      9   %add.i = add nsw i32 %neg.i, %x
     10   %shr.i = ashr i32 %add.i, 22
     11   %xor.i = xor i32 %shr.i, %add.i
     12   %shl5.i = shl i32 %xor.i, 13
     13   %neg6.i = xor i32 %shl5.i, -1
     14   %add8.i = add nsw i32 %xor.i, %neg6.i
     15   %shr10.i = ashr i32 %add8.i, 8
     16   %xor12.i = xor i32 %shr10.i, %add8.i
     17   %add16.i = mul i32 %xor12.i, 9
     18   %shr18.i = ashr i32 %add16.i, 15
     19   %xor20.i = xor i32 %shr18.i, %add16.i
     20   %shl22.i = shl i32 %xor20.i, 27
     21   %neg23.i = xor i32 %shl22.i, -1
     22   %add25.i = add nsw i32 %xor20.i, %neg23.i
     23   %shr27.i = ashr i32 %add25.i, 31
     24   %rem = srem i32 %x, 7
     25   %cmp = icmp eq i32 %rem, 3
     26   br i1 %cmp, label %land.lhs.true, label %do.body.preheader
     27 
     28 land.lhs.true:
     29   %call3 = tail call i32 @g(i32 %x) nounwind
     30   %cmp4 = icmp eq i32 %call3, 10
     31   br i1 %cmp4, label %do.body.preheader, label %if.then
     32 
     33 ; %add16.i should be sinked all the way down to do.body.preheader, but not into the loop.
     34 ; CHECK: do.body.preheader
     35 ; CHECK-NOT: do.body
     36 ; CHECK: leal ([[SRC:%r[a-z0-9]+]],[[SRC]],8)
     37 
     38 do.body.preheader:
     39   %xor29.i = xor i32 %shr27.i, %add25.i
     40   br label %do.body
     41 
     42 if.then:
     43   %add = add nsw i32 %x, 11
     44   ret i32 %add
     45 
     46 do.body:
     47   %x.addr.1 = phi i32 [ %add9, %do.body ], [ %x, %do.body.preheader ]
     48   %xor = xor i32 %xor29.i, %x.addr.1
     49   %add9 = add nsw i32 %xor, %x.addr.1
     50   %and = and i32 %add9, 13
     51   %tobool = icmp eq i32 %and, 0
     52   br i1 %tobool, label %if.end, label %do.body
     53 
     54 if.end:
     55   ret i32 %add9
     56 }
     57 
     58 declare i32 @g(i32)
     59