CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
94 lines
4.2 KiB
LLVM
94 lines
4.2 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -S -passes=loop-unroll -mattr=+no-default-unroll | FileCheck %s
|
|
|
|
; Regression test: when a loop has a small MaxTripCount and falls through to
|
|
; runtime unrolling, the unroll count should be based on DefaultUnrollRuntimeCount
|
|
; (not MaxTripCount). Previously, a quirk would set UP.Count = MaxTripCount (5)
|
|
; before the power-of-two reduction, yielding count 2 (5 >> 1). Now the count
|
|
; starts at DefaultUnrollRuntimeCount (8) and reduces to 4 (8 >> 1).
|
|
;
|
|
; This test uses RISC-V because we need a target that sets UP.Force = true
|
|
; (via RISCVTTIImpl::getUnrollingPreferences) to trigger the bug.
|
|
|
|
target triple = "riscv64-unknown-linux-gnu"
|
|
|
|
define void @test(i32 %start, ptr %p) {
|
|
; CHECK-LABEL: @test(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[END:%.*]] = add i32 [[START:%.*]], 5
|
|
; CHECK-NEXT: br label [[LOOP:%.*]]
|
|
; CHECK: loop:
|
|
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ [[START]], [[ENTRY:%.*]] ], [ [[IV_NEXT_3:%.*]], [[LOOP_3:%.*]] ]
|
|
; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i32, ptr [[P:%.*]], i32 [[IV]]
|
|
; CHECK-NEXT: [[V:%.*]] = load volatile i32, ptr [[GEP]], align 4
|
|
; CHECK-NEXT: store volatile i32 [[V]], ptr [[GEP]], align 4
|
|
; CHECK-NEXT: [[IV_NEXT:%.*]] = add nuw i32 [[IV]], 1
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[IV_NEXT]], [[END]]
|
|
; CHECK-NEXT: br i1 [[CMP]], label [[LOOP_1:%.*]], label [[EXIT:%.*]]
|
|
; CHECK: loop.1:
|
|
; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[P]], i32 [[IV_NEXT]]
|
|
; CHECK-NEXT: [[V_1:%.*]] = load volatile i32, ptr [[GEP_1]], align 4
|
|
; CHECK-NEXT: store volatile i32 [[V_1]], ptr [[GEP_1]], align 4
|
|
; CHECK-NEXT: [[IV_NEXT_1:%.*]] = add nuw i32 [[IV]], 2
|
|
; CHECK-NEXT: [[CMP_1:%.*]] = icmp ult i32 [[IV_NEXT_1]], [[END]]
|
|
; CHECK-NEXT: br i1 [[CMP_1]], label [[LOOP_2:%.*]], label [[EXIT]]
|
|
; CHECK: loop.2:
|
|
; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i32, ptr [[P]], i32 [[IV_NEXT_1]]
|
|
; CHECK-NEXT: [[V_2:%.*]] = load volatile i32, ptr [[GEP_2]], align 4
|
|
; CHECK-NEXT: store volatile i32 [[V_2]], ptr [[GEP_2]], align 4
|
|
; CHECK-NEXT: [[IV_NEXT_2:%.*]] = add nuw i32 [[IV]], 3
|
|
; CHECK-NEXT: [[CMP_2:%.*]] = icmp ult i32 [[IV_NEXT_2]], [[END]]
|
|
; CHECK-NEXT: br i1 [[CMP_2]], label [[LOOP_3]], label [[EXIT]]
|
|
; CHECK: loop.3:
|
|
; CHECK-NEXT: [[GEP_3:%.*]] = getelementptr inbounds i32, ptr [[P]], i32 [[IV_NEXT_2]]
|
|
; CHECK-NEXT: [[V_3:%.*]] = load volatile i32, ptr [[GEP_3]], align 4
|
|
; CHECK-NEXT: store volatile i32 [[V_3]], ptr [[GEP_3]], align 4
|
|
; CHECK-NEXT: [[IV_NEXT_3]] = add nuw i32 [[IV]], 4
|
|
; CHECK-NEXT: [[CMP_3:%.*]] = icmp ult i32 [[IV_NEXT_3]], [[END]]
|
|
; CHECK-NEXT: br i1 [[CMP_3]], label [[LOOP]], label [[EXIT]]
|
|
; CHECK: exit:
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
entry:
|
|
%end = add i32 %start, 5
|
|
br label %loop
|
|
|
|
loop:
|
|
%iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
|
|
%gep = getelementptr inbounds i32, ptr %p, i32 %iv
|
|
%v = load volatile i32, ptr %gep
|
|
%b0 = call i32 @llvm.bswap.i32(i32 %v)
|
|
%b1 = call i32 @llvm.bswap.i32(i32 %b0)
|
|
%b2 = call i32 @llvm.bswap.i32(i32 %b1)
|
|
%b3 = call i32 @llvm.bswap.i32(i32 %b2)
|
|
%b4 = call i32 @llvm.bswap.i32(i32 %b3)
|
|
%b5 = call i32 @llvm.bswap.i32(i32 %b4)
|
|
%b6 = call i32 @llvm.bswap.i32(i32 %b5)
|
|
%b7 = call i32 @llvm.bswap.i32(i32 %b6)
|
|
%b8 = call i32 @llvm.bswap.i32(i32 %b7)
|
|
%b9 = call i32 @llvm.bswap.i32(i32 %b8)
|
|
%b10 = call i32 @llvm.bswap.i32(i32 %b9)
|
|
%b11 = call i32 @llvm.bswap.i32(i32 %b10)
|
|
%b12 = call i32 @llvm.bswap.i32(i32 %b11)
|
|
%b13 = call i32 @llvm.bswap.i32(i32 %b12)
|
|
%b14 = call i32 @llvm.bswap.i32(i32 %b13)
|
|
%b15 = call i32 @llvm.bswap.i32(i32 %b14)
|
|
%b16 = call i32 @llvm.bswap.i32(i32 %b15)
|
|
%b17 = call i32 @llvm.bswap.i32(i32 %b16)
|
|
%b18 = call i32 @llvm.bswap.i32(i32 %b17)
|
|
%b19 = call i32 @llvm.bswap.i32(i32 %b18)
|
|
%b20 = call i32 @llvm.bswap.i32(i32 %b19)
|
|
%b21 = call i32 @llvm.bswap.i32(i32 %b20)
|
|
%b22 = call i32 @llvm.bswap.i32(i32 %b21)
|
|
%b23 = call i32 @llvm.bswap.i32(i32 %b22)
|
|
%b24 = call i32 @llvm.bswap.i32(i32 %b23)
|
|
%b25 = call i32 @llvm.bswap.i32(i32 %b24)
|
|
store volatile i32 %b25, ptr %gep
|
|
%iv.next = add nuw i32 %iv, 1
|
|
%cmp = icmp ult i32 %iv.next, %end
|
|
br i1 %cmp, label %loop, label %exit
|
|
|
|
exit:
|
|
ret void
|
|
}
|