1 ; RUN: opt %loadPolly %defaultOpts -polly-codegen -enable-polly-vector -dce -S %s | FileCheck %s
2 ; Obtained from C source as:
3 ; clang -S -emit-llvm -O0 vect-widen-mult-half.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-widen-mult-half.s > vect-widen-mult-half.ll
6 ; ModuleID = 'vect-widen-mult-half.s'
7 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"
8 target triple = "x86_64-unknown-linux-gnu"
10 @in = common global [32 x i8] zeroinitializer, align 16
11 @out = common global [32 x i32] zeroinitializer, align 16
12 @out2 = common global [32 x i32] zeroinitializer, align 16
14 define void @foo(i32 %a) nounwind uwtable noinline {
18 for.cond: ; preds = %for.inc, %entry
19 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
20 %arrayidx14 = getelementptr [32 x i32]* @out2, i64 0, i64 %indvar
21 %arrayidx = getelementptr [32 x i8]* @in, i64 0, i64 %indvar
22 %arrayidx5 = getelementptr [32 x i32]* @out, i64 0, i64 %indvar
23 %exitcond = icmp ne i64 %indvar, 32
24 br i1 %exitcond, label %for.body, label %for.end
26 for.body: ; preds = %for.cond
27 %tmp2 = load i8* %arrayidx, align 1
28 %conv = zext i8 %tmp2 to i32
29 %mul = mul nsw i32 %conv, 32470
30 store i32 %mul, i32* %arrayidx5, align 4
31 %tmp9 = load i8* %arrayidx, align 1
32 %conv10 = zext i8 %tmp9 to i32
33 %add = add nsw i32 %conv10, %a
34 store i32 %add, i32* %arrayidx14, align 4
37 for.inc: ; preds = %for.body
38 %indvar.next = add i64 %indvar, 1
41 for.end: ; preds = %for.cond
45 define i32 @main() nounwind uwtable {
49 for.cond: ; preds = %for.inc, %entry
50 %indvar1 = phi i64 [ %indvar.next2, %for.inc ], [ 0, %entry ]
51 %arrayidx = getelementptr [32 x i8]* @in, i64 0, i64 %indvar1
52 %conv = trunc i64 %indvar1 to i8
53 %exitcond = icmp ne i64 %indvar1, 32
54 br i1 %exitcond, label %for.body, label %for.end
56 for.body: ; preds = %for.cond
57 store i8 %conv, i8* %arrayidx, align 1
58 call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"() nounwind, !srcloc !0
61 for.inc: ; preds = %for.body
62 %indvar.next2 = add i64 %indvar1, 1
65 for.end: ; preds = %for.cond
66 call void @foo(i32 324700)
69 for.cond4: ; preds = %for.inc31, %for.end
70 %indvar = phi i64 [ %indvar.next, %for.inc31 ], [ 0, %for.end ]
71 %arrayidx15 = getelementptr [32 x i8]* @in, i64 0, i64 %indvar
72 %arrayidx22 = getelementptr [32 x i32]* @out2, i64 0, i64 %indvar
73 %arrayidx11 = getelementptr [32 x i32]* @out, i64 0, i64 %indvar
74 %i.1 = trunc i64 %indvar to i32
75 %cmp6 = icmp slt i32 %i.1, 32
76 br i1 %cmp6, label %for.body8, label %for.end34
78 for.body8: ; preds = %for.cond4
79 %tmp12 = load i32* %arrayidx11, align 4
80 %tmp16 = load i8* %arrayidx15, align 1
81 %conv17 = zext i8 %tmp16 to i32
82 %mul = mul nsw i32 %conv17, 32470
83 %cmp18 = icmp eq i32 %tmp12, %mul
84 br i1 %cmp18, label %lor.lhs.false, label %if.then
86 lor.lhs.false: ; preds = %for.body8
87 %tmp23 = load i32* %arrayidx22, align 4
88 %tmp27 = load i8* %arrayidx15, align 1
89 %conv28 = zext i8 %tmp27 to i32
90 %add = add nsw i32 %conv28, 324700
91 %cmp29 = icmp eq i32 %tmp23, %add
92 br i1 %cmp29, label %if.end, label %if.then
94 if.then: ; preds = %lor.lhs.false, %for.body8
95 call void @abort() noreturn nounwind
98 if.end: ; preds = %lor.lhs.false
101 for.inc31: ; preds = %if.end
102 %indvar.next = add i64 %indvar, 1
105 for.end34: ; preds = %for.cond4
109 declare void @abort() noreturn nounwind
111 !0 = metadata !{i32 449}