1; RUN: opt < %s -indvars -S | FileCheck %s 2target 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-S128" 3target triple = "x86_64-apple-macosx" 4 5; CHECK-LABEL: @test1 6; CHECK: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 7define i32 @test1(i32* %a) #0 { 8entry: 9 br label %for.cond 10 11for.cond: ; preds = %for.body, %entry 12 %sum.0 = phi i32 [ 0, %entry ], [ %add, %for.body ] 13 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] 14 %cmp = icmp slt i32 %i.0, 1000 15 br i1 %cmp, label %for.body, label %for.end 16 17for.body: ; preds = %for.cond 18 %idxprom = sext i32 %i.0 to i64 19 %arrayidx = getelementptr inbounds i32, i32* %a, i64 %idxprom 20 %0 = load i32, i32* %arrayidx, align 4 21 %add = add nsw i32 %sum.0, %0 22 %inc = add nsw i32 %i.0, 1 23 br label %for.cond 24 25for.end: ; preds = %for.cond 26 ret i32 %sum.0 27} 28 29attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } 30