You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.4 KiB
66 lines
2.4 KiB
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -indvars -S | FileCheck %s
|
|
|
|
; Indvars should be able to compute the exit value of this loop
|
|
; without any additional arithmetic. The only add needed should
|
|
; be the canonical IV increment.
|
|
|
|
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"
|
|
|
|
define void @foo(double* %p, i32 %n) nounwind {
|
|
; CHECK-LABEL: @foo(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[TMP0:%.*]] = icmp sgt i32 [[N:%.*]], 0
|
|
; CHECK-NEXT: br i1 [[TMP0]], label [[BB_NPH:%.*]], label [[RETURN:%.*]]
|
|
; CHECK: bb.nph:
|
|
; CHECK-NEXT: br label [[BB2:%.*]]
|
|
; CHECK: bb2:
|
|
; CHECK-NEXT: [[I_01:%.*]] = phi i32 [ [[TMP7:%.*]], [[BB3:%.*]] ], [ 0, [[BB_NPH]] ]
|
|
; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[I_01]] to i64
|
|
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr double, double* [[P:%.*]], i64 [[TMP1]]
|
|
; CHECK-NEXT: [[TMP3:%.*]] = load double, double* [[TMP2]], align 8
|
|
; CHECK-NEXT: [[TMP4:%.*]] = fmul double [[TMP3]], 1.100000e+00
|
|
; CHECK-NEXT: [[TMP5:%.*]] = sext i32 [[I_01]] to i64
|
|
; CHECK-NEXT: [[TMP6:%.*]] = getelementptr double, double* [[P]], i64 [[TMP5]]
|
|
; CHECK-NEXT: store double [[TMP4]], double* [[TMP6]], align 8
|
|
; CHECK-NEXT: [[TMP7]] = add nuw nsw i32 [[I_01]], 1
|
|
; CHECK-NEXT: br label [[BB3]]
|
|
; CHECK: bb3:
|
|
; CHECK-NEXT: [[TMP8:%.*]] = icmp slt i32 [[TMP7]], [[N]]
|
|
; CHECK-NEXT: br i1 [[TMP8]], label [[BB2]], label [[BB3_RETURN_CRIT_EDGE:%.*]]
|
|
; CHECK: bb3.return_crit_edge:
|
|
; CHECK-NEXT: br label [[RETURN]]
|
|
; CHECK: return:
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
|
|
entry:
|
|
%0 = icmp sgt i32 %n, 0
|
|
br i1 %0, label %bb.nph, label %return
|
|
|
|
bb.nph: ; preds = %entry
|
|
br label %bb2
|
|
|
|
bb2: ; preds = %bb3, %bb.nph
|
|
%i.01 = phi i32 [ %7, %bb3 ], [ 0, %bb.nph ]
|
|
%1 = sext i32 %i.01 to i64
|
|
%2 = getelementptr double, double* %p, i64 %1
|
|
%3 = load double, double* %2, align 8
|
|
%4 = fmul double %3, 1.100000e+00
|
|
%5 = sext i32 %i.01 to i64
|
|
%6 = getelementptr double, double* %p, i64 %5
|
|
store double %4, double* %6, align 8
|
|
%7 = add i32 %i.01, 1
|
|
br label %bb3
|
|
|
|
bb3: ; preds = %bb2
|
|
%8 = icmp slt i32 %7, %n
|
|
br i1 %8, label %bb2, label %bb3.return_crit_edge
|
|
|
|
bb3.return_crit_edge: ; preds = %bb3
|
|
br label %return
|
|
|
|
return: ; preds = %bb3.return_crit_edge, %entry
|
|
ret void
|
|
}
|