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
95 lines
3.8 KiB
MLIR
95 lines
3.8 KiB
MLIR
// RUN: fir-opt %s --split-input-file --pass-pipeline="builtin.module(func.func(test-acc-pointer-like-interface{test-mode=free}))" 2>&1 | FileCheck %s
|
|
|
|
// The tests here use a synthetic hlfir.declare in order to ensure that the hlfir dialect is
|
|
// loaded. This is required because the pass used is part of OpenACC test passes outside of
|
|
// flang and the APIs being test may generate hlfir even when it does not appear.
|
|
|
|
func.func @test_ref_scalar_free() {
|
|
%0 = fir.alloca f32 {test.ptr}
|
|
%1:2 = hlfir.declare %0 {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
// CHECK: Successfully generated free for operation: %{{.*}} = fir.alloca f32 {test.ptr}
|
|
// CHECK-NOT: Generated
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_heap_scalar_free() {
|
|
%0 = fir.allocmem f32 {test.ptr}
|
|
%var = fir.alloca f32
|
|
%1:2 = hlfir.declare %var {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
// CHECK: Successfully generated free for operation: %{{.*}} = fir.allocmem f32 {test.ptr}
|
|
// CHECK: Generated: fir.freemem %{{.*}} : !fir.heap<f32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_heap_array_free() {
|
|
%0 = fir.allocmem !fir.array<10x20xf32> {test.ptr}
|
|
%var = fir.alloca f32
|
|
%1:2 = hlfir.declare %var {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
// CHECK: Successfully generated free for operation: %{{.*}} = fir.allocmem !fir.array<10x20xf32> {test.ptr}
|
|
// CHECK: Generated: fir.freemem %{{.*}} : !fir.heap<!fir.array<10x20xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_convert_walking_free() {
|
|
%0 = fir.alloca f32
|
|
%1 = fir.convert %0 {test.ptr} : (!fir.ref<f32>) -> !fir.ptr<f32>
|
|
%2:2 = hlfir.declare %0 {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
// CHECK: Successfully generated free for operation: %{{.*}} = fir.convert %{{.*}} {test.ptr} : (!fir.ref<f32>) -> !fir.ptr<f32>
|
|
// CHECK-NOT: Generated
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_declare_walking_free() {
|
|
%0 = fir.alloca f32
|
|
%1 = fir.declare %0 {test.ptr, uniq_name = "x"} : (!fir.ref<f32>) -> !fir.ref<f32>
|
|
%2:2 = hlfir.declare %0 {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
// CHECK: Successfully generated free for operation: %{{.*}} = fir.declare %{{.*}} {test.ptr, uniq_name = "x"} : (!fir.ref<f32>) -> !fir.ref<f32>
|
|
// CHECK-NOT: Generated
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_hlfir_declare_walking_free() {
|
|
%0 = fir.alloca f32
|
|
%1:2 = hlfir.declare %0 {test.ptr, uniq_name = "x"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
%var = fir.alloca f32
|
|
%2:2 = hlfir.declare %var {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
// CHECK: Successfully generated free for operation
|
|
// CHECK-NOT: Generated
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_heap_through_convert_free() {
|
|
%0 = fir.allocmem f32
|
|
%1 = fir.convert %0 {test.ptr} : (!fir.heap<f32>) -> !fir.llvm_ptr<f32>
|
|
%var = fir.alloca f32
|
|
%2:2 = hlfir.declare %var {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
// CHECK: Successfully generated free for operation: %{{.*}} = fir.convert %{{.*}} {test.ptr} : (!fir.heap<f32>) -> !fir.llvm_ptr<f32>
|
|
// CHECK: Generated: %{{.*}} = fir.convert %{{.*}} : (!fir.llvm_ptr<f32>) -> !fir.heap<f32>
|
|
// CHECK: Generated: fir.freemem %{{.*}} : !fir.heap<f32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_heap_through_declare_free() {
|
|
%0 = fir.allocmem f32
|
|
%1 = fir.declare %0 {test.ptr, uniq_name = "x"} : (!fir.heap<f32>) -> !fir.heap<f32>
|
|
%var = fir.alloca f32
|
|
%2:2 = hlfir.declare %var {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
// CHECK: Successfully generated free for operation: %{{.*}} = fir.declare %{{.*}} {test.ptr, uniq_name = "x"} : (!fir.heap<f32>) -> !fir.heap<f32>
|
|
// CHECK: Generated: fir.freemem %{{.*}} : !fir.heap<f32>
|
|
return
|
|
}
|