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 slp-widen-mult-half.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer slp-widen-mult-half.s > slp-widen-mult-half.ll
6 ; ModuleID = 'slp-widen-mult-half.s'
8 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"
9 target triple = "x86_64-unknown-linux-gnu"
11 @in = common global [32 x i8] zeroinitializer, align 16
12 @out = common global [32 x i32] zeroinitializer, align 16
13 @out2 = common global [32 x i32] zeroinitializer, align 16
15 define void @foo() nounwind uwtable noinline {
19 for.cond: ; preds = %for.inc, %entry
20 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
21 %tmp = mul i64 %indvar, 2
22 %tmp5 = add i64 %tmp, 1
23 %arrayidx43 = getelementptr [32 x i32]* @out2, i64 0, i64 %tmp5
24 %arrayidx22 = getelementptr [32 x i8]* @in, i64 0, i64 %tmp5
25 %arrayidx30 = getelementptr [32 x i32]* @out, i64 0, i64 %tmp5
26 %arrayidx17 = getelementptr [32 x i32]* @out2, i64 0, i64 %tmp
27 %arrayidx = getelementptr [32 x i8]* @in, i64 0, i64 %tmp
28 %arrayidx7 = getelementptr [32 x i32]* @out, i64 0, i64 %tmp
29 %exitcond = icmp ne i64 %indvar, 16
30 br i1 %exitcond, label %for.body, label %for.end
32 for.body: ; preds = %for.cond
33 %tmp2 = load i8* %arrayidx, align 2
34 %conv = zext i8 %tmp2 to i32
35 %mul3 = mul nsw i32 %conv, 32470
36 store i32 %mul3, i32* %arrayidx7, align 8
37 %tmp12 = load i8* %arrayidx, align 2
38 %conv13 = zext i8 %tmp12 to i32
39 %add = add nsw i32 %conv13, 324700
40 store i32 %add, i32* %arrayidx17, align 8
41 %tmp23 = load i8* %arrayidx22, align 1
42 %conv24 = zext i8 %tmp23 to i32
43 %mul25 = mul nsw i32 %conv24, 32470
44 store i32 %mul25, i32* %arrayidx30, align 4
45 %tmp36 = load i8* %arrayidx22, align 1
46 %conv37 = zext i8 %tmp36 to i32
47 %add38 = add nsw i32 %conv37, 324700
48 store i32 %add38, i32* %arrayidx43, align 4
51 for.inc: ; preds = %for.body
52 %indvar.next = add i64 %indvar, 1
55 for.end: ; preds = %for.cond
59 define i32 @main() nounwind uwtable {
63 for.cond: ; preds = %for.inc, %entry
64 %indvar1 = phi i64 [ %indvar.next2, %for.inc ], [ 0, %entry ]
65 %arrayidx = getelementptr [32 x i8]* @in, i64 0, i64 %indvar1
66 %conv = trunc i64 %indvar1 to i8
67 %exitcond = icmp ne i64 %indvar1, 32
68 br i1 %exitcond, label %for.body, label %for.end
70 for.body: ; preds = %for.cond
71 store i8 %conv, i8* %arrayidx, align 1
72 call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"() nounwind, !srcloc !0
75 for.inc: ; preds = %for.body
76 %indvar.next2 = add i64 %indvar1, 1
79 for.end: ; preds = %for.cond
83 for.cond4: ; preds = %for.inc31, %for.end
84 %indvar = phi i64 [ %indvar.next, %for.inc31 ], [ 0, %for.end ]
85 %arrayidx15 = getelementptr [32 x i8]* @in, i64 0, i64 %indvar
86 %arrayidx22 = getelementptr [32 x i32]* @out2, i64 0, i64 %indvar
87 %arrayidx11 = getelementptr [32 x i32]* @out, i64 0, i64 %indvar
88 %i.1 = trunc i64 %indvar to i32
89 %cmp6 = icmp slt i32 %i.1, 32
90 br i1 %cmp6, label %for.body8, label %for.end34
92 for.body8: ; preds = %for.cond4
93 %tmp12 = load i32* %arrayidx11, align 4
94 %tmp16 = load i8* %arrayidx15, align 1
95 %conv17 = zext i8 %tmp16 to i32
96 %mul = mul nsw i32 %conv17, 32470
97 %cmp18 = icmp eq i32 %tmp12, %mul
98 br i1 %cmp18, label %lor.lhs.false, label %if.then
100 lor.lhs.false: ; preds = %for.body8
101 %tmp23 = load i32* %arrayidx22, align 4
102 %tmp27 = load i8* %arrayidx15, align 1
103 %conv28 = zext i8 %tmp27 to i32
104 %add = add nsw i32 %conv28, 324700
105 %cmp29 = icmp eq i32 %tmp23, %add
106 br i1 %cmp29, label %if.end, label %if.then
108 if.then: ; preds = %lor.lhs.false, %for.body8
109 call void @abort() noreturn nounwind
112 if.end: ; preds = %lor.lhs.false
115 for.inc31: ; preds = %if.end
116 %indvar.next = add i64 %indvar, 1
119 for.end34: ; preds = %for.cond4
123 declare void @abort() noreturn nounwind
125 !0 = metadata !{i32 534}