summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveRangeCalc.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-09-02 19:48:55 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-09-02 19:48:55 +0000
commit3bf4aeccd607fbc86429f3b26e18c1f1cdfda77c (patch)
treea137a1faa25bebb727d1a42f2102f1e6ac504b17 /llvm/lib/CodeGen/LiveRangeCalc.cpp
parent70277411d3dd780ae794da3621204823bb9344f8 (diff)
downloadbcm5719-llvm-3bf4aeccd607fbc86429f3b26e18c1f1cdfda77c.tar.gz
bcm5719-llvm-3bf4aeccd607fbc86429f3b26e18c1f1cdfda77c.zip
Do not consider subreg defs as reads when computing subrange liveness
Subregister definitions are considered uses for the purpose of tracking liveness of the whole register. At the same time, when calculating live interval subranges, subregister defs should not be treated as uses. Differential Revision: https://reviews.llvm.org/D24190 llvm-svn: 280532
Diffstat (limited to 'llvm/lib/CodeGen/LiveRangeCalc.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveRangeCalc.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveRangeCalc.cpp b/llvm/lib/CodeGen/LiveRangeCalc.cpp
index 25d22a02d33..98022d99cf2 100644
--- a/llvm/lib/CodeGen/LiveRangeCalc.cpp
+++ b/llvm/lib/CodeGen/LiveRangeCalc.cpp
@@ -163,13 +163,18 @@ void LiveRangeCalc::extendToUses(LiveRange &LR, unsigned Reg, LaneBitmask Mask,
LI->computeSubRangeUndefs(Undefs, Mask, *MRI, *Indexes);
// Visit all operands that read Reg. This may include partial defs.
+ bool IsSubRange = (Mask != ~0U);
const TargetRegisterInfo &TRI = *MRI->getTargetRegisterInfo();
for (MachineOperand &MO : MRI->reg_nodbg_operands(Reg)) {
// Clear all kill flags. They will be reinserted after register allocation
// by LiveIntervalAnalysis::addKillFlags().
if (MO.isUse())
MO.setIsKill(false);
- if (!MO.readsReg())
+ // MO::readsReg returns "true" for subregister defs. This is for keeping
+ // liveness of the entire register (i.e. for the main range of the live
+ // interval). For subranges, definitions of non-overlapping subregisters
+ // do not count as uses.
+ if (!MO.readsReg() || (IsSubRange && MO.isDef()))
continue;
unsigned SubReg = MO.getSubReg();
OpenPOWER on IntegriCloud