Home | History | Annotate | Download | only in X86
      1 ; RUN: llc -O1 <%s
      2 ; PR12138
      3 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128"
      4 target triple = "i386-apple-macosx10.7.0"
      5 
      6 %struct.S0 = type { i8, i32 }
      7 
      8 @d = external global [2 x [2 x %struct.S0]], align 4
      9 @c = external global i32, align 4
     10 @e = external global i32, align 4
     11 @b = external global i32, align 4
     12 @a = external global i32, align 4
     13 
     14 define void @fn2() nounwind optsize ssp {
     15 entry:
     16   store i64 0, i64* bitcast ([2 x [2 x %struct.S0]]* @d to i64*), align 4
     17   %0 = load i32, i32* @c, align 4
     18   %tobool2 = icmp eq i32 %0, 0
     19   %1 = load i32, i32* @a, align 4
     20   %tobool4 = icmp eq i32 %1, 0
     21   br label %for.cond
     22 
     23 for.cond:                                         ; preds = %if.end, %entry
     24   %f.1.0 = phi i32 [ undef, %entry ], [ %sub, %if.end ]
     25   %g.0 = phi i64 [ 0, %entry ], [ %ins, %if.end ]
     26   %tobool = icmp eq i32 %f.1.0, 0
     27   br i1 %tobool, label %for.end, label %for.body
     28 
     29 for.body:                                         ; preds = %for.cond
     30   %2 = lshr i64 %g.0, 32
     31   %conv = trunc i64 %2 to i16
     32   br i1 %tobool2, label %lor.rhs, label %lor.end
     33 
     34 lor.rhs:                                          ; preds = %for.body
     35   store i32 1, i32* @e, align 4
     36   br label %lor.end
     37 
     38 lor.end:                                          ; preds = %lor.rhs, %for.body
     39   %xor.i = xor i16 %conv, 1
     40   %p1.lobit.i8 = lshr i64 %g.0, 47
     41   %p1.lobit.i8.tr = trunc i64 %p1.lobit.i8 to i16
     42   %p1.lobit.i = and i16 %p1.lobit.i8.tr, 1
     43   %and.i = and i16 %p1.lobit.i, %xor.i
     44   %3 = xor i16 %and.i, 1
     45   %sub.conv.i = sub i16 %conv, %3
     46   %conv3 = sext i16 %sub.conv.i to i32
     47   store i32 %conv3, i32* @b, align 4
     48   br i1 %tobool4, label %if.end, label %for.end
     49 
     50 if.end:                                           ; preds = %lor.end
     51   %mask = and i64 %g.0, -256
     52   %ins = or i64 %mask, 1
     53   %sub = add nsw i32 %f.1.0, -1
     54   br label %for.cond
     55 
     56 for.end:                                          ; preds = %lor.end, %for.cond
     57   ret void
     58 }
     59