From: Jay Foad Date: Thu, 4 Nov 2021 13:43:09 +0000 (+0000) Subject: [TwoAddressInstructionPass] Update existing physreg live intervals X-Git-Tag: upstream/15.0.7~26581 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bdaa181007a46d317a1665acb8234eddeee82815;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp index fdd2bc6..ca7d7e9 100644 --- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -1539,15 +1539,23 @@ TwoAddressInstructionPass::processTiedPairs(MachineInstr *MI, 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)); + } } } } diff --git a/llvm/test/CodeGen/ARM/inlineasm-operand-implicit-cast.ll b/llvm/test/CodeGen/ARM/inlineasm-operand-implicit-cast.ll index 8ae9f70..61e2872 100644 --- a/llvm/test/CodeGen/ARM/inlineasm-operand-implicit-cast.ll +++ b/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 } diff --git a/llvm/test/CodeGen/Thumb/emergency-spill-slot.ll b/llvm/test/CodeGen/Thumb/emergency-spill-slot.ll index f61390c..5661c82 100644 --- a/llvm/test/CodeGen/Thumb/emergency-spill-slot.ll +++ b/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) { diff --git a/llvm/test/CodeGen/X86/inline-asm-A-constraint.ll b/llvm/test/CodeGen/X86/inline-asm-A-constraint.ll index d8e4447..f07a13c 100644 --- a/llvm/test/CodeGen/X86/inline-asm-A-constraint.ll +++ b/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--"