[all-commits] [llvm/llvm-project] af2dd1: [MLIR][LLVMIR] Add support for empty global ctor/d...

Bruno Cardoso Lopes via All-commits all-commits at lists.llvm.org
Fri Feb 28 10:46:39 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: af2dd15a4b6b8e4f7d126f90e0dd4e9120a37503
      https://github.com/llvm/llvm-project/commit/af2dd15a4b6b8e4f7d126f90e0dd4e9120a37503
  Author: Bruno Cardoso Lopes <bruno.cardoso at gmail.com>
  Date:   2025-02-28 (Fri, 28 Feb 2025)

  Changed paths:
    M mlir/lib/Target/LLVMIR/ModuleImport.cpp
    M mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
    M mlir/test/Dialect/LLVMIR/global.mlir
    M mlir/test/Target/LLVMIR/Import/global-variables.ll
    M mlir/test/Target/LLVMIR/llvmir.mlir

  Log Message:
  -----------
  [MLIR][LLVMIR] Add support for empty global ctor/dtor lists (#128969)

LLVM IR emitted in from C++ may contain `@llvm.global_ctors = appending
global [0 x { i32, ptr, ptr }] zeroinitializer`. Before this PR, if we
try to roundtrip code like this from the importer, we'll end up with
nothing in place.

Note that `llvm::appendToGlobalCtors` ignores empty lists and this PR
uses the same approach as `llvm-as`, which doesn't use the utilities
from `llvm/lib/Transforms/Utils/ModuleUtils.cpp` in order to build this
- it calls into creating a global variable from scratch.



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