// RUN: cir-opt --omp-mark-declare-target %s -o - | FileCheck %s // Test that the MarkDeclareTarget pass propagates the declare_target // attribute from explicitly marked functions to functions they call, // and from omp.target regions to functions called within them. !s32i = !cir.int module { // A helper function with no declare_target attribute initially. // After the pass, it should be marked because @caller calls it. // CHECK-LABEL: cir.func @helper // CHECK-SAME: omp.declare_target = #omp.declaretarget cir.func @caller() attributes {omp.declare_target = #omp.declaretarget} { cir.call @helper() : () -> () cir.return } // Called from within an omp.target region; should be marked as nohost. // CHECK-LABEL: cir.func @device_helper // CHECK-SAME: omp.declare_target = #omp.declaretarget () omp.terminator } cir.return } // Not called by any declare_target function or target region. // CHECK-LABEL: cir.func @unrelated // CHECK-NOT: omp.declare_target // CHECK-SAME: { cir.func @unrelated() { cir.return } }