[Mlir-commits] [mlir] [MLIR][LLVM] Support inrange in GEP (PR #220424)
Letu Ren
llvmlistbot at llvm.org
Sat Sep 12 20:04:53 PDT 2026
================
@@ -352,13 +365,41 @@ def LLVM_GEPOp : LLVM_Op<"getelementptr", [Pure,
}
Type baseElementType = op.getElemType();
llvm::Type *elementType = moduleTranslation.convertType(baseElementType);
- $res = builder.CreateGEP(elementType, $base, indices, "",
- llvm::GEPNoWrapFlags::fromRaw(
- static_cast<unsigned>(
- op.getNoWrapFlags())));
+ llvm::GEPNoWrapFlags nwFlags = llvm::GEPNoWrapFlags::fromRaw(
+ static_cast<unsigned>(op.getNoWrapFlags()));
+ // `inrange` is only representable on LLVM constant GEP expressions.
+ if (auto inrangeAttr = op.getInrangeAttr()) {
----------------
FantasqueX wrote:
Extracted to `convertGEPOp`
https://github.com/llvm/llvm-project/pull/220424
More information about the Mlir-commits
mailing list