48 lines
2.4 KiB
LLVM
48 lines
2.4 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt -constraint-elimination -S %s | FileCheck %s
|
|
|
|
; Make sure conditions in loops are not used to simplify themselves.
|
|
|
|
define void @loop1(float* %T, float* %x, i32 %points, i32 %trigint) {
|
|
; CHECK-LABEL: @loop1(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[POINTS:%.*]] to i64
|
|
; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds float, float* [[X:%.*]], i64 [[IDX_EXT]]
|
|
; CHECK-NEXT: [[ADD_PTR1:%.*]] = getelementptr inbounds float, float* [[ADD_PTR]], i64 -8
|
|
; CHECK-NEXT: [[SHR:%.*]] = ashr i32 [[POINTS]], 1
|
|
; CHECK-NEXT: [[IDX_EXT2:%.*]] = sext i32 [[SHR]] to i64
|
|
; CHECK-NEXT: [[ADD_PTR3:%.*]] = getelementptr inbounds float, float* [[X]], i64 [[IDX_EXT2]]
|
|
; CHECK-NEXT: [[ADD_PTR4:%.*]] = getelementptr inbounds float, float* [[ADD_PTR3]], i64 -8
|
|
; CHECK-NEXT: br label [[DO_BODY:%.*]]
|
|
; CHECK: do.body:
|
|
; CHECK-NEXT: [[X2_0:%.*]] = phi float* [ [[ADD_PTR4]], [[ENTRY:%.*]] ], [ [[ADD_PTR106:%.*]], [[DO_BODY]] ]
|
|
; CHECK-NEXT: [[X1_0:%.*]] = phi float* [ [[ADD_PTR1]], [[ENTRY]] ], [ [[ADD_PTR105:%.*]], [[DO_BODY]] ]
|
|
; CHECK-NEXT: [[ADD_PTR105]] = getelementptr inbounds float, float* [[X1_0]], i64 -8
|
|
; CHECK-NEXT: [[ADD_PTR106]] = getelementptr inbounds float, float* [[X2_0]], i64 -8
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp uge float* [[ADD_PTR106]], [[X]]
|
|
; CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY]], label [[DO_END:%.*]]
|
|
; CHECK: do.end:
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
entry:
|
|
%idx.ext = sext i32 %points to i64
|
|
%add.ptr = getelementptr inbounds float, float* %x, i64 %idx.ext
|
|
%add.ptr1 = getelementptr inbounds float, float* %add.ptr, i64 -8
|
|
%shr = ashr i32 %points, 1
|
|
%idx.ext2 = sext i32 %shr to i64
|
|
%add.ptr3 = getelementptr inbounds float, float* %x, i64 %idx.ext2
|
|
%add.ptr4 = getelementptr inbounds float, float* %add.ptr3, i64 -8
|
|
br label %do.body
|
|
|
|
do.body: ; preds = %do.body, %entry
|
|
%x2.0 = phi float* [ %add.ptr4, %entry ], [ %add.ptr106, %do.body ]
|
|
%x1.0 = phi float* [ %add.ptr1, %entry ], [ %add.ptr105, %do.body ]
|
|
%add.ptr105 = getelementptr inbounds float, float* %x1.0, i64 -8
|
|
%add.ptr106 = getelementptr inbounds float, float* %x2.0, i64 -8
|
|
%cmp = icmp uge float* %add.ptr106, %x
|
|
br i1 %cmp, label %do.body, label %do.end
|
|
|
|
do.end: ; preds = %do.body
|
|
ret void
|
|
}
|