[Mlir-commits] [mlir] c43e8c0 - [mlir][OpDefGen] Don't emit attribute name getters when there are no attributes

River Riddle llvmlistbot at llvm.org
Tue Jun 22 20:09:17 PDT 2021


Author: River Riddle
Date: 2021-06-23T03:03:54Z
New Revision: c43e8c0eeffe04b4c761273349fe287866c7fb8c

URL: https://github.com/llvm/llvm-project/commit/c43e8c0eeffe04b4c761273349fe287866c7fb8c
DIFF: https://github.com/llvm/llvm-project/commit/c43e8c0eeffe04b4c761273349fe287866c7fb8c.diff

LOG: [mlir][OpDefGen] Don't emit attribute name getters when there are no attributes

This avoids generating otherwise unnecessary methods.

Added: 
    

Modified: 
    mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index 4af4902c2c4c..664fc2de788e 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -669,6 +669,8 @@ void OpEmitter::genAttrNameGetters() {
       body << "};\n  return ::llvm::makeArrayRef(attrNames);";
     }
   }
+  if (attributeNames.empty())
+    return;
 
   // Emit the getAttributeNameForIndex methods.
   {


        


More information about the Mlir-commits mailing list