[all-commits] [llvm/llvm-project] c03325: [MLIR][LLVMIR] Use TargetFolder when creating glob...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Feb 12 01:14:22 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c03325cead2244ef0a89bb1cf365bddf16021daf
      https://github.com/llvm/llvm-project/commit/c03325cead2244ef0a89bb1cf365bddf16021daf
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2025-02-12 (Wed, 12 Feb 2025)

  Changed paths:
    M flang/test/Fir/box.fir
    M flang/test/Fir/rebox-global.fir
    M flang/test/Fir/type-descriptor.fir
    M mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
    M mlir/test/Target/LLVMIR/llvmir.mlir
    M mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-host.mlir

  Log Message:
  -----------
  [MLIR][LLVMIR] Use TargetFolder when creating globals (#126745)

The LLVM dialect lowers globals using IRBuilder, relying on it creating
constant expressions where possible. As we remove support for more
constant expressions (per
https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179),
this can cause issues for cases where the constant expression is no
longer supported, and the operation cannot be constant folded without
DataLayout being available. In particular, I ran into this issue with
flang and the removal of mul constant expressions.

Address this by using TargetFolder when creating globals, which will
perform DL-aware constant folding. I think it would make sense to also
do this in general, but I'm starting with globals where not doing this
can result in translation failures.

Ideally, globals with these problematic expressions would never be
generated in the first place, but there has been little movement on
fixing this (https://github.com/llvm/llvm-project/issues/96047).



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