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-dv-1.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-dv-1.s > vect-dv-1.ll
6 ; ModuleID = 'vect-dv-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 @x = common global [199 x i32] zeroinitializer, align 16
12 define void @foo() nounwind uwtable {
16 for.cond: ; preds = %for.inc, %entry
17 %indvar6 = phi i64 [ %indvar.next7, %for.inc ], [ 0, %entry ]
18 %tmp9 = mul i64 %indvar6, -2
19 %tmp10 = add i64 %tmp9, 198
20 %arrayidx6 = getelementptr [199 x i32]* @x, i64 0, i64 %tmp10
21 %tmp11 = mul i64 %indvar6, -1
22 %tmp12 = add i64 %tmp11, 99
23 %arrayidx = getelementptr [199 x i32]* @x, i64 0, i64 %tmp12
24 %exitcond8 = icmp ne i64 %indvar6, 99
25 br i1 %exitcond8, label %for.body, label %for.end
27 for.body: ; preds = %for.cond
28 %tmp2 = load i32* %arrayidx, align 4
29 store i32 %tmp2, i32* %arrayidx6, align 8
32 for.inc: ; preds = %for.body
33 %indvar.next7 = add i64 %indvar6, 1
36 for.end: ; preds = %for.cond
39 for.cond8: ; preds = %for.inc29, %for.end
40 %indvar = phi i64 [ %indvar.next, %for.inc29 ], [ 0, %for.end ]
41 %tmp = mul i64 %indvar, -1
42 %tmp1 = add i64 %tmp, 135
43 %arrayidx28 = getelementptr [199 x i32]* @x, i64 0, i64 %tmp1
44 %tmp3 = add i64 %tmp, 195
45 %arrayidx18 = getelementptr [199 x i32]* @x, i64 0, i64 %tmp3
46 %tmp4 = add i64 %tmp, 198
47 %arrayidx14 = getelementptr [199 x i32]* @x, i64 0, i64 %tmp4
48 %exitcond = icmp ne i64 %indvar, 99
49 br i1 %exitcond, label %for.body11, label %for.end32
51 for.body11: ; preds = %for.cond8
52 %tmp15 = load i32* %arrayidx14, align 4
53 %tobool = icmp eq i32 %tmp15, 0
54 br i1 %tobool, label %if.end, label %if.then
56 if.then: ; preds = %for.body11
57 %tmp19 = load i32* %arrayidx18, align 4
58 %tmp23 = load i32* %arrayidx14, align 4
59 %sub24 = sub nsw i32 %tmp19, %tmp23
60 store i32 %sub24, i32* %arrayidx28, align 4
63 if.end: ; preds = %for.body11, %if.then
66 for.inc29: ; preds = %if.end
67 %indvar.next = add i64 %indvar, 1
70 for.end32: ; preds = %for.cond8