summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegisterPressure.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2014-02-06 19:20:41 +0000
committerAndrew Trick <atrick@apple.com>2014-02-06 19:20:41 +0000
commit2be0fae98c54ff6b0e7a53ee1d01b5a402eaa51e (patch)
treeabb7a1ae3ee87ca29f17399619436a82c70ecc5b /lib/CodeGen/RegisterPressure.cpp
parente75bf036116c78b3f0a315d6146e13e85f1114ef (diff)
downloadllvm-2be0fae98c54ff6b0e7a53ee1d01b5a402eaa51e.tar.gz
llvm-2be0fae98c54ff6b0e7a53ee1d01b5a402eaa51e.tar.bz2
llvm-2be0fae98c54ff6b0e7a53ee1d01b5a402eaa51e.tar.xz
Track register pressure a bit more carefully (weird corner case).
This solves a problem where a def machine operand has no uses but has not been marked dead. In this case, the initial RP analysis was being extra precise and determining from LiveIntervals the the register was actually dead. This caused us to omit the register from the RP tracker's block live out. That's all good, but the per-instruction summary still accounted for it as a valid def. This could cause an assertion in the tracker later when we underflow pressure. This is from a bug report on an out-of-tree target. It is not reproducible on well-behaved targets. I'm just making an obvious fix without unit test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200941 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegisterPressure.cpp')
-rw-r--r--lib/CodeGen/RegisterPressure.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/RegisterPressure.cpp b/lib/CodeGen/RegisterPressure.cpp
index 092ecdd9bb..249789a4b1 100644
--- a/lib/CodeGen/RegisterPressure.cpp
+++ b/lib/CodeGen/RegisterPressure.cpp
@@ -506,7 +506,14 @@ bool RegPressureTracker::recede(SmallVectorImpl<unsigned> *LiveUses,
DeadDef = LRQ.isDeadDef();
}
}
- if (!DeadDef) {
+ if (DeadDef) {
+ // LiveIntervals knows this is a dead even though it's MachineOperand is
+ // not flagged as such. Since this register will not be recorded as
+ // live-out, increase its PDiff value to avoid underflowing pressure.
+ if (PDiff)
+ PDiff->addPressureChange(Reg, false, MRI);
+ }
+ else {
if (LiveRegs.erase(Reg))
decreaseRegPressure(Reg);
else