[Mlir-commits] [mlir] [mlir][tensor] Fix a bug in constant packing folding. (PR #87296)

Mehdi Amini llvmlistbot at llvm.org
Mon Apr 1 21:24:16 PDT 2024


================
@@ -4143,9 +4145,12 @@ bool PackOp::isLikePad() {
 }
 
 OpFoldResult PackOp::fold(FoldAdaptor adaptor) {
+  std::optional<Attribute> paddingValue;
+  if (adaptor.getPaddingValue())
+    paddingValue = adaptor.getPaddingValue();
----------------
joker-eph wrote:

Nit: we should avoid the double call to `getPaddingValue()` here: this accessor is far from free (there is a loop hidden behind it)

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


More information about the Mlir-commits mailing list