[llvm] 24f8d10 - [TableGen] Add an explicit cast to allow one TypeSetByHwMode constructor to be removed. NFC

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


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

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

LOG: [TableGen] Add an explicit cast to allow one TypeSetByHwMode constructor to be removed. NFC

This constructor was taking a ValueTypeByMode by value to create
an ArrayRef. By adding an explicit cast from ValueTypeByHwMode
to TypeSetByHwMode we allow the ArrayRef to be implicitly converted
from a single element.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h
index 2f1b9aadd9ea9..b4de20bb13184 100644
--- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h
+++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h
@@ -193,8 +193,6 @@ struct TypeSetByHwMode : public InfoByHwMode<MachineValueTypeSet> {
   TypeSetByHwMode &operator=(const TypeSetByHwMode &) = default;
   TypeSetByHwMode(MVT::SimpleValueType VT)
       : TypeSetByHwMode(ValueTypeByHwMode(VT)) {}
-  TypeSetByHwMode(ValueTypeByHwMode VT)
-      : TypeSetByHwMode(ArrayRef<ValueTypeByHwMode>(&VT, 1)) {}
   TypeSetByHwMode(ArrayRef<ValueTypeByHwMode> VTList);
 
   SetType &getOrCreate(unsigned Mode) { return Map[Mode]; }

diff  --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index c29cb4edec181..2ebe8f75cd6fe 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -1162,7 +1162,7 @@ Error GlobalISelEmitter::importChildMatcher(
       OperandMatcher &OM =
           InsnOperand.getInsnMatcher().addOperand(0, "", TempOpIdx);
       if (auto Error =
-              OM.addTypeCheckPredicate(VTy, false /* OperandIsAPointer */))
+              OM.addTypeCheckPredicate(TypeSetByHwMode(VTy), false /* OperandIsAPointer */))
         return failedImport(toString(std::move(Error)) +
                             " for result of Src pattern operator");
 


        


More information about the llvm-commits mailing list