[all-commits] [llvm/llvm-project] f3b8ee: [mlir][OpenMP] Convert omp.cancel sections to LLVMIR

Tom Eccles via All-commits all-commits at lists.llvm.org
Sat Apr 26 04:48:32 PDT 2025


  Branch: refs/heads/users/tblah/omp-cancel-codegen-1
  Home:   https://github.com/llvm/llvm-project
  Commit: f3b8eebb37320ab748682f6a091e52e64aeec0d7
      https://github.com/llvm/llvm-project/commit/f3b8eebb37320ab748682f6a091e52e64aeec0d7
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2025-04-26 (Sat, 26 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.



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