[PATCH] D52010: RegAllocFast: Rewrite and improve

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 13 02:45:23 PDT 2018


arsenm added inline comments.


================
Comment at: lib/CodeGen/RegAllocFast.cpp:164-169
     enum : unsigned {
-      spillClean = 1,
+      spillClean = 50,
       spillDirty = 100,
+      spillPrefBonus = 20,
       spillImpossible = ~0u
     };
----------------
Should comment meaning / reason for these values?


================
Comment at: lib/CodeGen/RegAllocFast.cpp:291-297
+static MachineBasicBlock::iterator
+getMBBBeginInsertionPoint(MachineBasicBlock &MBB) {
+  MachineBasicBlock::iterator I = MBB.begin();
+  while (I != MBB.end() && I->isLabel())
+    ++I;
+  return I;
 }
----------------
Isn't this SkipPHIsAndLabels without the handling of isBasicBlockPrologue?


================
Comment at: lib/CodeGen/RegAllocFast.cpp:449
+    MachineInstr *VRegDef = MRI->getUniqueVRegDef(Reg);
+    if (VRegDef == nullptr || !isCoalescable(*VRegDef))
+      return 0;
----------------
!VRegDef


================
Comment at: lib/CodeGen/RegAllocFast.cpp:460
+unsigned RegAllocFast::traceCopies(unsigned VirtReg) const {
+  static const unsigned DefLimit = 3;
+  unsigned C = 0;
----------------
static unnecessary?


================
Comment at: lib/CodeGen/RegAllocFast.cpp:502-503
+      assignVirtToPhysReg(*LRI, Hint0);
+      return;
+    } else {
+      LLVM_DEBUG(dbgs() << "\tPreferred Register 0: " << printReg(Hint0, TRI)
----------------
return after else


Repository:
  rL LLVM

https://reviews.llvm.org/D52010





More information about the llvm-commits mailing list