Files
TheRock/compiler/amd-llvm/flang/test/Lower/block.f90
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

100 lines
3.9 KiB
Fortran

! RUN: bbc -emit-hlfir -o - %s | FileCheck %s
! CHECK-LABEL: func @_QQmain
program bb ! block stack management and exits
! CHECK: %[[V_1:[0-9]+]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFEi"}
! CHECK: %[[V_I:[0-9]+]]:2 = hlfir.declare %[[V_1]] {uniq_name = "_QFEi"}
integer :: i, j
! CHECK: hlfir.assign %c0{{.*}} to %[[V_I]]#0
i = 0
! CHECK: %[[V_3:[0-9]+]] = llvm.intr.stacksave : !llvm.ptr
! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
! CHECK: cf.br ^bb1
! CHECK: ^bb1: // 2 preds: ^bb0, ^bb16
! CHECK: cf.cond_br %{{.*}}, ^bb2, ^bb17
! CHECK: ^bb2: // pred: ^bb1
! CHECK: %[[V_11:[0-9]+]] = llvm.intr.stacksave : !llvm.ptr
! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
! CHECK: cf.cond_br %{{.*}}, ^bb3, ^bb4
! CHECK: ^bb3: // pred: ^bb2
! CHECK: cf.br ^bb10
! CHECK: ^bb4: // pred: ^bb2
! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
! CHECK: cf.cond_br %{{.*}}, ^bb5, ^bb6
! CHECK: ^bb5: // pred: ^bb4
! CHECK: cf.br ^bb14
! CHECK: ^bb6: // pred: ^bb4
! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
! CHECK: cf.cond_br %{{.*}}, ^bb7, ^bb8
! CHECK: ^bb7: // pred: ^bb6
! CHECK: llvm.intr.stackrestore %[[V_11]] : !llvm.ptr
! CHECK: cf.br ^bb15
! CHECK: ^bb8: // pred: ^bb6
! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
! CHECK: cf.cond_br %{{.*}}, ^bb9, ^bb10
! CHECK: ^bb9: // pred: ^bb8
! CHECK: llvm.intr.stackrestore %[[V_11]] : !llvm.ptr
! CHECK: cf.br ^bb16
! CHECK: ^bb10: // 2 preds: ^bb3, ^bb8
! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
! CHECK: cf.cond_br %{{.*}}, ^bb11, ^bb12
! CHECK: ^bb11: // pred: ^bb10
! CHECK: llvm.intr.stackrestore %[[V_11]] : !llvm.ptr
! CHECK: cf.br ^bb18
! CHECK: ^bb12: // pred: ^bb10
! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
! CHECK: cf.cond_br %{{.*}}, ^bb13, ^bb14
! CHECK: ^bb13: // pred: ^bb12
! CHECK: llvm.intr.stackrestore %[[V_11]] : !llvm.ptr
! CHECK: llvm.intr.stackrestore %[[V_3]] : !llvm.ptr
! CHECK: cf.br ^bb19
! CHECK: ^bb14: // 2 preds: ^bb5, ^bb12
! CHECK: llvm.intr.stackrestore %[[V_11]] : !llvm.ptr
! CHECK: cf.br ^bb15
! CHECK: ^bb15: // 2 preds: ^bb7, ^bb14
! CHECK: cf.br ^bb16
! CHECK: ^bb16: // 2 preds: ^bb9, ^bb15
! CHECK: cf.br ^bb1
! CHECK: ^bb17: // pred: ^bb1
! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
! CHECK: cf.br ^bb18
! CHECK: ^bb18: // 2 preds: ^bb11, ^bb17
! CHECK: llvm.intr.stackrestore %[[V_3]] : !llvm.ptr
! CHECK: cf.br ^bb19
! CHECK: ^bb19: // 2 preds: ^bb13, ^bb18
block
i = i + 1 ! 1 increment
do j = 1, 5
block
i = i + 1; if (j == 1) goto 1 ! inner block - 5 increments, 1 goto
i = i + 1; if (j == 2) goto 2 ! inner block - 4 increments, 1 goto
i = i + 1; if (j == 3) goto 10 ! outer block - 3 increments, 1 goto
i = i + 1; if (j == 4) goto 11 ! outer block - 2 increments, 1 goto
1 i = i + 1; if (j == 5) goto 12 ! outer block - 2 increments, 1 goto
i = i + 1; if (j == 6) goto 100 ! program - 1 increment
2 end block
10 i = i + 1 ! 3 increments
11 end do
i = i + 1 ! 0 increments
12 end block
100 print*, i ! expect 21
! CHECK: %[[V_51:[0-9]+]] = llvm.intr.stacksave : !llvm.ptr
! CHECK: %[[ASSOC:[0-9]+]]:3 = hlfir.associate %c5{{.*}} {adapt.valuebyref} : (i32) -> (!fir.ref<i32>, !fir.ref<i32>, i1)
! CHECK: fir.call @ss(%[[ASSOC]]#0) proc_attrs<bind_c> fastmath<contract> : (!fir.ref<i32>) -> ()
! CHECK: hlfir.end_associate %[[ASSOC]]#1, %[[ASSOC]]#2 : !fir.ref<i32>, i1
! CHECK: llvm.intr.stackrestore %[[V_51]] : !llvm.ptr
block
interface
subroutine ss(n) bind(c)
integer :: n
end subroutine
end interface
call ss(5)
end block
end
subroutine ss(n) bind(c)
print*, n
end subroutine