[Mlir-commits] [mlir] [mlir] Rectify mishandling in `InsertOpConstantFolder` causing crash with assertion when using `mlir-opt --canonicalize` (PR #88314)

Mehdi Amini llvmlistbot at llvm.org
Sat Sep 7 14:30:07 PDT 2024


================
@@ -2908,6 +2911,16 @@ class InsertOpConstantFolder final : public OpRewritePattern<InsertOp> {
     rewriter.replaceOpWithNewOp<arith::ConstantOp>(op, newAttr);
     return success();
   }
+
+private:
+  /// Helper function to cast or convert attribute to the expected type.
+  Attribute castOrConvertAttr(Attribute attr, Type expectedType) const {
----------------
joker-eph wrote:

Nit: wouldn't a more accurate name be "convertIntegerAttr"? There is no "cast" here as far as I can tell, and this does nothing for non integer attribute (the doc should be more clear on this)

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


More information about the Mlir-commits mailing list