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 pr48377.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer pr48377.s > pr48377.ll
6 ; ModuleID = 'pr48377.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 @buf = common global [64 x i8] zeroinitializer, align 32
12 define i32 @foo(i8* %s, i32 %len) nounwind uwtable noinline {
14 %tmp = sext i32 %len to i64
15 %tmp1 = lshr i64 %tmp, 2
16 %tmp2 = trunc i64 %tmp1 to i32
17 %tmp3 = zext i32 %tmp2 to i64
20 for.cond: ; preds = %for.inc, %entry
21 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
22 %hash.0 = phi i32 [ %len, %entry ], [ %add, %for.inc ]
23 %tmp4 = mul i64 %indvar, 4
24 %scevgep = getelementptr i8* %s, i64 %tmp4
25 %p.0 = bitcast i8* %scevgep to i32*
26 %exitcond = icmp ne i64 %indvar, %tmp3
27 br i1 %exitcond, label %for.body, label %for.end
29 for.body: ; preds = %for.cond
32 for.inc: ; preds = %for.body
33 %tmp11 = load i32* %p.0, align 4
34 %add = add i32 %hash.0, %tmp11
35 %indvar.next = add i64 %indvar, 1
38 for.end: ; preds = %for.cond
39 %hash.0.lcssa = phi i32 [ %hash.0, %for.cond ]
43 define i32 @main() nounwind uwtable {
45 %call = call i32 @foo(i8* getelementptr inbounds ([64 x i8]* @buf, i64 0, i64 1), i32 26)
46 %cmp = icmp ne i32 %call, 26
47 %conv = zext i1 %cmp to i32