[Mlir-commits] [mlir] [mlir][NVVM] Move MMA verifier type sets (NFC) (PR #221712)

Mehdi Amini llvmlistbot at llvm.org
Mon Sep 7 05:02:19 PDT 2026


https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/221712

Build the fixed-size operand type collection by moving the locally computed allowed-type sets. The verifier does not use the individual sets afterward, so copying their nested vectors is unnecessary.

Found by Coverity.

Assisted-by: Codex

>From c54e38cefcfead63711f44ff48818f335d5cae8b Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Thu, 3 Sep 2026 05:42:50 -0700
Subject: [PATCH] [mlir][NVVM] Move MMA verifier type sets

Build the fixed-size operand type collection by moving the locally computed
allowed-type sets. The verifier does not use the individual sets afterward,
so copying their nested vectors is unnecessary.

Found by Coverity.

Assisted-by: Codex
---
 mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
index 843344703d0a5..829ecaecaeb29 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
@@ -37,10 +37,12 @@
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/NVPTXAddrSpace.h"
 #include "llvm/Support/raw_ostream.h"
+#include <array>
 #include <cassert>
 #include <cmath>
 #include <optional>
 #include <string>
+#include <utility>
 
 using namespace mlir;
 using namespace NVVM;
@@ -1399,7 +1401,9 @@ LogicalResult MmaOp::verify() {
   // Verify the operand types for segments of A, B, and C operands.
   std::array<StringRef, 3> operandNames{"A", "B", "C"};
   for (const auto &iter : llvm::enumerate(
-           SmallVector<AllowedTypes, 3>{expectedA, expectedB, expectedC})) {
+           std::array<AllowedTypes, 3>{std::move(expectedA),
+                                       std::move(expectedB),
+                                       std::move(expectedC)})) {
     auto spec = this->getODSOperandIndexAndLength(iter.index());
     SmallVector<Type, 4> operandTySeg(operand_type_begin() + spec.first,
                                       operand_type_begin() + spec.first +
@@ -1918,7 +1922,9 @@ LogicalResult MmaSpOp::verify() {
   // Verify the operand types for segments of A, B, and C operands.
   std::array<StringRef, 3> operandNames{"A", "B", "C"};
   for (const auto &iter : llvm::enumerate(
-           SmallVector<AllowedTypes, 3>{expectedA, expectedB, expectedC})) {
+           std::array<AllowedTypes, 3>{std::move(expectedA),
+                                       std::move(expectedB),
+                                       std::move(expectedC)})) {
     auto spec = this->getODSOperandIndexAndLength(iter.index());
     SmallVector<Type, 4> operandTySeg(operand_type_begin() + spec.first,
                                       operand_type_begin() + spec.first +



More information about the Mlir-commits mailing list