[llvm] d91f65e - [TableGen] Filter duplicate predicates in PatternToMatch::getPredicateRecords.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 13:32:30 PDT 2023


Author: Craig Topper
Date: 2023-05-23T13:32:18-07:00
New Revision: d91f65ea36fa980d82b45392a0664ef60659067f

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

LOG: [TableGen] Filter duplicate predicates in PatternToMatch::getPredicateRecords.

Recent changes to RISC-V cause the same predicate to appear in the
predicate list multiple times in some cases. This patch filters the
duplicates to reduce the number of predicate string variations.

Added: 
    

Modified: 
    llvm/utils/TableGen/CodeGenDAGPatterns.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index 1ce735c824159..be0a5c24c35cf 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -1495,6 +1495,9 @@ void PatternToMatch::getPredicateRecords(
   }
   // Sort so that 
diff erent orders get canonicalized to the same string.
   llvm::sort(PredicateRecs, LessRecord());
+  // Remove duplicate predicates.
+  PredicateRecs.erase(std::unique(PredicateRecs.begin(), PredicateRecs.end()),
+                      PredicateRecs.end());
 }
 
 /// getPredicateCheck - Return a single string containing all of this


        


More information about the llvm-commits mailing list