[Mlir-commits] [mlir] [MLIR][LLVM] Support inrange in GEP (PR #220424)

Letu Ren llvmlistbot at llvm.org
Sat Sep 12 20:10:07 PDT 2026


================
@@ -829,6 +829,11 @@ LogicalResult LLVM::GEPOp::verify() {
   if (getNoWrapFlags() == GEPNoWrapFlags::inboundsFlag)
     return emitOpError("'inbounds_flag' cannot be used directly.");
 
+  if (auto inrange = getInrangeAttr()) {
+    if (inrange.getLower().sge(inrange.getUpper()))
+      return emitOpError("expected 'inrange' end to be larger than start");
----------------
FantasqueX wrote:

The translation helper checks both the translated base and every translated index with `isa<llvm::Constant>`. I kept this check in translation because a syntactically dynamic MLIR operand, such as a result of `llvm.mlir.constant` or an imported constant expression, may still translate to an LLVM constant. A verifier check based only on the MLIR operand representation would reject valid constant expressions.

https://github.com/llvm/llvm-project/pull/220424


More information about the Mlir-commits mailing list