[all-commits] [llvm/llvm-project] d3ed84: [Utils][mlir] Fix interaction between CodeExtracto...

Kajetan Puchalski via All-commits all-commits at lists.llvm.org
Wed Jun 25 05:34:56 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d3ed84ed67176e52f67f7c14fe6792a14154e94f
      https://github.com/llvm/llvm-project/commit/d3ed84ed67176e52f67f7c14fe6792a14154e94f
  Author: Kajetan Puchalski <kajetan.puchalski at arm.com>
  Date:   2025-06-25 (Wed, 25 Jun 2025)

  Changed paths:
    M llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
    M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
    M llvm/lib/Transforms/Utils/CodeExtractor.cpp
    M llvm/test/Transforms/HotColdSplit/assumption-cache-invalidation.ll
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
    A mlir/test/Target/LLVMIR/openmp-nested-task-target-parallel.mlir

  Log Message:
  -----------
  [Utils][mlir] Fix interaction between CodeExtractor and OpenMPIRBuilder (#145051)

CodeExtractor can currently erroneously insert an alloca into a
different function than it inserts its users into, in cases where code
is being extracted out of a function that has already been outlined. Add
an assertion that the two blocks being inserted into are actually in the
same function.

Add a check to findAllocaInsertPoint in OpenMP to LLVMIR translation to
prevent the aforementioned scenario from happening.

OpenMPIRBuilder relies on a callback mechanism to fix-up a module later
on during the finaliser step. In some cases this results in the module
being invalid prior to the finalise step running. Remove calls to
verifyModule wrapped in LLVM_DEBUG from CodeExtractor, as the presence
of those results in the compiler crashing with -mllvm -debug due to
premature module verification where it would not crash without -debug.

Call ompBuilder->finalize() the end of mlir::translateModuleToLLVMIR, in
order to make sure the module has actually been finalized prior to
trying to verify it.

Resolves https://github.com/llvm/llvm-project/issues/138102.

---------

Signed-off-by: Kajetan Puchalski <kajetan.puchalski at arm.com>



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