[Mlir-commits] [mlir] [MLIR][LLVMIR] Restore constant folding for global initializer GEPs (PR #227651)
Henrich Lauko
llvmlistbot at llvm.org
Wed Sep 30 04:37:39 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)
----------------
xlauko wrote:
I guess no good reason, it only kept the inrange output identical to before #226904, since that
path never went through the folder. I dropped it.
https://github.com/llvm/llvm-project/pull/227651
More information about the Mlir-commits
mailing list