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 ggc-pr37574.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer ggc-pr37574.s > ggc-pr37574.ll
6 ; ModuleID = 'ggc-pr37574.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 @in = common global [168 x i16] zeroinitializer, align 16
12 define i32 @main() nounwind uwtable {
16 for.cond: ; preds = %for.inc17, %entry
17 %indvar2 = phi i64 [ %indvar.next3, %for.inc17 ], [ 0, %entry ]
18 %s.0 = phi i32 [ 0, %entry ], [ %add16, %for.inc17 ]
19 %exitcond6 = icmp ne i64 %indvar2, 40
20 br i1 %exitcond6, label %for.body, label %for.end19
22 for.body: ; preds = %for.cond
25 for.cond1: ; preds = %for.inc, %for.body
26 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %for.body ]
27 %diff.0 = phi i32 [ 0, %for.body ], [ %add9, %for.inc ]
28 %tmp8 = mul i64 %indvar, 8
29 %tmp9 = add i64 %indvar2, %tmp8
30 %arrayidx = getelementptr [168 x i16]* @in, i64 0, i64 %tmp9
31 %exitcond = icmp ne i64 %indvar, 16
32 br i1 %exitcond, label %for.body4, label %for.end
34 for.body4: ; preds = %for.cond1
37 for.inc: ; preds = %for.body4
38 %tmp7 = load i16* %arrayidx, align 2
39 %conv = zext i16 %tmp7 to i32
40 %add9 = add i32 %diff.0, %conv
41 %indvar.next = add i64 %indvar, 1
44 for.end: ; preds = %for.cond1
45 %diff.0.lcssa = phi i32 [ %diff.0, %for.cond1 ]
48 for.inc17: ; preds = %for.end
49 %conv14 = lshr i32 %diff.0.lcssa, 3
50 %shr1 = and i32 %conv14, 8191
51 %add16 = add i32 %s.0, %shr1
52 %indvar.next3 = add i64 %indvar2, 1
55 for.end19: ; preds = %for.cond
56 %s.0.lcssa = phi i32 [ %s.0, %for.cond ]
57 %cmp22 = icmp eq i32 %s.0.lcssa, 0
58 br i1 %cmp22, label %if.end, label %if.then
60 if.then: ; preds = %for.end19
63 if.end: ; preds = %for.end19
66 return: ; preds = %if.end, %if.then
67 %retval.0 = phi i32 [ -1, %if.then ], [ 0, %if.end ]