Files
TheRock/compiler/amd-llvm/flang/test/HLFIR/order_assignments/where-cleanup.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

45 lines
2.0 KiB
Fortran

// Test hlfir.where masked region cleanup lowering (the freemem in the tests).
// RUN: fir-opt %s --lower-hlfir-ordered-assignments | FileCheck %s
func.func @loop_cleanup(%mask : !fir.ref<!fir.array<2x!fir.logical<4>>>, %x : !fir.ref<!fir.array<2xf32>>, %y : !fir.ref<!fir.array<2xf32>>) {
hlfir.where {
%1 = fir.allocmem !fir.array<10xi32>
hlfir.yield %mask : !fir.ref<!fir.array<2x!fir.logical<4>>> cleanup {
fir.freemem %1 : !fir.heap<!fir.array<10xi32>>
}
} do {
hlfir.region_assign {
%1 = fir.allocmem !fir.array<1xi32>
%2 = fir.allocmem !fir.array<2xi32>
hlfir.yield %x : !fir.ref<!fir.array<2xf32>> cleanup {
fir.freemem %2 : !fir.heap<!fir.array<2xi32>>
fir.freemem %1 : !fir.heap<!fir.array<1xi32>>
}
} to {
%1 = fir.allocmem !fir.array<3xi32>
%2 = fir.allocmem !fir.array<4xi32>
hlfir.yield %y : !fir.ref<!fir.array<2xf32>> cleanup {
fir.freemem %2 : !fir.heap<!fir.array<4xi32>>
fir.freemem %1 : !fir.heap<!fir.array<3xi32>>
}
}
}
return
}
// CHECK-LABEL: func.func @loop_cleanup(
// CHECK: %[[VAL_3:.*]] = fir.allocmem !fir.array<10xi32>
// CHECK: fir.do_loop
// CHECK: fir.if
// CHECK: %[[VAL_11:.*]] = fir.allocmem !fir.array<1xi32>
// CHECK: %[[VAL_12:.*]] = fir.allocmem !fir.array<2xi32>
// CHECK: %[[VAL_14:.*]] = fir.allocmem !fir.array<3xi32>
// CHECK: %[[VAL_15:.*]] = fir.allocmem !fir.array<4xi32>
// CHECK: hlfir.assign
// CHECK: fir.freemem %[[VAL_15]] : !fir.heap<!fir.array<4xi32>>
// CHECK: fir.freemem %[[VAL_14]] : !fir.heap<!fir.array<3xi32>>
// CHECK: fir.freemem %[[VAL_12]] : !fir.heap<!fir.array<2xi32>>
// CHECK: fir.freemem %[[VAL_11]] : !fir.heap<!fir.array<1xi32>>
// CHECK: }
// CHECK: }
// CHECK: fir.freemem %[[VAL_3]] : !fir.heap<!fir.array<10xi32>>