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-1a.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-outer-1a.s > vect-outer-1a.ll
6 ; ModuleID = 'vect-outer-1a.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 @image = common global [64 x [64 x i16]] zeroinitializer, align 16
11 @block = common global [64 x [64 x i16]] zeroinitializer, align 16
13 define i32 @foo() nounwind uwtable {
17 for.cond: ; preds = %for.inc21, %entry
18 %indvar1 = phi i64 [ %indvar.next2, %for.inc21 ], [ 0, %entry ]
19 %diff.0 = phi i32 [ 0, %entry ], [ %diff.1.lcssa, %for.inc21 ]
20 %exitcond4 = icmp ne i64 %indvar1, 64
21 br i1 %exitcond4, label %for.body, label %for.end23
23 for.body: ; preds = %for.cond
26 for.cond1: ; preds = %for.inc, %for.body
27 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %for.body ]
28 %diff.1 = phi i32 [ %diff.0, %for.body ], [ %add, %for.inc ]
29 %tmp5 = mul i64 %indvar, 8
30 %arrayidx8 = getelementptr [64 x [64 x i16]]* @image, i64 0, i64 %indvar1, i64 %tmp5
31 %arrayidx15 = getelementptr [64 x [64 x i16]]* @block, i64 0, i64 %indvar1, i64 %tmp5
32 %exitcond = icmp ne i64 %indvar, 8
33 br i1 %exitcond, label %for.body4, label %for.end
35 for.body4: ; preds = %for.cond1
38 for.inc: ; preds = %for.body4
39 %tmp16 = load i16* %arrayidx15, align 16
40 %tmp9 = load i16* %arrayidx8, align 16
41 %conv17 = sext i16 %tmp16 to i32
42 %conv = sext i16 %tmp9 to i32
43 %sub = sub nsw i32 %conv, %conv17
44 %add = add nsw i32 %diff.1, %sub
45 %indvar.next = add i64 %indvar, 1
48 for.end: ; preds = %for.cond1
49 %diff.1.lcssa = phi i32 [ %diff.1, %for.cond1 ]
52 for.inc21: ; preds = %for.end
53 %indvar.next2 = add i64 %indvar1, 1
56 for.end23: ; preds = %for.cond
57 %diff.0.lcssa = phi i32 [ %diff.0, %for.cond ]