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-ifcvt-10.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-ifcvt-10.s > vect-ifcvt-10.ll
6 ; ModuleID = 'vect-ifcvt-10.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 double @foo(i32 %j, double* %v, double %x) nounwind uwtable {
12 %tmp = icmp sgt i32 %j, 0
13 %smax = select i1 %tmp, i32 %j, i32 0
14 %tmp1 = zext i32 %smax to i64
17 for.cond: ; preds = %for.inc, %entry
18 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
19 %x.addr.0 = phi double [ %x, %entry ], [ %x.addr.1, %for.inc ]
20 %arrayidx = getelementptr double* %v, i64 %indvar
21 %exitcond = icmp ne i64 %indvar, %tmp1
22 br i1 %exitcond, label %for.body, label %for.end
24 for.body: ; preds = %for.cond
25 %tmp4 = load double* %arrayidx, align 8
26 %cmp6 = fcmp olt double %tmp4, %x.addr.0
27 br i1 %cmp6, label %if.then, label %if.end
29 if.then: ; preds = %for.body
30 %tmp11 = load double* %arrayidx, align 8
33 if.end: ; preds = %if.then, %for.body
34 %x.addr.1 = phi double [ %tmp11, %if.then ], [ %x.addr.0, %for.body ]
37 for.inc: ; preds = %if.end
38 %indvar.next = add i64 %indvar, 1
41 for.end: ; preds = %for.cond
42 %x.addr.0.lcssa = phi double [ %x.addr.0, %for.cond ]
43 ret double %x.addr.0.lcssa