Nadav Rotem | 40e45ee | 2013-01-13 07:56:29 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -loop-vectorize -force-vector-unroll=1 -force-vector-width=4 -dce -instcombine -S |
| 2 | |
| 3 | 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-S128" |
| 4 | target triple = "x86_64-apple-macosx10.8.0" |
| 5 | |
| 6 | @a = common global i8 0, align 1 |
| 7 | @b = common global i8 0, align 1 |
| 8 | |
| 9 | define void @f() nounwind uwtable ssp { |
| 10 | scalar.ph: |
Manman Ren | 1a5ff28 | 2013-04-30 17:52:57 +0000 | [diff] [blame^] | 11 | store i8 0, i8* inttoptr (i64 1 to i8*), align 1 |
| 12 | %0 = load i8* @a, align 1 |
Nadav Rotem | 40e45ee | 2013-01-13 07:56:29 +0000 | [diff] [blame] | 13 | br label %for.body |
| 14 | |
| 15 | for.body: |
| 16 | %mul16 = phi i8 [ 0, %scalar.ph ], [ %mul, %for.body ] ; <------- i8 induction var. |
| 17 | %c.015 = phi i8 [ undef, %scalar.ph ], [ %conv8, %for.body ] |
| 18 | %conv2 = sext i8 %c.015 to i32 |
| 19 | %tobool = icmp ne i8 %c.015, 0 |
| 20 | %.sink = select i1 %tobool, i8 %c.015, i8 %0 |
| 21 | %mul = mul i8 %mul16, %.sink |
| 22 | %add = add nsw i32 %conv2, 1 |
| 23 | %conv8 = trunc i32 %add to i8 |
| 24 | %sext = shl i32 %add, 24 |
| 25 | %phitmp14 = icmp slt i32 %sext, 268435456 |
| 26 | br i1 %phitmp14, label %for.body, label %for.end |
| 27 | |
| 28 | for.end: ; preds = %for.body |
Manman Ren | 1a5ff28 | 2013-04-30 17:52:57 +0000 | [diff] [blame^] | 29 | store i8 %mul, i8* @b, align 1 |
Nadav Rotem | 40e45ee | 2013-01-13 07:56:29 +0000 | [diff] [blame] | 30 | ret void |
| 31 | } |