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-outer-4c.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-outer-4c.s > vect-outer-4c.ll
6 ; ModuleID = 'vect-outer-4c.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 [168 x i16] zeroinitializer, align 16
11 @coeff = common global [128 x i16] zeroinitializer, align 16
12 @out = common global [40 x i32] zeroinitializer, align 16
14 define void @foo() nounwind uwtable {
18 for.cond: ; preds = %for.inc24, %entry
19 %indvar1 = phi i64 [ %indvar.next2, %for.inc24 ], [ 0, %entry ]
20 %arrayidx23 = getelementptr [40 x i32]* @out, i64 0, i64 %indvar1
21 %exitcond5 = icmp ne i64 %indvar1, 40
22 br i1 %exitcond5, label %for.body, label %for.end26
24 for.body: ; preds = %for.cond
27 for.cond1: ; preds = %for.inc, %for.body
28 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %for.body ]
29 %diff.0 = phi i32 [ 0, %for.body ], [ %phitmp, %for.inc ]
30 %tmp6 = mul i64 %indvar, 8
31 %tmp8 = add i64 %indvar1, %tmp6
32 %arrayidx = getelementptr [168 x i16]* @in, i64 0, i64 %tmp8
33 %tmp = mul i64 %indvar, 8
34 %arrayidx10 = getelementptr [128 x i16]* @coeff, i64 0, i64 %tmp
35 %exitcond = icmp ne i64 %indvar, 16
36 br i1 %exitcond, label %for.body4, label %for.end
38 for.body4: ; preds = %for.cond1
41 for.inc: ; preds = %for.body4
42 %tmp11 = load i16* %arrayidx10, align 16
43 %tmp7 = load i16* %arrayidx, align 2
44 %conv12 = zext i16 %tmp11 to i32
45 %conv = zext i16 %tmp7 to i32
46 %mul = mul nsw i32 %conv, %conv12
47 %add15 = add nsw i32 %diff.0, %mul
48 %phitmp = and i32 %add15, 65535
49 %indvar.next = add i64 %indvar, 1
52 for.end: ; preds = %for.cond1
53 %diff.0.lcssa = phi i32 [ %diff.0, %for.cond1 ]
54 store i32 %diff.0.lcssa, i32* %arrayidx23, align 4
57 for.inc24: ; preds = %for.end
58 %indvar.next2 = add i64 %indvar1, 1
61 for.end26: ; preds = %for.cond