[Mlir-commits] [mlir] [MLIR][LLVMIR] Restore constant folding for global initializer GEPs (PR #227651)
Nikita Popov
llvmlistbot at llvm.org
Wed Sep 30 04:24:18 PDT 2026
================
@@ -282,6 +283,10 @@ static LogicalResult convertGEPOp(GEPOp op, llvm::IRBuilderBase &builder,
if (!res)
return op.emitError("failed to lower " + WhyConstExpr +
" to a constant byte offset");
+ // Fold the constant as CreateGEP did through the TargetFolder. This also
+ // infers inbounds and nuw when the offset stays within the global.
+ if (!inrangeAttr)
----------------
nikic wrote:
Why the `!inrangeAttr`?
https://github.com/llvm/llvm-project/pull/227651
More information about the Mlir-commits
mailing list