[all-commits] [llvm/llvm-project] fac424: [mlir][OpenMP] Convert omp.cancel sections to LLVMIR
Tom Eccles via All-commits
all-commits at lists.llvm.org
Mon Apr 28 08:09:53 PDT 2025
Branch: refs/heads/users/tblah/omp-cancel-codegen-1
Home: https://github.com/llvm/llvm-project
Commit: fac4240f2c217a9e48ab2eb8eeffb818f5c3a9ff
https://github.com/llvm/llvm-project/commit/fac4240f2c217a9e48ab2eb8eeffb818f5c3a9ff
Author: Tom Eccles <tom.eccles at arm.com>
Date: 2025-04-28 (Mon, 28 Apr 2025)
Changed paths:
M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
M mlir/test/Target/LLVMIR/openmp-cancel.mlir
M mlir/test/Target/LLVMIR/openmp-todo.mlir
Log Message:
-----------
[mlir][OpenMP] Convert omp.cancel sections to LLVMIR
This is quite ugly but it is the best I could think of. The old
FiniCBWrapper was way too brittle depending upon the exact block
structure inside of the section, and could be confused by any control
flow in the section (e.g. an if clause on cancel). The wording in the
comment and variable names didn't seem to match where it was actually
branching too as well.
Clang's (non-OpenMPIRBuilder) lowering for cancel inside of sections
branches to a block containing __kmpc_for_static_fini.
This was hard to achieve here because sometimes the FiniCBWrapper has to
run before the worksharing loop finalization has been crated.
To get around this ordering issue I created a dummy branch to a dummy
block, which is then fixed later once all of the information is
available.
Commit: 6c678b739d4fab204862ee057e00c3b0cc4c1946
https://github.com/llvm/llvm-project/commit/6c678b739d4fab204862ee057e00c3b0cc4c1946
Author: Tom Eccles <tom.eccles at arm.com>
Date: 2025-04-28 (Mon, 28 Apr 2025)
Changed paths:
M clang/lib/CodeGen/CGStmtOpenMP.cpp
Log Message:
-----------
Don't use clang's callback to hack the cancellation branch
This conflicted with my hack doing the same thing: leading to a
use-after-free of the old terminator. I think it is more helpful to do
this in OpenMPIRBuilder than replicating the hack in callbacks in both
clang and mlir.
Compare: https://github.com/llvm/llvm-project/compare/60592cf957e8...6c678b739d4f
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list