1 ; RUN: opt < %s -loop-reduce -S -mtriple=x86_64-unknown-unknown | FileCheck %s
3 ; Test LSR's OptimizeShadowIV. Handle a floating-point IV with a
4 ; nonzero initial value.
7 ; Provide legal integer types.
8 target datalayout = "n8:16:32:64"
11 ; First, make sure LSR doesn't crash on an empty IVUsers list.
12 ; CHECK-LABEL: @dummyIV(
16 define void @dummyIV() nounwind {
21 %i.01 = phi i32 [ -39, %entry ], [ %inc, %loop ]
22 %conv = sitofp i32 %i.01 to double
23 %inc = add nsw i32 %i.01, 1
24 br i1 undef, label %loop, label %for.end
30 ; Now check that the computed double constant is correct.
31 ; CHECK-LABEL: @doubleIV(
32 ; CHECK: phi double [ -3.900000e+01, %entry ]
34 define void @doubleIV() nounwind {
39 %i.01 = phi i32 [ -39, %entry ], [ %inc, %loop ]
40 %conv = sitofp i32 %i.01 to double
41 %div = fdiv double %conv, 4.000000e+01
42 %inc = add nsw i32 %i.01, 1
43 br i1 undef, label %loop, label %for.end