2012-02-17 17:35:10 +00:00
|
|
|
//===-- LiveRangeEdit.cpp - Basic tools for editing a register live range -===//
|
2010-10-14 23:49:52 +00:00
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2010-10-14 23:49:52 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// The LiveRangeEdit class represents changes done to a virtual register when it
|
|
|
|
// is spilled or split.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-12-03 16:50:05 +00:00
|
|
|
#include "llvm/CodeGen/LiveRangeEdit.h"
|
2011-05-05 17:22:53 +00:00
|
|
|
#include "llvm/ADT/Statistic.h"
|
2011-03-29 21:20:19 +00:00
|
|
|
#include "llvm/CodeGen/CalcSpillWeights.h"
|
2017-12-13 02:51:04 +00:00
|
|
|
#include "llvm/CodeGen/LiveIntervals.h"
|
2010-10-14 23:49:52 +00:00
|
|
|
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
2017-11-08 01:01:31 +00:00
|
|
|
#include "llvm/CodeGen/TargetInstrInfo.h"
|
2012-11-28 19:13:06 +00:00
|
|
|
#include "llvm/CodeGen/VirtRegMap.h"
|
2011-03-08 22:46:11 +00:00
|
|
|
#include "llvm/Support/Debug.h"
|
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2010-10-14 23:49:52 +00:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2014-04-22 02:02:50 +00:00
|
|
|
#define DEBUG_TYPE "regalloc"
|
|
|
|
|
2022-09-30 19:39:51 +00:00
|
|
|
STATISTIC(NumDCEDeleted, "Number of instructions deleted by DCE");
|
|
|
|
STATISTIC(NumDCEFoldedLoads, "Number of single use loads folded after DCE");
|
|
|
|
STATISTIC(NumFracRanges, "Number of live ranges fractured by DCE");
|
|
|
|
STATISTIC(NumReMaterialization, "Number of instructions rematerialized");
|
2011-05-05 17:22:53 +00:00
|
|
|
|
2011-12-20 02:50:00 +00:00
|
|
|
void LiveRangeEdit::Delegate::anchor() { }
|
|
|
|
|
2020-06-30 11:57:24 -04:00
|
|
|
LiveInterval &LiveRangeEdit::createEmptyIntervalFrom(Register OldReg,
|
2018-01-10 21:41:02 +00:00
|
|
|
bool createSubRanges) {
|
Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM
Summary:
This clang-tidy check is looking for unsigned integer variables whose initializer
starts with an implicit cast from llvm::Register and changes the type of the
variable to llvm::Register (dropping the llvm:: where possible).
Partial reverts in:
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
X86FixupLEAs.cpp - Some functions return unsigned and arguably should be MCRegister
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
HexagonBitSimplify.cpp - Function takes BitTracker::RegisterRef which appears to be unsigned&
MachineVerifier.cpp - Ambiguous operator==() given MCRegister and const Register
PPCFastISel.cpp - No Register::operator-=()
PeepholeOptimizer.cpp - TargetInstrInfo::optimizeLoadInstr() takes an unsigned&
MachineTraceMetrics.cpp - MachineTraceMetrics lacks a suitable constructor
Manual fixups in:
ARMFastISel.cpp - ARMEmitLoad() now takes a Register& instead of unsigned&
HexagonSplitDouble.cpp - Ternary operator was ambiguous between unsigned/Register
HexagonConstExtenders.cpp - Has a local class named Register, used llvm::Register instead of Register.
PPCFastISel.cpp - PPCEmitLoad() now takes a Register& instead of unsigned&
Depends on D65919
Reviewers: arsenm, bogner, craig.topper, RKSimon
Reviewed By: arsenm
Subscribers: RKSimon, craig.topper, lenary, aemerson, wuzish, jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65962
llvm-svn: 369041
2019-08-15 19:22:08 +00:00
|
|
|
Register VReg = MRI.createVirtualRegister(MRI.getRegClass(OldReg));
|
2018-01-10 21:41:02 +00:00
|
|
|
if (VRM)
|
2012-04-03 00:28:46 +00:00
|
|
|
VRM->setIsSplitFromReg(VReg, VRM->getOriginal(OldReg));
|
2018-01-10 21:41:02 +00:00
|
|
|
|
2013-08-14 23:50:16 +00:00
|
|
|
LiveInterval &LI = LIS.createEmptyInterval(VReg);
|
2017-02-02 20:44:36 +00:00
|
|
|
if (Parent && !Parent->isSpillable())
|
|
|
|
LI.markNotSpillable();
|
2018-01-10 21:41:02 +00:00
|
|
|
if (createSubRanges) {
|
|
|
|
// Create empty subranges if the OldReg's interval has them. Do not create
|
|
|
|
// the main range here---it will be constructed later after the subranges
|
|
|
|
// have been finalized.
|
|
|
|
LiveInterval &OldLI = LIS.getInterval(OldReg);
|
|
|
|
VNInfo::Allocator &Alloc = LIS.getVNInfoAllocator();
|
|
|
|
for (LiveInterval::SubRange &S : OldLI.subranges())
|
|
|
|
LI.createSubRange(Alloc, S.LaneMask);
|
|
|
|
}
|
2011-03-17 20:37:07 +00:00
|
|
|
return LI;
|
2010-10-14 23:49:52 +00:00
|
|
|
}
|
|
|
|
|
2020-06-30 11:57:24 -04:00
|
|
|
Register LiveRangeEdit::createFrom(Register OldReg) {
|
Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM
Summary:
This clang-tidy check is looking for unsigned integer variables whose initializer
starts with an implicit cast from llvm::Register and changes the type of the
variable to llvm::Register (dropping the llvm:: where possible).
Partial reverts in:
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
X86FixupLEAs.cpp - Some functions return unsigned and arguably should be MCRegister
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
HexagonBitSimplify.cpp - Function takes BitTracker::RegisterRef which appears to be unsigned&
MachineVerifier.cpp - Ambiguous operator==() given MCRegister and const Register
PPCFastISel.cpp - No Register::operator-=()
PeepholeOptimizer.cpp - TargetInstrInfo::optimizeLoadInstr() takes an unsigned&
MachineTraceMetrics.cpp - MachineTraceMetrics lacks a suitable constructor
Manual fixups in:
ARMFastISel.cpp - ARMEmitLoad() now takes a Register& instead of unsigned&
HexagonSplitDouble.cpp - Ternary operator was ambiguous between unsigned/Register
HexagonConstExtenders.cpp - Has a local class named Register, used llvm::Register instead of Register.
PPCFastISel.cpp - PPCEmitLoad() now takes a Register& instead of unsigned&
Depends on D65919
Reviewers: arsenm, bogner, craig.topper, RKSimon
Reviewed By: arsenm
Subscribers: RKSimon, craig.topper, lenary, aemerson, wuzish, jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65962
llvm-svn: 369041
2019-08-15 19:22:08 +00:00
|
|
|
Register VReg = MRI.createVirtualRegister(MRI.getRegClass(OldReg));
|
2013-08-14 23:50:16 +00:00
|
|
|
if (VRM) {
|
|
|
|
VRM->setIsSplitFromReg(VReg, VRM->getOriginal(OldReg));
|
|
|
|
}
|
2017-02-02 20:44:36 +00:00
|
|
|
// FIXME: Getting the interval here actually computes it.
|
|
|
|
// In theory, this may not be what we want, but in practice
|
|
|
|
// the createEmptyIntervalFrom API is used when this is not
|
|
|
|
// the case. Generally speaking we just want to annotate the
|
|
|
|
// LiveInterval when it gets created but we cannot do that at
|
|
|
|
// the moment.
|
|
|
|
if (Parent && !Parent->isSpillable())
|
|
|
|
LIS.getInterval(VReg).markNotSpillable();
|
2013-08-14 23:50:16 +00:00
|
|
|
return VReg;
|
|
|
|
}
|
|
|
|
|
2011-04-20 22:14:20 +00:00
|
|
|
bool LiveRangeEdit::checkRematerializable(VNInfo *VNI,
|
2022-06-24 12:09:34 -04:00
|
|
|
const MachineInstr *DefMI) {
|
2011-03-29 03:12:02 +00:00
|
|
|
assert(DefMI && "Missing instruction");
|
2012-05-18 22:10:15 +00:00
|
|
|
ScannedRemattable = true;
|
2022-06-24 12:09:34 -04:00
|
|
|
if (!TII.isTriviallyReMaterializable(*DefMI))
|
2011-04-20 22:14:20 +00:00
|
|
|
return false;
|
2012-05-18 22:10:15 +00:00
|
|
|
Remattable.insert(VNI);
|
2011-04-20 22:14:20 +00:00
|
|
|
return true;
|
2011-03-29 03:12:02 +00:00
|
|
|
}
|
|
|
|
|
2022-06-24 12:09:34 -04:00
|
|
|
void LiveRangeEdit::scanRemattable() {
|
2014-12-10 23:07:54 +00:00
|
|
|
for (VNInfo *VNI : getParent().valnos) {
|
2010-10-20 22:00:51 +00:00
|
|
|
if (VNI->isUnused())
|
|
|
|
continue;
|
2016-04-13 03:08:27 +00:00
|
|
|
unsigned Original = VRM->getOriginal(getReg());
|
|
|
|
LiveInterval &OrigLI = LIS.getInterval(Original);
|
|
|
|
VNInfo *OrigVNI = OrigLI.getVNInfoAt(VNI->def);
|
2016-08-24 13:37:55 +00:00
|
|
|
if (!OrigVNI)
|
|
|
|
continue;
|
2016-04-13 03:08:27 +00:00
|
|
|
MachineInstr *DefMI = LIS.getInstructionFromIndex(OrigVNI->def);
|
2010-10-20 22:00:51 +00:00
|
|
|
if (!DefMI)
|
|
|
|
continue;
|
2022-06-24 12:09:34 -04:00
|
|
|
checkRematerializable(OrigVNI, DefMI);
|
2010-10-20 22:00:51 +00:00
|
|
|
}
|
2012-05-18 22:10:15 +00:00
|
|
|
ScannedRemattable = true;
|
2010-10-20 22:00:51 +00:00
|
|
|
}
|
|
|
|
|
2022-06-24 12:09:34 -04:00
|
|
|
bool LiveRangeEdit::anyRematerializable() {
|
2012-05-18 22:10:15 +00:00
|
|
|
if (!ScannedRemattable)
|
2022-06-24 12:09:34 -04:00
|
|
|
scanRemattable();
|
2012-05-18 22:10:15 +00:00
|
|
|
return !Remattable.empty();
|
2010-10-20 22:00:51 +00:00
|
|
|
}
|
|
|
|
|
2010-10-14 23:49:52 +00:00
|
|
|
/// allUsesAvailableAt - Return true if all registers used by OrigMI at
|
|
|
|
/// OrigIdx are also available with the same value at UseIdx.
|
|
|
|
bool LiveRangeEdit::allUsesAvailableAt(const MachineInstr *OrigMI,
|
|
|
|
SlotIndex OrigIdx,
|
2013-03-18 23:40:46 +00:00
|
|
|
SlotIndex UseIdx) const {
|
2011-11-13 20:45:27 +00:00
|
|
|
OrigIdx = OrigIdx.getRegSlot(true);
|
2021-08-20 10:14:31 -07:00
|
|
|
UseIdx = std::max(UseIdx, UseIdx.getRegSlot(true));
|
2021-11-25 08:55:16 -08:00
|
|
|
for (const MachineOperand &MO : OrigMI->operands()) {
|
2012-06-22 17:31:01 +00:00
|
|
|
if (!MO.isReg() || !MO.getReg() || !MO.readsReg())
|
2010-10-14 23:49:52 +00:00
|
|
|
continue;
|
|
|
|
|
2021-07-12 12:27:34 -07:00
|
|
|
// We can't remat physreg uses, unless it is a constant or target wants
|
|
|
|
// to ignore this use.
|
2019-08-01 23:27:28 +00:00
|
|
|
if (Register::isPhysicalRegister(MO.getReg())) {
|
2021-07-12 12:27:34 -07:00
|
|
|
if (MRI.isConstantPhysReg(MO.getReg()) || TII.isIgnorableUse(MO))
|
2012-06-22 17:31:01 +00:00
|
|
|
continue;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-04-02 22:22:53 +00:00
|
|
|
LiveInterval &li = LIS.getInterval(MO.getReg());
|
2010-10-14 23:49:52 +00:00
|
|
|
const VNInfo *OVNI = li.getVNInfoAt(OrigIdx);
|
|
|
|
if (!OVNI)
|
|
|
|
continue;
|
2012-10-16 22:51:58 +00:00
|
|
|
|
|
|
|
// Don't allow rematerialization immediately after the original def.
|
|
|
|
// It would be incorrect if OrigMI redefines the register.
|
|
|
|
// See PR14098.
|
|
|
|
if (SlotIndex::isSameInstr(OrigIdx, UseIdx))
|
|
|
|
return false;
|
|
|
|
|
2010-10-14 23:49:52 +00:00
|
|
|
if (OVNI != li.getVNInfoAt(UseIdx))
|
|
|
|
return false;
|
2021-12-07 13:10:54 -08:00
|
|
|
|
|
|
|
// Check that subrange is live at UseIdx.
|
Fix subrange liveness checking at rematerialization
This patch fixes an issue where an instruction reading a whole register would be moved during register allocation into a spot where one of the subregisters was dead.
The code to check whether an instruction can be rematerialized at a given point or not was already checking for subranges to ensure that subregisters are live, but only when the instruction being moved was using a subregister, this patch changes that so the subranges are checked even when the moved instruction uses the full register.
This patch also adds a case to the original test for the subrange checking that trigger the issue described above.
The original subrange checking code was introduced in this revision: https://reviews.llvm.org/D115278
And I've encountered this issue on AMDGPUs while working with DPC++: https://github.com/intel/llvm/issues/6209
Essentially the greedy register allocator attempts to move the following instruction:
```
%3961:vreg_64 = V_LSHLREV_B64_e64 3, %3078:vreg_64, implicit $exec
```
From `@3440` into the body of a loop `@16312`, but `%3078` has the following live ranges:
```
%3078 [2224r,2240r:0)[2240r,3488B:1)[16192B,38336B:1) 0@2224r 1@2240r L0000000000000003 [2224r,3440r:0) 0@2224r L000000000000000C [2240r,3488B:0)[16192B,38336B:0) 0@2240r
```
So `@16312e` `%3078.sub1` is alive but `%3078.sub0` is dead, so this instruction being moved there leads to invalid memory accesses as `3078.sub0` ends up being trashed and the result of this instruction is used as part of an address calculation for a load.
On the original ticket this issue showed up on gfx906 and gfx90a but not on gfx908, this turned out to be because on gfx908 instead of moving the shift instruction into the loop, its value is spilled into an ACC register, gfx906 doesn't have ACC registers and for gfx90a ACC registers are used like regular vector registers and so aren't used for spilling.
With this patch the original application from the DPC++ ticket works properly on gfx906, and the result of the shift instruction is correctly spilled instead of moving the instruction in the loop.
Original Author: npmiller
Reviewed by: rampitec
Submitted by: rampitec
Differential Revision: https://reviews.llvm.org/D131884
2022-08-16 10:23:38 -07:00
|
|
|
if (li.hasSubRanges()) {
|
2021-12-07 13:10:54 -08:00
|
|
|
const TargetRegisterInfo *TRI = MRI.getTargetRegisterInfo();
|
Fix subrange liveness checking at rematerialization
This patch fixes an issue where an instruction reading a whole register would be moved during register allocation into a spot where one of the subregisters was dead.
The code to check whether an instruction can be rematerialized at a given point or not was already checking for subranges to ensure that subregisters are live, but only when the instruction being moved was using a subregister, this patch changes that so the subranges are checked even when the moved instruction uses the full register.
This patch also adds a case to the original test for the subrange checking that trigger the issue described above.
The original subrange checking code was introduced in this revision: https://reviews.llvm.org/D115278
And I've encountered this issue on AMDGPUs while working with DPC++: https://github.com/intel/llvm/issues/6209
Essentially the greedy register allocator attempts to move the following instruction:
```
%3961:vreg_64 = V_LSHLREV_B64_e64 3, %3078:vreg_64, implicit $exec
```
From `@3440` into the body of a loop `@16312`, but `%3078` has the following live ranges:
```
%3078 [2224r,2240r:0)[2240r,3488B:1)[16192B,38336B:1) 0@2224r 1@2240r L0000000000000003 [2224r,3440r:0) 0@2224r L000000000000000C [2240r,3488B:0)[16192B,38336B:0) 0@2240r
```
So `@16312e` `%3078.sub1` is alive but `%3078.sub0` is dead, so this instruction being moved there leads to invalid memory accesses as `3078.sub0` ends up being trashed and the result of this instruction is used as part of an address calculation for a load.
On the original ticket this issue showed up on gfx906 and gfx90a but not on gfx908, this turned out to be because on gfx908 instead of moving the shift instruction into the loop, its value is spilled into an ACC register, gfx906 doesn't have ACC registers and for gfx90a ACC registers are used like regular vector registers and so aren't used for spilling.
With this patch the original application from the DPC++ ticket works properly on gfx906, and the result of the shift instruction is correctly spilled instead of moving the instruction in the loop.
Original Author: npmiller
Reviewed by: rampitec
Submitted by: rampitec
Differential Revision: https://reviews.llvm.org/D131884
2022-08-16 10:23:38 -07:00
|
|
|
unsigned SubReg = MO.getSubReg();
|
|
|
|
LaneBitmask LM = SubReg ? TRI->getSubRegIndexLaneMask(SubReg)
|
|
|
|
: MRI.getMaxLaneMaskForVReg(MO.getReg());
|
2021-12-07 13:10:54 -08:00
|
|
|
for (LiveInterval::SubRange &SR : li.subranges()) {
|
|
|
|
if ((SR.LaneMask & LM).none())
|
|
|
|
continue;
|
|
|
|
if (!SR.liveAt(UseIdx))
|
|
|
|
return false;
|
|
|
|
// Early exit if all used lanes are checked. No need to continue.
|
|
|
|
LM &= ~SR.LaneMask;
|
|
|
|
if (LM.none())
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-10-14 23:49:52 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-04-13 03:08:27 +00:00
|
|
|
bool LiveRangeEdit::canRematerializeAt(Remat &RM, VNInfo *OrigVNI,
|
|
|
|
SlotIndex UseIdx, bool cheapAsAMove) {
|
2012-05-18 22:10:15 +00:00
|
|
|
assert(ScannedRemattable && "Call anyRematerializable first");
|
2010-10-20 22:00:51 +00:00
|
|
|
|
|
|
|
// Use scanRemattable info.
|
2016-04-13 03:08:27 +00:00
|
|
|
if (!Remattable.count(OrigVNI))
|
2010-11-10 01:05:12 +00:00
|
|
|
return false;
|
2010-10-20 22:00:51 +00:00
|
|
|
|
2011-03-29 03:12:02 +00:00
|
|
|
// No defining instruction provided.
|
|
|
|
SlotIndex DefIdx;
|
2016-04-13 03:08:27 +00:00
|
|
|
assert(RM.OrigMI && "No defining instruction for remattable value");
|
|
|
|
DefIdx = LIS.getInstructionIndex(*RM.OrigMI);
|
2010-10-20 22:00:51 +00:00
|
|
|
|
|
|
|
// If only cheap remats were requested, bail out early.
|
2016-06-30 00:01:54 +00:00
|
|
|
if (cheapAsAMove && !TII.isAsCheapAsAMove(*RM.OrigMI))
|
2010-11-10 01:05:12 +00:00
|
|
|
return false;
|
2010-10-20 22:00:51 +00:00
|
|
|
|
|
|
|
// Verify that all used registers are available with the same values.
|
2012-04-02 22:22:53 +00:00
|
|
|
if (!allUsesAvailableAt(RM.OrigMI, DefIdx, UseIdx))
|
2010-11-10 01:05:12 +00:00
|
|
|
return false;
|
2010-10-20 22:00:51 +00:00
|
|
|
|
2010-11-10 01:05:12 +00:00
|
|
|
return true;
|
2010-10-20 22:00:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SlotIndex LiveRangeEdit::rematerializeAt(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
unsigned DestReg,
|
|
|
|
const Remat &RM,
|
2011-05-02 05:29:58 +00:00
|
|
|
const TargetRegisterInfo &tri,
|
2022-09-21 17:51:07 +00:00
|
|
|
bool Late,
|
|
|
|
unsigned SubIdx,
|
|
|
|
MachineInstr *ReplaceIndexMI) {
|
2010-10-20 22:00:51 +00:00
|
|
|
assert(RM.OrigMI && "Invalid remat");
|
2022-09-21 17:51:07 +00:00
|
|
|
TII.reMaterialize(MBB, MI, DestReg, SubIdx, *RM.OrigMI, tri);
|
2016-04-13 03:08:27 +00:00
|
|
|
// DestReg of the cloned instruction cannot be Dead. Set isDead of DestReg
|
|
|
|
// to false anyway in case the isDead flag of RM.OrigMI's dest register
|
|
|
|
// is true.
|
|
|
|
(*--MI).getOperand(0).setIsDead(false);
|
2012-05-18 22:10:15 +00:00
|
|
|
Rematted.insert(RM.ParentVNI);
|
2022-09-30 19:39:51 +00:00
|
|
|
++NumReMaterialization;
|
|
|
|
|
2022-09-21 17:51:07 +00:00
|
|
|
if (ReplaceIndexMI)
|
|
|
|
return LIS.ReplaceMachineInstrInMaps(*ReplaceIndexMI, *MI).getRegSlot();
|
2016-04-13 03:08:27 +00:00
|
|
|
return LIS.getSlotIndexes()->insertMachineInstrInMaps(*MI, Late).getRegSlot();
|
2010-10-20 22:00:51 +00:00
|
|
|
}
|
|
|
|
|
2020-06-30 11:57:24 -04:00
|
|
|
void LiveRangeEdit::eraseVirtReg(Register Reg) {
|
2012-05-18 22:10:15 +00:00
|
|
|
if (TheDelegate && TheDelegate->LRE_CanEraseVirtReg(Reg))
|
2011-03-13 01:23:11 +00:00
|
|
|
LIS.removeInterval(Reg);
|
|
|
|
}
|
|
|
|
|
2011-04-05 20:20:26 +00:00
|
|
|
bool LiveRangeEdit::foldAsLoad(LiveInterval *LI,
|
2012-04-02 22:22:53 +00:00
|
|
|
SmallVectorImpl<MachineInstr*> &Dead) {
|
2014-04-14 00:51:57 +00:00
|
|
|
MachineInstr *DefMI = nullptr, *UseMI = nullptr;
|
2011-04-05 20:20:26 +00:00
|
|
|
|
|
|
|
// Check that there is a single def and a single use.
|
2020-09-15 14:54:38 -07:00
|
|
|
for (MachineOperand &MO : MRI.reg_nodbg_operands(LI->reg())) {
|
2014-03-17 19:36:09 +00:00
|
|
|
MachineInstr *MI = MO.getParent();
|
2011-04-05 20:20:26 +00:00
|
|
|
if (MO.isDef()) {
|
|
|
|
if (DefMI && DefMI != MI)
|
|
|
|
return false;
|
2011-12-07 07:15:52 +00:00
|
|
|
if (!MI->canFoldAsLoad())
|
2011-04-05 20:20:26 +00:00
|
|
|
return false;
|
|
|
|
DefMI = MI;
|
|
|
|
} else if (!MO.isUndef()) {
|
|
|
|
if (UseMI && UseMI != MI)
|
|
|
|
return false;
|
|
|
|
// FIXME: Targets don't know how to fold subreg uses.
|
|
|
|
if (MO.getSubReg())
|
|
|
|
return false;
|
|
|
|
UseMI = MI;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!DefMI || !UseMI)
|
|
|
|
return false;
|
|
|
|
|
2012-07-20 21:29:31 +00:00
|
|
|
// Since we're moving the DefMI load, make sure we're not extending any live
|
|
|
|
// ranges.
|
2016-02-27 06:40:41 +00:00
|
|
|
if (!allUsesAvailableAt(DefMI, LIS.getInstructionIndex(*DefMI),
|
|
|
|
LIS.getInstructionIndex(*UseMI)))
|
2012-07-20 21:29:31 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
// We also need to make sure it is safe to move the load.
|
|
|
|
// Assume there are stores between DefMI and UseMI.
|
|
|
|
bool SawStore = true;
|
2015-05-19 21:22:20 +00:00
|
|
|
if (!DefMI->isSafeToMove(nullptr, SawStore))
|
2012-07-20 21:29:31 +00:00
|
|
|
return false;
|
|
|
|
|
2018-05-14 12:53:11 +00:00
|
|
|
LLVM_DEBUG(dbgs() << "Try to fold single def: " << *DefMI
|
|
|
|
<< " into single use: " << *UseMI);
|
2011-04-05 20:20:26 +00:00
|
|
|
|
|
|
|
SmallVector<unsigned, 8> Ops;
|
2020-09-15 14:54:38 -07:00
|
|
|
if (UseMI->readsWritesVirtualRegister(LI->reg(), &Ops).second)
|
2011-04-05 20:20:26 +00:00
|
|
|
return false;
|
|
|
|
|
2016-06-30 00:01:54 +00:00
|
|
|
MachineInstr *FoldMI = TII.foldMemoryOperand(*UseMI, Ops, *DefMI, &LIS);
|
2011-04-05 20:20:26 +00:00
|
|
|
if (!FoldMI)
|
|
|
|
return false;
|
2018-05-14 12:53:11 +00:00
|
|
|
LLVM_DEBUG(dbgs() << " folded: " << *FoldMI);
|
2016-02-27 06:40:41 +00:00
|
|
|
LIS.ReplaceMachineInstrInMaps(*UseMI, *FoldMI);
|
2020-02-10 09:49:14 +01:00
|
|
|
// Update the call site info.
|
2020-02-27 11:44:53 +01:00
|
|
|
if (UseMI->shouldUpdateCallSiteInfo())
|
2019-10-08 15:43:12 +00:00
|
|
|
UseMI->getMF()->moveCallSiteInfo(UseMI, FoldMI);
|
2019-06-27 14:31:52 +00:00
|
|
|
UseMI->eraseFromParent();
|
2020-09-15 14:54:38 -07:00
|
|
|
DefMI->addRegisterDead(LI->reg(), nullptr);
|
2011-04-05 20:20:26 +00:00
|
|
|
Dead.push_back(DefMI);
|
2011-05-05 17:22:53 +00:00
|
|
|
++NumDCEFoldedLoads;
|
2011-04-05 20:20:26 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-06-01 21:26:26 +00:00
|
|
|
bool LiveRangeEdit::useIsKill(const LiveInterval &LI,
|
|
|
|
const MachineOperand &MO) const {
|
2016-02-27 06:40:41 +00:00
|
|
|
const MachineInstr &MI = *MO.getParent();
|
2015-06-01 21:26:26 +00:00
|
|
|
SlotIndex Idx = LIS.getInstructionIndex(MI).getRegSlot();
|
|
|
|
if (LI.Query(Idx).isKill())
|
|
|
|
return true;
|
|
|
|
const TargetRegisterInfo &TRI = *MRI.getTargetRegisterInfo();
|
|
|
|
unsigned SubReg = MO.getSubReg();
|
2015-09-25 21:51:14 +00:00
|
|
|
LaneBitmask LaneMask = TRI.getSubRegIndexLaneMask(SubReg);
|
2015-06-01 21:26:26 +00:00
|
|
|
for (const LiveInterval::SubRange &S : LI.subranges()) {
|
2016-12-16 19:11:56 +00:00
|
|
|
if ((S.LaneMask & LaneMask).any() && S.Query(Idx).isKill())
|
2015-06-01 21:26:26 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-06-21 18:33:17 +00:00
|
|
|
/// Find all live intervals that need to shrink, then remove the instruction.
|
2022-06-24 12:09:34 -04:00
|
|
|
void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink) {
|
2013-06-21 18:33:17 +00:00
|
|
|
assert(MI->allDefsAreDead() && "Def isn't really dead");
|
2016-02-27 06:40:41 +00:00
|
|
|
SlotIndex Idx = LIS.getInstructionIndex(*MI).getRegSlot();
|
2011-03-08 22:46:11 +00:00
|
|
|
|
2013-06-22 00:33:48 +00:00
|
|
|
// Never delete a bundled instruction.
|
|
|
|
if (MI->isBundled()) {
|
|
|
|
return;
|
|
|
|
}
|
2013-06-21 18:33:17 +00:00
|
|
|
// Never delete inline asm.
|
|
|
|
if (MI->isInlineAsm()) {
|
2018-05-14 12:53:11 +00:00
|
|
|
LLVM_DEBUG(dbgs() << "Won't delete: " << Idx << '\t' << *MI);
|
2013-06-21 18:33:17 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-03-08 22:46:11 +00:00
|
|
|
|
2013-06-21 18:33:17 +00:00
|
|
|
// Use the same criteria as DeadMachineInstructionElim.
|
|
|
|
bool SawStore = false;
|
2015-05-19 21:22:20 +00:00
|
|
|
if (!MI->isSafeToMove(nullptr, SawStore)) {
|
2018-05-14 12:53:11 +00:00
|
|
|
LLVM_DEBUG(dbgs() << "Can't delete: " << Idx << '\t' << *MI);
|
2013-06-21 18:33:17 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-03-08 22:46:11 +00:00
|
|
|
|
2018-05-14 12:53:11 +00:00
|
|
|
LLVM_DEBUG(dbgs() << "Deleting dead def " << Idx << '\t' << *MI);
|
2013-06-21 18:33:17 +00:00
|
|
|
|
|
|
|
// Collect virtual registers to be erased after MI is gone.
|
|
|
|
SmallVector<unsigned, 8> RegsToErase;
|
|
|
|
bool ReadsPhysRegs = false;
|
2016-04-13 03:08:27 +00:00
|
|
|
bool isOrigDef = false;
|
2022-06-14 21:18:21 -04:00
|
|
|
Register Dest;
|
|
|
|
unsigned DestSubReg;
|
2016-12-15 19:55:19 +00:00
|
|
|
// Only optimize rematerialize case when the instruction has one def, since
|
|
|
|
// otherwise we could leave some dead defs in the code. This case is
|
|
|
|
// extremely rare.
|
|
|
|
if (VRM && MI->getOperand(0).isReg() && MI->getOperand(0).isDef() &&
|
|
|
|
MI->getDesc().getNumDefs() == 1) {
|
2016-04-13 03:08:27 +00:00
|
|
|
Dest = MI->getOperand(0).getReg();
|
2022-06-14 21:18:21 -04:00
|
|
|
DestSubReg = MI->getOperand(0).getSubReg();
|
2022-12-07 00:23:34 +00:00
|
|
|
Register Original = VRM->getOriginal(Dest);
|
2016-04-13 03:08:27 +00:00
|
|
|
LiveInterval &OrigLI = LIS.getInterval(Original);
|
|
|
|
VNInfo *OrigVNI = OrigLI.getVNInfoAt(Idx);
|
[LiveRangeEdit] Fix a crash in eliminateDeadDef.
When we delete a live-range, we check if that live-range is the origin of others
to keep it around for rematerialization. For that we check that the instruction
we are about to remove is the same as the definition of the VNI of the original
live-range.
If this is the case, we just shrink the live-range to an empty one.
Now, when we try to delete one of the children of such live-range (product of
splitting), we do the same check.
However, now the original live-range is empty and there is no way we can
access the VNI to check its definition, and we crash.
When we cannot get the VNI for the original live-range, that means we are not in
the presence of the original definition. Thus, this check does not need to happen
in that case and the crash is sloved!
This bug was introduced in r266162 | wmi | 2016-04-12 20:08:27. It affects every
target that uses the greedy register allocator.
To happen, we need to delete both a the original instruction and its split
products, in that order. This is likely to happen when rematerialization comes
into play.
Trying to produce a more robust test case. Will follow in a coming commit.
This fixes llvm.org/PR27983.
rdar://problem/26651519
llvm-svn: 272314
2016-06-09 21:34:31 +00:00
|
|
|
// The original live-range may have been shrunk to
|
|
|
|
// an empty live-range. It happens when it is dead, but
|
|
|
|
// we still keep it around to be able to rematerialize
|
|
|
|
// other values that depend on it.
|
|
|
|
if (OrigVNI)
|
|
|
|
isOrigDef = SlotIndex::isSameInstr(OrigVNI->def, Idx);
|
2016-04-13 03:08:27 +00:00
|
|
|
}
|
2011-03-08 22:46:11 +00:00
|
|
|
|
2021-08-30 14:49:50 -07:00
|
|
|
bool HasLiveVRegUses = false;
|
|
|
|
|
2013-06-21 18:33:17 +00:00
|
|
|
// Check for live intervals that may shrink
|
2021-11-11 07:10:30 -08:00
|
|
|
for (const MachineOperand &MO : MI->operands()) {
|
|
|
|
if (!MO.isReg())
|
2013-06-21 18:33:17 +00:00
|
|
|
continue;
|
2021-11-11 07:10:30 -08:00
|
|
|
Register Reg = MO.getReg();
|
2019-08-01 23:27:28 +00:00
|
|
|
if (!Register::isVirtualRegister(Reg)) {
|
2013-06-21 18:33:17 +00:00
|
|
|
// Check if MI reads any unreserved physregs.
|
2021-11-11 07:10:30 -08:00
|
|
|
if (Reg && MO.readsReg() && !MRI.isReserved(Reg))
|
2013-06-21 18:33:17 +00:00
|
|
|
ReadsPhysRegs = true;
|
2021-11-11 07:10:30 -08:00
|
|
|
else if (MO.isDef())
|
2020-10-07 16:11:50 -07:00
|
|
|
LIS.removePhysRegDefAt(Reg.asMCReg(), Idx);
|
2013-06-21 18:33:17 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
LiveInterval &LI = LIS.getInterval(Reg);
|
|
|
|
|
|
|
|
// Shrink read registers, unless it is likely to be expensive and
|
|
|
|
// unlikely to change anything. We typically don't want to shrink the
|
|
|
|
// PIC base register that has lots of uses everywhere.
|
|
|
|
// Always shrink COPY uses that probably come from live range splitting.
|
2021-11-11 07:10:30 -08:00
|
|
|
if ((MI->readsVirtualRegister(Reg) && (MI->isCopy() || MO.isDef())) ||
|
|
|
|
(MO.readsReg() && (MRI.hasOneNonDBGUse(Reg) || useIsKill(LI, MO))))
|
2013-06-21 18:33:17 +00:00
|
|
|
ToShrink.insert(&LI);
|
2021-11-11 07:10:30 -08:00
|
|
|
else if (MO.readsReg())
|
2021-08-30 14:49:50 -07:00
|
|
|
HasLiveVRegUses = true;
|
2013-06-21 18:33:17 +00:00
|
|
|
|
|
|
|
// Remove defined value.
|
2021-11-11 07:10:30 -08:00
|
|
|
if (MO.isDef()) {
|
2015-01-21 19:02:30 +00:00
|
|
|
if (TheDelegate && LI.getVNInfoAt(Idx) != nullptr)
|
2020-09-15 14:54:38 -07:00
|
|
|
TheDelegate->LRE_WillShrinkVirtReg(LI.reg());
|
2015-01-21 19:02:30 +00:00
|
|
|
LIS.removeVRegDefAt(LI, Idx);
|
|
|
|
if (LI.empty())
|
|
|
|
RegsToErase.push_back(Reg);
|
2013-06-21 18:33:17 +00:00
|
|
|
}
|
|
|
|
}
|
2012-05-22 14:52:12 +00:00
|
|
|
|
2013-06-21 18:33:17 +00:00
|
|
|
// Currently, we don't support DCE of physreg live ranges. If MI reads
|
|
|
|
// any unreserved physregs, don't erase the instruction, but turn it into
|
|
|
|
// a KILL instead. This way, the physreg live ranges don't end up
|
|
|
|
// dangling.
|
|
|
|
// FIXME: It would be better to have something like shrinkToUses() for
|
|
|
|
// physregs. That could potentially enable more DCE and it would free up
|
|
|
|
// the physreg. It would not happen often, though.
|
|
|
|
if (ReadsPhysRegs) {
|
|
|
|
MI->setDesc(TII.get(TargetOpcode::KILL));
|
|
|
|
// Remove all operands that aren't physregs.
|
|
|
|
for (unsigned i = MI->getNumOperands(); i; --i) {
|
|
|
|
const MachineOperand &MO = MI->getOperand(i-1);
|
2019-08-01 23:27:28 +00:00
|
|
|
if (MO.isReg() && Register::isPhysicalRegister(MO.getReg()))
|
2013-06-21 18:33:17 +00:00
|
|
|
continue;
|
2022-03-16 20:21:25 +08:00
|
|
|
MI->removeOperand(i-1);
|
2013-06-21 18:33:17 +00:00
|
|
|
}
|
2018-05-14 12:53:11 +00:00
|
|
|
LLVM_DEBUG(dbgs() << "Converted physregs to:\t" << *MI);
|
2013-06-21 18:33:17 +00:00
|
|
|
} else {
|
2016-07-08 21:08:09 +00:00
|
|
|
// If the dest of MI is an original reg and MI is reMaterializable,
|
|
|
|
// don't delete the inst. Replace the dest with a new reg, and keep
|
|
|
|
// the inst for remat of other siblings. The inst is saved in
|
|
|
|
// LiveRangeEdit::DeadRemats and will be deleted after all the
|
|
|
|
// allocations of the func are done.
|
2021-08-30 14:49:50 -07:00
|
|
|
// However, immediately delete instructions which have unshrunk virtual
|
|
|
|
// register uses. That may provoke RA to split an interval at the KILL
|
|
|
|
// and later result in an invalid live segment end.
|
|
|
|
if (isOrigDef && DeadRemats && !HasLiveVRegUses &&
|
2022-06-24 12:09:34 -04:00
|
|
|
TII.isTriviallyReMaterializable(*MI)) {
|
2018-01-10 21:41:02 +00:00
|
|
|
LiveInterval &NewLI = createEmptyIntervalFrom(Dest, false);
|
2022-06-14 21:18:21 -04:00
|
|
|
VNInfo::Allocator &Alloc = LIS.getVNInfoAllocator();
|
|
|
|
VNInfo *VNI = NewLI.getNextValue(Idx, Alloc);
|
2016-04-13 03:08:27 +00:00
|
|
|
NewLI.addSegment(LiveInterval::Segment(Idx, Idx.getDeadSlot(), VNI));
|
2022-06-14 21:18:21 -04:00
|
|
|
|
|
|
|
if (DestSubReg) {
|
|
|
|
const TargetRegisterInfo *TRI = MRI.getTargetRegisterInfo();
|
|
|
|
auto *SR = NewLI.createSubRange(
|
|
|
|
Alloc, TRI->getSubRegIndexLaneMask(DestSubReg));
|
|
|
|
SR->addSegment(LiveInterval::Segment(Idx, Idx.getDeadSlot(),
|
|
|
|
SR->getNextValue(Idx, Alloc)));
|
|
|
|
}
|
|
|
|
|
2016-04-13 03:08:27 +00:00
|
|
|
pop_back();
|
2018-01-10 22:36:26 +00:00
|
|
|
DeadRemats->insert(MI);
|
2016-04-13 03:08:27 +00:00
|
|
|
const TargetRegisterInfo &TRI = *MRI.getTargetRegisterInfo();
|
2020-09-15 14:54:38 -07:00
|
|
|
MI->substituteRegister(Dest, NewLI.reg(), 0, TRI);
|
2016-04-13 03:08:27 +00:00
|
|
|
MI->getOperand(0).setIsDead(true);
|
|
|
|
} else {
|
|
|
|
if (TheDelegate)
|
|
|
|
TheDelegate->LRE_WillEraseInstruction(MI);
|
|
|
|
LIS.RemoveMachineInstrFromMaps(*MI);
|
|
|
|
MI->eraseFromParent();
|
|
|
|
++NumDCEDeleted;
|
|
|
|
}
|
2013-06-21 18:33:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Erase any virtregs that are now empty and unused. There may be <undef>
|
|
|
|
// uses around. Keep the empty live range in that case.
|
|
|
|
for (unsigned i = 0, e = RegsToErase.size(); i != e; ++i) {
|
2020-06-30 11:57:24 -04:00
|
|
|
Register Reg = RegsToErase[i];
|
2013-06-21 18:33:17 +00:00
|
|
|
if (LIS.hasInterval(Reg) && MRI.reg_nodbg_empty(Reg)) {
|
|
|
|
ToShrink.remove(&LIS.getInterval(Reg));
|
|
|
|
eraseVirtReg(Reg);
|
2011-03-08 22:46:11 +00:00
|
|
|
}
|
2013-06-21 18:33:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-13 03:08:27 +00:00
|
|
|
void LiveRangeEdit::eliminateDeadDefs(SmallVectorImpl<MachineInstr *> &Dead,
|
2022-06-24 12:09:34 -04:00
|
|
|
ArrayRef<Register> RegsBeingSpilled) {
|
2013-06-21 18:33:17 +00:00
|
|
|
ToShrinkSet ToShrink;
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
// Erase all dead defs.
|
|
|
|
while (!Dead.empty())
|
2022-06-24 12:09:34 -04:00
|
|
|
eliminateDeadDef(Dead.pop_back_val(), ToShrink);
|
2011-03-08 22:46:11 +00:00
|
|
|
|
|
|
|
if (ToShrink.empty())
|
|
|
|
break;
|
|
|
|
|
|
|
|
// Shrink just one live interval. Then delete new dead defs.
|
2021-09-19 13:44:23 -07:00
|
|
|
LiveInterval *LI = ToShrink.pop_back_val();
|
2012-04-02 22:22:53 +00:00
|
|
|
if (foldAsLoad(LI, Dead))
|
2011-04-05 20:20:26 +00:00
|
|
|
continue;
|
2022-12-07 00:23:34 +00:00
|
|
|
Register VReg = LI->reg();
|
2012-05-18 22:10:15 +00:00
|
|
|
if (TheDelegate)
|
2015-09-22 03:44:41 +00:00
|
|
|
TheDelegate->LRE_WillShrinkVirtReg(VReg);
|
2011-03-17 20:37:07 +00:00
|
|
|
if (!LIS.shrinkToUses(LI, &Dead))
|
|
|
|
continue;
|
2013-06-21 18:33:14 +00:00
|
|
|
|
2011-12-12 22:16:27 +00:00
|
|
|
// Don't create new intervals for a register being spilled.
|
|
|
|
// The new intervals would have to be spilled anyway so its not worth it.
|
|
|
|
// Also they currently aren't spilled so creating them and not spilling
|
|
|
|
// them results in incorrect code.
|
2021-11-21 10:36:20 -08:00
|
|
|
if (llvm::is_contained(RegsBeingSpilled, VReg))
|
|
|
|
continue;
|
2011-03-17 20:37:07 +00:00
|
|
|
|
|
|
|
// LI may have been separated, create new intervals.
|
2013-08-14 17:28:52 +00:00
|
|
|
LI->RenumberValues();
|
2015-09-22 03:44:41 +00:00
|
|
|
SmallVector<LiveInterval*, 8> SplitLIs;
|
|
|
|
LIS.splitSeparateComponents(*LI, SplitLIs);
|
|
|
|
if (!SplitLIs.empty())
|
|
|
|
++NumFracRanges;
|
|
|
|
|
2020-12-17 18:47:13 -05:00
|
|
|
Register Original = VRM ? VRM->getOriginal(VReg) : Register();
|
2015-09-22 03:44:41 +00:00
|
|
|
for (const LiveInterval *SplitLI : SplitLIs) {
|
2011-07-05 15:38:41 +00:00
|
|
|
// If LI is an original interval that hasn't been split yet, make the new
|
|
|
|
// intervals their own originals instead of referring to LI. The original
|
|
|
|
// interval must contain all the split products, and LI doesn't.
|
2015-09-22 03:44:41 +00:00
|
|
|
if (Original != VReg && Original != 0)
|
2020-09-15 14:54:38 -07:00
|
|
|
VRM->setIsSplitFromReg(SplitLI->reg(), Original);
|
2012-05-18 22:10:15 +00:00
|
|
|
if (TheDelegate)
|
2020-09-15 14:54:38 -07:00
|
|
|
TheDelegate->LRE_DidCloneVirtReg(SplitLI->reg(), VReg);
|
2011-03-30 02:52:39 +00:00
|
|
|
}
|
2011-03-08 22:46:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-14 23:50:09 +00:00
|
|
|
// Keep track of new virtual registers created via
|
|
|
|
// MachineRegisterInfo::createVirtualRegister.
|
|
|
|
void
|
2020-01-30 16:05:34 -05:00
|
|
|
LiveRangeEdit::MRI_NoteNewVirtualRegister(Register VReg) {
|
2013-08-14 23:50:09 +00:00
|
|
|
if (VRM)
|
|
|
|
VRM->grow();
|
|
|
|
|
|
|
|
NewRegs.push_back(VReg);
|
|
|
|
}
|
|
|
|
|
2021-02-17 13:32:26 -08:00
|
|
|
void LiveRangeEdit::calculateRegClassAndHint(MachineFunction &MF,
|
|
|
|
VirtRegAuxInfo &VRAI) {
|
2013-08-14 23:50:04 +00:00
|
|
|
for (unsigned I = 0, Size = size(); I < Size; ++I) {
|
|
|
|
LiveInterval &LI = LIS.getInterval(get(I));
|
2020-09-15 14:54:38 -07:00
|
|
|
if (MRI.recomputeRegClass(LI.reg()))
|
2018-05-14 12:53:11 +00:00
|
|
|
LLVM_DEBUG({
|
2014-11-17 05:50:14 +00:00
|
|
|
const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
|
2020-09-15 14:54:38 -07:00
|
|
|
dbgs() << "Inflated " << printReg(LI.reg()) << " to "
|
|
|
|
<< TRI->getRegClassName(MRI.getRegClass(LI.reg())) << '\n';
|
2014-11-17 05:50:14 +00:00
|
|
|
});
|
2013-11-11 19:04:45 +00:00
|
|
|
VRAI.calculateSpillWeightAndHint(LI);
|
2011-03-29 21:20:19 +00:00
|
|
|
}
|
|
|
|
}
|