[llvm] c2dc46c - [TableGen] Pass ValueTypeByHwMode by const reference in a couple places. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 14:52:32 PDT 2024


Author: Craig Topper
Date: 2024-07-31T14:52:05-07:00
New Revision: c2dc46cd1532c57e3d16c69f54edeed67e2d46c7

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

LOG: [TableGen] Pass ValueTypeByHwMode by const reference in a couple places. NFC

ValueTypeByHwMode contains a std::map. We shouldn't copy it if
we don't need to .

Fixes #101406.

Added: 
    

Modified: 
    llvm/utils/TableGen/Common/CodeGenDAGPatterns.h

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h
index bac213a356d84..2f1b9aadd9ea9 100644
--- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h
+++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h
@@ -264,7 +264,8 @@ struct TypeInfer {
   bool MergeInTypeInfo(TypeSetByHwMode &Out, MVT::SimpleValueType InVT) const {
     return MergeInTypeInfo(Out, TypeSetByHwMode(InVT));
   }
-  bool MergeInTypeInfo(TypeSetByHwMode &Out, ValueTypeByHwMode InVT) const {
+  bool MergeInTypeInfo(TypeSetByHwMode &Out,
+                       const ValueTypeByHwMode &InVT) const {
     return MergeInTypeInfo(Out, TypeSetByHwMode(InVT));
   }
 
@@ -841,7 +842,8 @@ class TreePatternNode : public RefCountedBase<TreePatternNode> {
                       TreePattern &TP);
   bool UpdateNodeType(unsigned ResNo, MVT::SimpleValueType InTy,
                       TreePattern &TP);
-  bool UpdateNodeType(unsigned ResNo, ValueTypeByHwMode InTy, TreePattern &TP);
+  bool UpdateNodeType(unsigned ResNo, const ValueTypeByHwMode &InTy,
+                      TreePattern &TP);
 
   // Update node type with types inferred from an instruction operand or result
   // def from the ins/outs lists.
@@ -996,7 +998,7 @@ inline bool TreePatternNode::UpdateNodeType(unsigned ResNo,
 }
 
 inline bool TreePatternNode::UpdateNodeType(unsigned ResNo,
-                                            ValueTypeByHwMode InTy,
+                                            const ValueTypeByHwMode &InTy,
                                             TreePattern &TP) {
   TypeSetByHwMode VTS(InTy);
   TP.getInfer().expandOverloads(VTS);


        


More information about the llvm-commits mailing list