[llvm] r270463 - [WebAssembly] Speed up LiveIntervals updating.

Dan Gohman via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 10:43:01 PDT 2016


Author: djg
Date: Mon May 23 12:42:57 2016
New Revision: 270463

URL: http://llvm.org/viewvc/llvm-project?rev=270463&view=rev
Log:
[WebAssembly] Speed up LiveIntervals updating.

Use the more specific LiveInterval::removeSegment instead of
LiveInterval::shrinkToUses when we know the specific range that's
being removed.

Modified:
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp?rev=270463&r1=270462&r2=270463&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp Mon May 23 12:42:57 2016
@@ -126,7 +126,9 @@ static void Query(const MachineInstr *MI
                   bool &Read, bool &Write, bool &Effects, bool &StackPointer) {
   assert(!MI->isPosition());
   assert(!MI->isTerminator());
-  assert(!MI->isDebugValue());
+
+  if (MI->isDebugValue())
+    return;
 
   // Check for loads.
   if (MI->mayLoad() && !MI->isInvariantLoad(&AA))
@@ -255,7 +257,7 @@ static bool HasOneUse(unsigned Reg, Mach
   const VNInfo *DefVNI = LI.getVNInfoAt(
       LIS.getInstructionIndex(*Def).getRegSlot());
   assert(DefVNI);
-  for (auto I : MRI.use_operands(Reg)) {
+  for (auto I : MRI.use_nodbg_operands(Reg)) {
     const auto &Result = LI.Query(LIS.getInstructionIndex(*I.getParent()));
     if (Result.valueIn() == DefVNI) {
       if (!Result.isKill())
@@ -458,8 +460,9 @@ static MachineInstr *MoveForSingleUse(un
 
     // Tell LiveIntervals about the changes to the old register.
     LiveInterval &LI = LIS.getInterval(Reg);
-    LIS.removeVRegDefAt(LI, LIS.getInstructionIndex(*Def).getRegSlot());
-    ShrinkToUses(LI, LIS);
+    LI.removeSegment(LIS.getInstructionIndex(*Def).getRegSlot(),
+                     LIS.getInstructionIndex(*Op.getParent()).getRegSlot(),
+                     /*RemoveDeadValNo=*/true);
 
     MFI.stackifyVReg(NewReg);
 
@@ -528,8 +531,8 @@ RematerializeCheapDef(unsigned Reg, Mach
 ///    DefReg = INST ...     // Def (to become the new Insert)
 ///    TeeReg, Reg = TEE_LOCAL_... DefReg
 ///    INST ..., TeeReg, ... // Insert
-///    INST ..., NewReg, ...
-///    INST ..., NewReg, ...
+///    INST ..., Reg, ...
+///    INST ..., Reg, ...
 ///
 /// with DefReg and TeeReg stackified. This eliminates a get_local from the
 /// resulting code.




More information about the llvm-commits mailing list