[Mlir-commits] [flang] [mlir] [MLIR][OpenMP] Changes to function-filtering pass (PR #71850)
Sergio Afonso
llvmlistbot at llvm.org
Fri Nov 10 03:27:01 PST 2023
================
@@ -56,17 +56,30 @@ class OMPFunctionFilteringPass
if (declareTargetOp && declareTargetOp.isDeclareTarget())
declareType = declareTargetOp.getDeclareTargetDeviceType();
- // Filtering a function here means removing its body and explicitly
- // setting its omp.declare_target attribute, so that following
- // translation/lowering/transformation passes will skip processing its
- // contents, but preventing the calls to undefined symbols that could
- // result if the function were deleted. The second stage of function
- // filtering, at the MLIR to LLVM IR translation level, will remove these
- // from the IR thanks to the mismatch between the omp.declare_target
- // attribute and the target device.
+ // Filtering a function here means deleting it if it doesn't containt a
+ // target region. Else we explicitly setting its omp.declare_target
+ // attribute. The second stage of function filtering at the MLIR to LLVM
+ // IR translation level will remove functions that contain the target
+ // region from the generated llvm IR.
if (declareType == omp::DeclareTargetDeviceType::host) {
- funcOp.eraseBody();
- funcOp.setVisibility(SymbolTable::Visibility::Private);
+ auto funcUses = *funcOp.getSymbolUses(op);
+ for (auto use : funcUses) {
+ auto *callOp = use.getUser();
----------------
skatrak wrote:
Nit: Replace `auto` with `Operation`.
https://github.com/llvm/llvm-project/pull/71850
More information about the Mlir-commits
mailing list