[all-commits] [llvm/llvm-project] 233a25: [MLIR][LLVMIR] Restore constant folding for global...
Henrich Lauko via All-commits
all-commits at lists.llvm.org
Wed Sep 30 08:23:21 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 233a25d068a9323211dd1f32c7a83e72751826ef
https://github.com/llvm/llvm-project/commit/233a25d068a9323211dd1f32c7a83e72751826ef
Author: Henrich Lauko <xlauko at mail.muni.cz>
Date: 2026-09-30 (Wed, 30 Sep 2026)
Changed paths:
M mlir/lib/Target/LLVMIR/Dialect/LLVMIR/CMakeLists.txt
M mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp
M mlir/test/Target/LLVMIR/llvmir.mlir
Log Message:
-----------
[MLIR][LLVMIR] Restore constant folding for global initializer GEPs (#227651)
Before #226904, a GEP in a global initializer went through
IRBuilder::CreateGEP, and MLIR's IRBuilder<TargetFolder> folded the
result
with ConstantFoldConstant. That combines nested GEPs, folds null and
integer
bases, and infers inbounds and nuw when the offset stays within the
global.
Building the constant expression directly skipped the folder, so the
output
lost those flags.
Fold the constant again. This also applies to inrange GEPs, which used
to
bypass the folder; the only visible difference there is that an inbounds
GEP with a non-negative offset now also gets nuw.
CIR's vtable, VTT and constant pointer tests check for the inferred
flags
(for example CIR/CodeGen/vtt.cpp) and have failed since #226904.
Assisted-by: Claude Code (Claude Fable 5.1).
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