[PATCH] D113191: [TwoAddressInstructionPass] Update existing physreg live intervals

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 5 02:51:40 PDT 2021


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGec0e1e88d24f: [TwoAddressInstructionPass] Update existing physreg live intervals (authored by foad).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113191

Files:
  llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
  llvm/test/CodeGen/ARM/inlineasm-operand-implicit-cast.ll
  llvm/test/CodeGen/Thumb/emergency-spill-slot.ll
  llvm/test/CodeGen/X86/inline-asm-A-constraint.ll


Index: llvm/test/CodeGen/X86/inline-asm-A-constraint.ll
===================================================================
--- llvm/test/CodeGen/X86/inline-asm-A-constraint.ll
+++ llvm/test/CodeGen/X86/inline-asm-A-constraint.ll
@@ -1,4 +1,5 @@
 ; RUN: llc -mtriple=x86_64-- < %s | FileCheck %s
+; RUN: llc -mtriple=x86_64-- -early-live-intervals < %s | FileCheck %s
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64--"
Index: llvm/test/CodeGen/Thumb/emergency-spill-slot.ll
===================================================================
--- llvm/test/CodeGen/Thumb/emergency-spill-slot.ll
+++ llvm/test/CodeGen/Thumb/emergency-spill-slot.ll
@@ -1,5 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s | FileCheck %s
+; RUN: llc -early-live-intervals < %s | FileCheck %s
 target triple = "thumbv6m-unknown-unknown-eabi"
 
 define void @vla_emergency_spill(i32 %n) {
Index: llvm/test/CodeGen/ARM/inlineasm-operand-implicit-cast.ll
===================================================================
--- llvm/test/CodeGen/ARM/inlineasm-operand-implicit-cast.ll
+++ llvm/test/CodeGen/ARM/inlineasm-operand-implicit-cast.ll
@@ -1,4 +1,5 @@
 ; RUN: llc -mtriple armv7-arm-linux-gnueabihf -O2 -mcpu=cortex-a7 < %s | FileCheck %s
+; RUN: llc -mtriple armv7-arm-linux-gnueabihf -O2 -mcpu=cortex-a7 -early-live-intervals < %s | FileCheck %s
 
 %struct.twofloat = type { float, float }
 %struct.twodouble = type { double, double }
Index: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
===================================================================
--- llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -1539,15 +1539,23 @@
     if (LIS) {
       LastCopyIdx = LIS->InsertMachineInstrInMaps(*PrevMI).getRegSlot();
 
+      SlotIndex endIdx =
+          LIS->getInstructionIndex(*MI).getRegSlot(IsEarlyClobber);
       if (RegA.isVirtual()) {
         LiveInterval &LI = LIS->getInterval(RegA);
         VNInfo *VNI = LI.getNextValue(LastCopyIdx, LIS->getVNInfoAllocator());
-        SlotIndex endIdx =
-            LIS->getInstructionIndex(*MI).getRegSlot(IsEarlyClobber);
-        LI.addSegment(LiveInterval::Segment(LastCopyIdx, endIdx, VNI));
+        LI.addSegment(LiveRange::Segment(LastCopyIdx, endIdx, VNI));
         for (auto &S : LI.subranges()) {
           VNI = S.getNextValue(LastCopyIdx, LIS->getVNInfoAllocator());
-          S.addSegment(LiveInterval::Segment(LastCopyIdx, endIdx, VNI));
+          S.addSegment(LiveRange::Segment(LastCopyIdx, endIdx, VNI));
+        }
+      } else {
+        for (MCRegUnitIterator Unit(RegA, TRI); Unit.isValid(); ++Unit) {
+          if (LiveRange *LR = LIS->getCachedRegUnit(*Unit)) {
+            VNInfo *VNI =
+                LR->getNextValue(LastCopyIdx, LIS->getVNInfoAllocator());
+            LR->addSegment(LiveRange::Segment(LastCopyIdx, endIdx, VNI));
+          }
         }
       }
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113191.384999.patch
Type: text/x-patch
Size: 2999 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211105/8f64b294/attachment.bin>


More information about the llvm-commits mailing list