[Mlir-commits] [mlir] [mlir][linalg] Fix vectorization precondition for tensor.pad (PR #175869)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jan 14 10:05:07 PST 2026


================
@@ -2511,13 +2511,14 @@ vectorizePadOpPrecondition(tensor::PadOp padOp,
   // which is zero here. Hence we will load the pad value which is what we want
   // in this case. If the low pad is dynamically zero then the lowering is
   // correct as well as no shifts are necessary.
-  if (llvm::any_of(llvm::enumerate(padOp.getLow()), [&](const auto &en) {
-        Value padValue = en.value();
-        unsigned pos = en.index();
-        std::optional<int64_t> pad = getConstantIntValue(padValue);
-        return (!pad.has_value() || pad.value() != 0) &&
-               resultTensorShape[pos] != 1;
-      })) {
+  if (llvm::any_of(llvm::enumerate(padOp.getMixedLowPad()),
+                   [&](const auto &en) {
+                     OpFoldResult padValue = en.value();
+                     unsigned pos = en.index();
+                     std::optional<int64_t> pad = getConstantIntValue(padValue);
----------------
MaheshRavishankar wrote:

This is hilarious! Thanks for the fix!

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


More information about the Mlir-commits mailing list