tablegen: Add a simple heuristic to get better names for pressure sets
authorMatthias Braun <matze@braunis.de>
Fri, 13 Nov 2015 22:30:27 +0000 (22:30 +0000)
committerMatthias Braun <matze@braunis.de>
Fri, 13 Nov 2015 22:30:27 +0000 (22:30 +0000)
Differential Revision: http://reviews.llvm.org/D14597

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253095 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/CodeGenRegisters.cpp

index f6eadce..0181f15 100644 (file)
@@ -1574,6 +1574,12 @@ void CodeGenRegBank::pruneUnitSets() {
           && UnitWeight == RegUnits[SuperSet.Units.back()].Weight) {
         DEBUG(dbgs() << "UnitSet " << SubIdx << " subsumed by " << SuperIdx
               << "\n");
+        // We can pick any of the set names for the merged set. Go for the
+        // shortest one to avoid picking the name of one of the classes that are
+        // artificially created by tablegen. So "FPR128_lo" instead of
+        // "QQQQ_with_qsub3_in_FPR128_lo".
+        if (RegUnitSets[SubIdx].Name.size() < RegUnitSets[SuperIdx].Name.size())
+          RegUnitSets[SuperIdx].Name = RegUnitSets[SubIdx].Name;
         break;
       }
     }