1; RUN: opt -S -indvars < %s | FileCheck %s 2 3; Provide legal integer types. 4target datalayout = "n8:16:32:64" 5 6 7define void @test1(float* nocapture %autoc, float* nocapture %data, float %d, i32 %data_len, i32 %sample) nounwind { 8entry: 9 %sub = sub i32 %data_len, %sample 10 %cmp4 = icmp eq i32 %data_len, %sample 11 br i1 %cmp4, label %for.end, label %for.body 12 13for.body: ; preds = %entry, %for.body 14 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 15 %0 = trunc i64 %indvars.iv to i32 16 %add = add i32 %0, %sample 17 %idxprom = zext i32 %add to i64 18 %arrayidx = getelementptr inbounds float, float* %data, i64 %idxprom 19 %1 = load float, float* %arrayidx, align 4 20 %mul = fmul float %1, %d 21 %arrayidx2 = getelementptr inbounds float, float* %autoc, i64 %indvars.iv 22 %2 = load float, float* %arrayidx2, align 4 23 %add3 = fadd float %2, %mul 24 store float %add3, float* %arrayidx2, align 4 25 %indvars.iv.next = add i64 %indvars.iv, 1 26 %3 = trunc i64 %indvars.iv.next to i32 27 %cmp = icmp ult i32 %3, %sub 28 br i1 %cmp, label %for.body, label %for.end 29 30for.end: ; preds = %for.body, %entry 31 ret void 32 33; CHECK-LABEL: @test1( 34 35; check that we turn the IV test into an eq. 36; CHECK: %lftr.wideiv = trunc i64 %indvars.iv.next to i32 37; CHECK: %exitcond = icmp ne i32 %lftr.wideiv, %sub 38; CHECK: br i1 %exitcond, label %for.body, label %for.end.loopexit 39} 40 41