[llvm] 3c0f871 - [X86][fold-table] Add an assertion in addEntryWithFlags, NFCI

Shengchen Kan via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 05:48:37 PST 2023


Author: Shengchen Kan
Date: 2023-11-28T21:47:57+08:00
New Revision: 3c0f87147d0e5904ab469381329f4661cf17a024

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

LOG: [X86][fold-table] Add an assertion in addEntryWithFlags, NFCI

Added: 
    

Modified: 
    llvm/utils/TableGen/X86FoldTablesEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/X86FoldTablesEmitter.cpp b/llvm/utils/TableGen/X86FoldTablesEmitter.cpp
index 83b9ce5e386c657..adcf67e8c3cc538 100644
--- a/llvm/utils/TableGen/X86FoldTablesEmitter.cpp
+++ b/llvm/utils/TableGen/X86FoldTablesEmitter.cpp
@@ -171,7 +171,7 @@ class X86FoldTablesEmitter {
   // the appropriate flags - then adds it to Table.
   void addEntryWithFlags(FoldTable &Table, const CodeGenInstruction *RegInst,
                          const CodeGenInstruction *MemInst, uint16_t S,
-                         unsigned FoldedIdx, bool isManual);
+                         unsigned FoldedIdx, bool IsManual);
 
   // Print the given table as a static const C++ array of type
   // X86FoldTableEntry.
@@ -391,8 +391,10 @@ void X86FoldTablesEmitter::addEntryWithFlags(FoldTable &Table,
                                              const CodeGenInstruction *RegInst,
                                              const CodeGenInstruction *MemInst,
                                              uint16_t S, unsigned FoldedIdx,
-                                             bool isManual) {
+                                             bool IsManual) {
 
+  assert((IsManual || Table.find(RegInst) == Table.end()) &&
+         "Override entry unexpectedly");
   X86FoldTableEntry Result = X86FoldTableEntry(RegInst, MemInst);
   Record *RegRec = RegInst->TheDef;
   Record *MemRec = MemInst->TheDef;
@@ -402,7 +404,7 @@ void X86FoldTablesEmitter::addEntryWithFlags(FoldTable &Table,
   Result.FoldLoad = S & TB_FOLDED_LOAD;
   Result.FoldStore = S & TB_FOLDED_STORE;
   Result.Alignment = Align(1ULL << ((S & TB_ALIGN_MASK) >> TB_ALIGN_SHIFT));
-  if (isManual) {
+  if (IsManual) {
     Table[RegInst] = Result;
     return;
   }


        


More information about the llvm-commits mailing list