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 pr48172.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer pr48172.s > pr48172.ll
6 ; ModuleID = 'pr48172.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 i32 @main() nounwind uwtable {
12 %array = alloca [1028 x i32], align 16
13 %tmp18 = bitcast [1028 x i32]* %array to i8*
14 call void @llvm.memset.p0i8.i64(i8* %tmp18, i8 0, i64 4112, i32 16, i1 false)
17 for.cond: ; preds = %for.inc, %entry
18 %indvar13 = phi i64 [ %indvar.next14, %for.inc ], [ 0, %entry ]
19 %arrayidx = getelementptr [1028 x i32]* %array, i64 0, i64 %indvar13
20 %i.0 = trunc i64 %indvar13 to i32
21 %exitcond15 = icmp ne i64 %indvar13, 514
22 br i1 %exitcond15, 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.next14 = add i64 %indvar13, 1
32 for.end: ; preds = %for.cond
35 for.cond4: ; preds = %for.inc22, %for.end
36 %indvar6 = phi i64 [ %indvar.next7, %for.inc22 ], [ 0, %for.end ]
37 %tmp8 = add i64 %indvar6, 514
38 %arrayidx21 = getelementptr [1028 x i32]* %array, i64 0, i64 %tmp8
39 %tmp9 = mul i64 %indvar6, 2
40 %tmp10 = add i64 %tmp9, 1
41 %arrayidx15 = getelementptr [1028 x i32]* %array, i64 0, i64 %tmp10
42 %arrayidx10 = getelementptr [1028 x i32]* %array, i64 0, i64 %tmp9
43 %exitcond = icmp ne i64 %indvar6, 513
44 br i1 %exitcond, label %for.body7, label %for.end25
46 for.body7: ; preds = %for.cond4
47 %tmp11 = load i32* %arrayidx10, align 8
48 %tmp16 = load i32* %arrayidx15, align 4
49 %add17 = add i32 %tmp11, %tmp16
50 store i32 %add17, i32* %arrayidx21, align 4
53 for.inc22: ; preds = %for.body7
54 %indvar.next7 = add i64 %indvar6, 1
57 for.end25: ; preds = %for.cond4
60 for.cond26: ; preds = %for.inc48, %for.end25
61 %indvar = phi i64 [ %indvar.next, %for.inc48 ], [ 0, %for.end25 ]
62 %tmp = mul i64 %indvar, 2
63 %tmp3 = add i64 %tmp, 1
64 %arrayidx44 = getelementptr [1028 x i32]* %array, i64 0, i64 %tmp3
65 %arrayidx38 = getelementptr [1028 x i32]* %array, i64 0, i64 %tmp
66 %tmp4 = add i64 %indvar, 514
67 %arrayidx33 = getelementptr [1028 x i32]* %array, i64 0, i64 %tmp4
68 %i.2 = trunc i64 %indvar to i32
69 %cmp28 = icmp slt i32 %i.2, 513
70 br i1 %cmp28, label %for.body29, label %for.end51
72 for.body29: ; preds = %for.cond26
73 %tmp34 = load i32* %arrayidx33, align 4
74 %tmp39 = load i32* %arrayidx38, align 8
75 %tmp45 = load i32* %arrayidx44, align 4
76 %add46 = add i32 %tmp39, %tmp45
77 %cmp47 = icmp eq i32 %tmp34, %add46
78 br i1 %cmp47, label %if.end, label %if.then
80 if.then: ; preds = %for.body29
81 call void @abort() noreturn nounwind
84 if.end: ; preds = %for.body29
87 for.inc48: ; preds = %if.end
88 %indvar.next = add i64 %indvar, 1
91 for.end51: ; preds = %for.cond26
95 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind
97 declare void @abort() noreturn