[PATCH] D110182: [LiveIntervals] Find better anchoring end points when repairing ranges

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 24 07:43:01 PDT 2021


foad updated this revision to Diff 374849.
foad added a comment.
Herald added a subscriber: arphaman.

Add test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110182/new/

https://reviews.llvm.org/D110182

Files:
  llvm/lib/CodeGen/LiveIntervals.cpp
  llvm/lib/CodeGen/SlotIndexes.cpp
  llvm/test/CodeGen/Hexagon/mulhs.ll


Index: llvm/test/CodeGen/Hexagon/mulhs.ll
===================================================================
--- llvm/test/CodeGen/Hexagon/mulhs.ll
+++ llvm/test/CodeGen/Hexagon/mulhs.ll
@@ -1,4 +1,5 @@
 ; RUN: llc -march=hexagon < %s | FileCheck %s
+; RUN: llc -march=hexagon -early-live-intervals -verify-machineinstrs < %s | FileCheck %s
 
 ; CHECK: mpy
 ; CHECK-NOT: call
Index: llvm/lib/CodeGen/SlotIndexes.cpp
===================================================================
--- llvm/lib/CodeGen/SlotIndexes.cpp
+++ llvm/lib/CodeGen/SlotIndexes.cpp
@@ -179,21 +179,12 @@
 void SlotIndexes::repairIndexesInRange(MachineBasicBlock *MBB,
                                        MachineBasicBlock::iterator Begin,
                                        MachineBasicBlock::iterator End) {
-  // FIXME: Is this really necessary? The only caller repairIntervalsForRange()
-  // does the same thing.
-  // Find anchor points, which are at the beginning/end of blocks or at
-  // instructions that already have indexes.
-  while (Begin != MBB->begin() && !hasIndex(*Begin))
-    --Begin;
-  while (End != MBB->end() && !hasIndex(*End))
-    ++End;
-
   bool includeStart = (Begin == MBB->begin());
   SlotIndex startIdx;
   if (includeStart)
     startIdx = getMBBStartIdx(MBB);
   else
-    startIdx = getInstructionIndex(*Begin);
+    startIdx = getInstructionIndex(*--Begin);
 
   SlotIndex endIdx;
   if (End == MBB->end())
Index: llvm/lib/CodeGen/LiveIntervals.cpp
===================================================================
--- llvm/lib/CodeGen/LiveIntervals.cpp
+++ llvm/lib/CodeGen/LiveIntervals.cpp
@@ -1664,7 +1664,7 @@
                                       ArrayRef<Register> OrigRegs) {
   // Find anchor points, which are at the beginning/end of blocks or at
   // instructions that already have indexes.
-  while (Begin != MBB->begin() && !Indexes->hasIndex(*Begin))
+  while (Begin != MBB->begin() && !Indexes->hasIndex(*std::prev(Begin)))
     --Begin;
   while (End != MBB->end() && !Indexes->hasIndex(*End))
     ++End;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110182.374849.patch
Type: text/x-patch
Size: 2049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210924/511c23e0/attachment.bin>


More information about the llvm-commits mailing list