1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes='loop(indvars),dce' -disable-lftr -S | FileCheck %s
4 ; LFTR should not eliminate the need for the computation of i*i completely
5 ; due to LFTR is disabled.
7 ; Provide legal integer types.
8 target datalayout = "n8:16:32:64"
10 @A = external global i32
12 define i32 @quadratic_setlt() {
13 ; CHECK-LABEL: @quadratic_setlt(
15 ; CHECK-NEXT: br label [[LOOP:%.*]]
17 ; CHECK-NEXT: [[I:%.*]] = phi i32 [ 7, [[ENTRY:%.*]] ], [ [[I_NEXT:%.*]], [[LOOP]] ]
18 ; CHECK-NEXT: [[I_NEXT]] = add nuw nsw i32 [[I]], 1
19 ; CHECK-NEXT: store i32 [[I]], ptr @A
20 ; CHECK-NEXT: [[I2:%.*]] = mul i32 [[I]], [[I]]
21 ; CHECK-NEXT: [[C:%.*]] = icmp slt i32 [[I2]], 1000
22 ; CHECK-NEXT: br i1 [[C]], label [[LOOP]], label [[LOOPEXIT:%.*]]
24 ; CHECK-NEXT: ret i32 32
30 %i = phi i32 [ 7, %entry ], [ %i.next, %loop ]
31 %i.next = add i32 %i, 1
34 %c = icmp slt i32 %i2, 1000
35 br i1 %c, label %loop, label %loopexit