Skip to content

Commit ec0e1e8

Browse files
committed
[TwoAddressInstructionPass] Update existing physreg live intervals
In TwoAddressInstructionPass::processTiedPairs with -early-live-intervals, update any preexisting physreg live intervals, as well as virtreg live intervals. By default (without -precompute-phys-liveness) physreg live intervals only exist for registers that are live-in to some basic block. Differential Revision: https://reviews.llvm.org/D113191
1 parent 020ca17 commit ec0e1e8

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

llvm/lib/CodeGen/TwoAddressInstructionPass.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,15 +1539,23 @@ TwoAddressInstructionPass::processTiedPairs(MachineInstr *MI,
15391539
if (LIS) {
15401540
LastCopyIdx = LIS->InsertMachineInstrInMaps(*PrevMI).getRegSlot();
15411541

1542+
SlotIndex endIdx =
1543+
LIS->getInstructionIndex(*MI).getRegSlot(IsEarlyClobber);
15421544
if (RegA.isVirtual()) {
15431545
LiveInterval &LI = LIS->getInterval(RegA);
15441546
VNInfo *VNI = LI.getNextValue(LastCopyIdx, LIS->getVNInfoAllocator());
1545-
SlotIndex endIdx =
1546-
LIS->getInstructionIndex(*MI).getRegSlot(IsEarlyClobber);
1547-
LI.addSegment(LiveInterval::Segment(LastCopyIdx, endIdx, VNI));
1547+
LI.addSegment(LiveRange::Segment(LastCopyIdx, endIdx, VNI));
15481548
for (auto &S : LI.subranges()) {
15491549
VNI = S.getNextValue(LastCopyIdx, LIS->getVNInfoAllocator());
1550-
S.addSegment(LiveInterval::Segment(LastCopyIdx, endIdx, VNI));
1550+
S.addSegment(LiveRange::Segment(LastCopyIdx, endIdx, VNI));
1551+
}
1552+
} else {
1553+
for (MCRegUnitIterator Unit(RegA, TRI); Unit.isValid(); ++Unit) {
1554+
if (LiveRange *LR = LIS->getCachedRegUnit(*Unit)) {
1555+
VNInfo *VNI =
1556+
LR->getNextValue(LastCopyIdx, LIS->getVNInfoAllocator());
1557+
LR->addSegment(LiveRange::Segment(LastCopyIdx, endIdx, VNI));
1558+
}
15511559
}
15521560
}
15531561
}

llvm/test/CodeGen/ARM/inlineasm-operand-implicit-cast.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc -mtriple armv7-arm-linux-gnueabihf -O2 -mcpu=cortex-a7 < %s | FileCheck %s
2+
; RUN: llc -mtriple armv7-arm-linux-gnueabihf -O2 -mcpu=cortex-a7 -early-live-intervals < %s | FileCheck %s
23

34
%struct.twofloat = type { float, float }
45
%struct.twodouble = type { double, double }

llvm/test/CodeGen/Thumb/emergency-spill-slot.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
22
; RUN: llc < %s | FileCheck %s
3+
; RUN: llc -early-live-intervals < %s | FileCheck %s
34
target triple = "thumbv6m-unknown-unknown-eabi"
45

56
define void @vla_emergency_spill(i32 %n) {

llvm/test/CodeGen/X86/inline-asm-A-constraint.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc -mtriple=x86_64-- < %s | FileCheck %s
2+
; RUN: llc -mtriple=x86_64-- -early-live-intervals < %s | FileCheck %s
23

34
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
45
target triple = "x86_64--"

0 commit comments

Comments
 (0)