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

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 21 09:13:28 PDT 2021


foad created this revision.
Herald added subscribers: hiraditya, MatzeB.
foad requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

r175673 changed repairIntervalsInRange to find anchoring end points for
ranges automatically, but the calculation of Begin included the first
instruction found that already had an index. This patch changes it to
exclude that instruction:

1. For symmetry, so that the half open range [Begin,End) only includes instructions that do not already have indexes.
2. As a possible performance improvement, since repairIndexesInRange will scan fewer instructions.
3. As a tiny step towards fixing -early-live-intervals. This patch fixes a few assertion failures in existing lit tests when -early-live-intervals is forced on, but those tests still fail for other reasons.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110182

Files:
  llvm/lib/CodeGen/LiveIntervals.cpp


Index: llvm/lib/CodeGen/LiveIntervals.cpp
===================================================================
--- llvm/lib/CodeGen/LiveIntervals.cpp
+++ llvm/lib/CodeGen/LiveIntervals.cpp
@@ -1665,7 +1665,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.373962.patch
Type: text/x-patch
Size: 619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210921/dd418c93/attachment.bin>


More information about the llvm-commits mailing list