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 no-scevccp-outer-1.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer no-scevccp-outer-1.s > no-scevccp-outer-1.ll
6 ; ModuleID = 'no-scevccp-outer-1.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 [40 x [40 x i16]] zeroinitializer, align 16
11 @block = common global [40 x [40 x i16]] zeroinitializer, align 16
13 define i32 @foo() nounwind uwtable noinline {
17 for.cond: ; preds = %for.inc20, %entry
18 %indvar1 = phi i64 [ %indvar.next2, %for.inc20 ], [ 0, %entry ]
19 %diff.0 = phi i32 [ 0, %entry ], [ %diff.1.lcssa, %for.inc20 ]
20 %exitcond3 = icmp ne i64 %indvar1, 40
21 br i1 %exitcond3, 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 %arrayidx8 = getelementptr [40 x [40 x i16]]* @image, i64 0, i64 %indvar1, i64 %indvar
30 %arrayidx15 = getelementptr [40 x [40 x i16]]* @block, i64 0, i64 %indvar1, i64 %indvar
31 %exitcond = icmp ne i64 %indvar, 40
32 br i1 %exitcond, label %for.body4, label %for.end
34 for.body4: ; preds = %for.cond1
37 for.inc: ; preds = %for.body4
38 %tmp16 = load i16* %arrayidx15, align 2
39 %tmp9 = load i16* %arrayidx8, align 2
40 %conv17 = sext i16 %tmp16 to i32
41 %conv = sext i16 %tmp9 to i32
42 %sub = sub nsw i32 %conv, %conv17
43 %add = add i32 %diff.1, %sub
44 %indvar.next = add i64 %indvar, 1
47 for.end: ; preds = %for.cond1
48 %diff.1.lcssa = phi i32 [ %diff.1, %for.cond1 ]
51 for.inc20: ; preds = %for.end
52 %indvar.next2 = add i64 %indvar1, 1
55 for.end23: ; preds = %for.cond
56 %diff.0.lcssa = phi i32 [ %diff.0, %for.cond ]