[Mlir-commits] [mlir] [mlir] Handle arith.const expr in dispatchIndexOpFoldResult func (PR #122432)

Javed Absar llvmlistbot at llvm.org
Fri Jan 10 03:13:06 PST 2025


================
@@ -54,6 +54,14 @@ void dispatchIndexOpFoldResult(OpFoldResult ofr,
     staticVec.push_back(apInt.getSExtValue());
     return;
   }
+
+  OpFoldResult result = getAsOpFoldResult(v);
+  if (auto attr = result.dyn_cast<Attribute>()) {
----------------
javedabsar1 wrote:

I think you could dyn_cast the OpFoldResult directly as IntegerAttr.
saves forced cast on next line. 
some thing like `if (auto iattr = dyn_cast<IntegerAttr>(result)`

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


More information about the Mlir-commits mailing list