[llvm] [TableGen] Handle duplicate rules in combiners (PR #69296)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 17 01:39:19 PDT 2023


================
@@ -3627,27 +3631,35 @@ void GICombinerEmitter::gatherRules(
     std::vector<RuleMatcher> &ActiveRules,
     const std::vector<Record *> &&RulesAndGroups) {
   for (Record *Rec : RulesAndGroups) {
-    if (Rec->isValueUnset("Rules")) {
-      AllCombineRules.emplace_back(NextRuleID, Rec->getName().str());
-      CombineRuleBuilder CRB(Target, SubtargetFeatures, *Rec, NextRuleID++,
-                             ActiveRules);
+    if (!Rec->isValueUnset("Rules")) {
+      gatherRules(ActiveRules, Rec->getValueAsListOfDefs("Rules"));
+      continue;
+    }
 
-      if (!CRB.parseAll()) {
-        assert(ErrorsPrinted && "Parsing failed without errors!");
-        continue;
-      }
+    StringRef RuleName = Rec->getName();
+    if(!RulesSeen.insert(RuleName).second) {
----------------
jayfoad wrote:

I guess clang-format will complain:
```suggestion
    if (!RulesSeen.insert(RuleName).second) {
```

https://github.com/llvm/llvm-project/pull/69296


More information about the llvm-commits mailing list