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
137 lines
4.6 KiB
Fortran
137 lines
4.6 KiB
Fortran
! RUN: %flang_fc1 -emit-fir -o - %s | FileCheck %s
|
|
! RUN: %flang_fc1 -emit-fir -fwrapv -o - %s | FileCheck %s --check-prefix=NO-NSW
|
|
|
|
! Tests for infinite loop.
|
|
|
|
! NO-NSW-NOT: overflow<nsw>
|
|
|
|
subroutine empty_infinite()
|
|
do
|
|
end do
|
|
end subroutine
|
|
! CHECK-LABEL: empty_infinite
|
|
! CHECK: cf.br ^[[BODY:.*]]
|
|
! CHECK: ^[[BODY]]:
|
|
! CHECK: cf.br ^[[BODY]]
|
|
|
|
subroutine simple_infinite(i)
|
|
integer :: i
|
|
do
|
|
if (i .gt. 100) exit
|
|
end do
|
|
end subroutine
|
|
! CHECK-LABEL: simple_infinite
|
|
! CHECK-SAME: %[[I_REF:.*]]: !fir.ref<i32>
|
|
! CHECK-DAG: %[[C100:.*]] = arith.constant 100 : i32
|
|
! CHECK-DAG: %[[I_DECL:.*]] = fir.declare %[[I_REF]] {{.*}}
|
|
! CHECK: cf.br ^[[BODY1:.*]]
|
|
! CHECK: ^[[BODY1]]:
|
|
! CHECK: %[[I:.*]] = fir.load %[[I_DECL]] : !fir.ref<i32>
|
|
! CHECK: %[[COND:.*]] = arith.cmpi sgt, %[[I]], %[[C100]] : i32
|
|
! CHECK: cf.cond_br %[[COND]], ^[[EXIT:.*]], ^[[BODY1:.*]]
|
|
! CHECK: ^[[EXIT]]:
|
|
! CHECK: cf.br ^[[RETURN:.*]]
|
|
! CHECK: ^[[RETURN]]:
|
|
! CHECK: return
|
|
! CHECK: }
|
|
|
|
subroutine infinite_with_two_body_blocks(i)
|
|
integer :: i
|
|
do
|
|
i = i + 1
|
|
if (i .gt. 100) exit
|
|
i = i * 2
|
|
end do
|
|
end subroutine
|
|
! CHECK-LABEL: infinite_with_two_body_blocks
|
|
! CHECK-SAME: %[[I_REF:.*]]: !fir.ref<i32>
|
|
! CHECK-DAG: %[[C1:.*]] = arith.constant 1 : i32
|
|
! CHECK-DAG: %[[C100:.*]] = arith.constant 100 : i32
|
|
! CHECK-DAG: %[[C2:.*]] = arith.constant 2 : i32
|
|
! CHECK-DAG: %[[I_DECL:.*]] = fir.declare %[[I_REF]] {{.*}}
|
|
! CHECK: cf.br ^[[BODY1:.*]]
|
|
! CHECK: ^[[BODY1]]:
|
|
! CHECK: %[[I:.*]] = fir.load %[[I_DECL]] : !fir.ref<i32>
|
|
! CHECK: %[[I_NEXT:.*]] = arith.addi %[[I]], %[[C1]] : i32
|
|
! CHECK: fir.store %[[I_NEXT]] to %[[I_DECL]] : !fir.ref<i32>
|
|
! CHECK: %[[I:.*]] = fir.load %[[I_DECL]] : !fir.ref<i32>
|
|
! CHECK: %[[COND:.*]] = arith.cmpi sgt, %[[I]], %[[C100]] : i32
|
|
! CHECK: cf.cond_br %[[COND]], ^[[EXIT:.*]], ^[[BODY2:.*]]
|
|
! CHECK: ^[[EXIT]]:
|
|
! CHECK: cf.br ^[[RETURN:.*]]
|
|
! CHECK: ^[[BODY2]]:
|
|
! CHECK: %[[I:.*]] = fir.load %[[I_DECL]] : !fir.ref<i32>
|
|
! CHECK: %[[I_NEXT:.*]] = arith.muli %[[I]], %[[C2]] : i32
|
|
! CHECK: fir.store %[[I_NEXT]] to %[[I_DECL]] : !fir.ref<i32>
|
|
! CHECK: cf.br ^[[BODY1]]
|
|
! CHECK: ^[[RETURN]]:
|
|
! CHECK: return
|
|
! CHECK: }
|
|
|
|
subroutine structured_loop_in_infinite(i)
|
|
integer :: i
|
|
integer :: j
|
|
do
|
|
if (i .gt. 100) exit
|
|
do j=1,10
|
|
end do
|
|
end do
|
|
end subroutine
|
|
! CHECK-LABEL: structured_loop_in_infinite
|
|
! CHECK-SAME: %[[I_REF:.*]]: !fir.ref<i32>
|
|
! CHECK-DAG: %[[C100:.*]] = arith.constant 100 : i32
|
|
! CHECK-DAG: %[[C1:.*]] = arith.constant 1 : i32
|
|
! CHECK-DAG: %[[C10:.*]] = arith.constant 10 : i32
|
|
! CHECK-DAG: %[[C1_1:.*]] = arith.constant 1 : index
|
|
! CHECK-DAG: %[[I_DECL:.*]] = fir.declare %[[I_REF]] {{.*}}
|
|
! CHECK-DAG: %[[J_REF:.*]] = fir.alloca i32 {bindc_name = "j", uniq_name = "_QFstructured_loop_in_infiniteEj"}
|
|
! CHECK-DAG: %[[J_DECL:.*]] = fir.declare %[[J_REF]] {{.*}}
|
|
! CHECK: cf.br ^[[BODY1:.*]]
|
|
! CHECK: ^[[BODY1]]:
|
|
! CHECK: %[[I:.*]] = fir.load %[[I_DECL]] : !fir.ref<i32>
|
|
! CHECK: %[[COND:.*]] = arith.cmpi sgt, %[[I]], %[[C100]] : i32
|
|
! CHECK: cf.cond_br %[[COND]], ^[[EXIT:.*]], ^[[BODY2:.*]]
|
|
! CHECK: ^[[EXIT]]:
|
|
! CHECK: cf.br ^[[RETURN:.*]]
|
|
! CHECK: ^[[BODY2:.*]]:
|
|
! CHECK: %[[C1_INDEX:.*]] = fir.convert %[[C1]] : (i32) -> index
|
|
! CHECK: %[[C10_INDEX:.*]] = fir.convert %[[C10]] : (i32) -> index
|
|
! CHECK: %[[J_LB:.*]] = fir.convert %[[C1_INDEX]] : (index) -> i32
|
|
! CHECK: %[[J_FINAL:.*]] = fir.do_loop %[[J:[^ ]*]] =
|
|
! CHECK-SAME: %[[C1_INDEX]] to %[[C10_INDEX]] step %[[C1_1]]
|
|
! CHECK-SAME: iter_args(%[[J_IV:.*]] = %[[J_LB]]) -> (i32) {
|
|
! CHECK: fir.store %[[J_IV]] to %[[J_DECL]] : !fir.ref<i32>
|
|
! CHECK: %[[J_STEPCAST:.*]] = fir.convert %[[C1_1]] : (index) -> i32
|
|
! CHECK: %[[J_IVLOAD:.*]] = fir.load %[[J_DECL]] : !fir.ref<i32>
|
|
! CHECK: %[[J_IVINC:.*]] = arith.addi %[[J_IVLOAD]], %[[J_STEPCAST]] overflow<nsw> : i32
|
|
! CHECK: fir.result %[[J_IVINC]] : i32
|
|
! CHECK: }
|
|
! CHECK: fir.store %[[J_FINAL]] to %[[J_DECL]] : !fir.ref<i32>
|
|
! CHECK: cf.br ^[[BODY1]]
|
|
! CHECK: ^[[RETURN]]:
|
|
! CHECK: return
|
|
|
|
subroutine empty_infinite_in_while(i)
|
|
integer :: i
|
|
do while (i .gt. 50)
|
|
do
|
|
end do
|
|
end do
|
|
end subroutine
|
|
|
|
! CHECK-LABEL: empty_infinite_in_while
|
|
! CHECK-SAME: %[[I_REF:.*]]: !fir.ref<i32>
|
|
! CHECK-DAG: %[[C50:.*]] = arith.constant 50 : i32
|
|
! CHECK-DAG: %[[I_DECL:.*]] = fir.declare %[[I_REF]] {{.*}}
|
|
! CHECK: cf.br ^bb1
|
|
! CHECK: ^bb1:
|
|
! CHECK: %[[I:.*]] = fir.load %[[I_DECL]] : !fir.ref<i32>
|
|
! CHECK: %[[COND:.*]] = arith.cmpi sgt, %[[I]], %[[C50]] : i32
|
|
! CHECK: cf.cond_br %[[COND]], ^[[INF_HEADER:.*]], ^[[EXIT:.*]]
|
|
! CHECK: ^[[INF_HEADER]]:
|
|
! CHECK: cf.br ^[[INF_BODY:.*]]
|
|
! CHECK: ^[[INF_BODY]]:
|
|
! CHECK: cf.br ^[[INF_HEADER]]
|
|
! CHECK: ^[[EXIT]]:
|
|
! CHECK: return
|