OSDN Git Service

[WebAssembly] Speed up LiveIntervals updating.
authorDan Gohman <dan433584@gmail.com>
Mon, 23 May 2016 17:42:57 +0000 (17:42 +0000)
committerDan Gohman <dan433584@gmail.com>
Mon, 23 May 2016 17:42:57 +0000 (17:42 +0000)
Use the more specific LiveInterval::removeSegment instead of
LiveInterval::shrinkToUses when we know the specific range that's
being removed.

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

lib/Target/WebAssembly/WebAssemblyRegStackify.cpp

index 4a0359a..12431be 100644 (file)
@@ -126,7 +126,9 @@ static void Query(const MachineInstr *MI, AliasAnalysis &AA,
                   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, MachineInstr *Def,
   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(unsigned Reg, MachineOperand& Op,
 
     // 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, MachineOperand &Op, MachineInstr *Def,
 ///    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.