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 pr43430-2.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer pr43430-2.s > pr43430-2.ll
6 ; ModuleID = 'pr43430-2.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 @vsad16_c(i8* %c, i8* %s1, i8* %s2, i32 %stride, i32 %h) nounwind uwtable {
12 %tmp = zext i32 %stride to i64
15 for.cond: ; preds = %for.inc, %entry
16 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
17 %score.0 = phi i32 [ 0, %entry ], [ %add46, %for.inc ]
18 %tmp1 = add i64 %tmp, %indvar
19 %add = trunc i64 %tmp1 to i32
20 %arrayidx = getelementptr i8* %s1, i64 %indvar
21 %exitcond = icmp ne i64 %indvar, 16
22 br i1 %exitcond, label %for.body, label %for.end
24 for.body: ; preds = %for.cond
25 %tmp3 = load i8* %arrayidx, align 1
26 %conv = zext i8 %tmp3 to i32
27 %idxprom6 = sext i32 %add to i64
28 %arrayidx8 = getelementptr inbounds i8* %s1, i64 %idxprom6
29 %tmp9 = load i8* %arrayidx8, align 1
30 %conv10 = zext i8 %tmp9 to i32
31 %sub = sub nsw i32 %conv, %conv10
32 %idxprom14 = sext i32 %add to i64
33 %arrayidx16 = getelementptr inbounds i8* %s2, i64 %idxprom14
34 %tmp17 = load i8* %arrayidx16, align 1
35 %conv18 = zext i8 %tmp17 to i32
36 %add19 = add nsw i32 %sub, %conv18
37 %cmp20 = icmp sgt i32 %add19, -1
38 br i1 %cmp20, label %cond.true, label %cond.false
40 cond.true: ; preds = %for.body
41 %tmp26 = load i8* %arrayidx, align 1
42 %conv27 = zext i8 %tmp26 to i32
43 %idxprom31 = sext i32 %add to i64
44 %arrayidx33 = getelementptr inbounds i8* %s2, i64 %idxprom31
45 %tmp34 = load i8* %arrayidx33, align 1
46 %conv35 = zext i8 %tmp34 to i32
47 %add36 = add nsw i32 %conv27, %conv35
50 cond.false: ; preds = %for.body
51 %idxprom40 = sext i32 %add to i64
52 %arrayidx42 = getelementptr inbounds i8* %s2, i64 %idxprom40
53 %tmp43 = load i8* %arrayidx42, align 1
54 %conv44 = zext i8 %tmp43 to i32
57 cond.end: ; preds = %cond.false, %cond.true
58 %cond = phi i32 [ %add36, %cond.true ], [ %conv44, %cond.false ]
61 for.inc: ; preds = %cond.end
62 %add46 = add nsw i32 %score.0, %cond
63 %indvar.next = add i64 %indvar, 1
66 for.end: ; preds = %for.cond
67 %score.0.lcssa = phi i32 [ %score.0, %for.cond ]
68 ret i32 %score.0.lcssa