[Mlir-commits] [mlir] [LLVMIR] Directly lower global initializer GEP to constant expression (PR #226904)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Sep 28 00:18:35 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-llvm
Author: Nikita Popov (nikic)
<details>
<summary>Changes</summary>
MLIR lowers global initializers in a very unusual way, by using an IRBuilder without insertion point, and relying on the fact that for a well-formed initializer, all the instructions will be converted to constant expressions and no actual instructions that require insertion will be produced.
This causes issues for https://github.com/llvm/llvm-project/pull/226425, which requires an insertion point for CreateGEP to determine the data layout.
To avoid this, make convertGEPOp() directly produce a constant expression GEP if there is no insertion point, reusing the existing code path for inrange GEPs.
---
Full diff: https://github.com/llvm/llvm-project/pull/226904.diff
2 Files Affected:
- (modified) mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp (+14-8)
- (modified) mlir/test/Target/LLVMIR/llvmir-invalid.mlir (+2-2)
``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````
</details>
https://github.com/llvm/llvm-project/pull/226904
More information about the Mlir-commits
mailing list