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 pr42395.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer pr42395.s > pr42395.ll
6 ; ModuleID = 'pr42395.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 define void @foo(i32 %j, i32* %A) nounwind uwtable {
12 %tmp9 = icmp sgt i32 %j, 0
13 %smax10 = select i1 %tmp9, i32 %j, i32 0
14 %tmp11 = zext i32 %smax10 to i64
17 for.cond: ; preds = %for.inc, %entry
18 %indvar5 = phi i64 [ %indvar.next6, %for.inc ], [ 0, %entry ]
19 %arrayidx = getelementptr i32* %A, i64 %indvar5
20 %i.0 = trunc i64 %indvar5 to i32
21 %exitcond12 = icmp ne i64 %indvar5, %tmp11
22 br i1 %exitcond12, label %for.body, label %for.end
24 for.body: ; preds = %for.cond
25 store i32 %i.0, i32* %arrayidx, align 4
28 for.inc: ; preds = %for.body
29 %indvar.next6 = add i64 %indvar5, 1
32 for.end: ; preds = %for.cond
33 %tmp = icmp sgt i32 %j, 4096
34 %smax = select i1 %tmp, i32 %j, i32 4096
35 %tmp1 = icmp sgt i32 %j, 0
36 %smax2 = select i1 %tmp1, i32 %j, i32 0
37 %tmp3 = sub i32 %smax, %smax2
38 %tmp4 = zext i32 %tmp3 to i64
41 for.cond6: ; preds = %for.inc14, %for.end
42 %indvar = phi i64 [ %indvar.next, %for.inc14 ], [ 0, %for.end ]
43 %tmp7 = add i64 %tmp11, %indvar
44 %arrayidx13 = getelementptr i32* %A, i64 %tmp7
45 %exitcond = icmp ne i64 %indvar, %tmp4
46 br i1 %exitcond, label %for.body9, label %for.end17
48 for.body9: ; preds = %for.cond6
49 store i32 0, i32* %arrayidx13, align 4
52 for.inc14: ; preds = %for.body9
53 %indvar.next = add i64 %indvar, 1
56 for.end17: ; preds = %for.cond6