summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorMitch Bodart <mitch.l.bodart@intel.com>2016-05-26 23:08:52 +0000
committerMitch Bodart <mitch.l.bodart@intel.com>2016-05-26 23:08:52 +0000
commit05aeeb5cf19ec8964efe699c2cf45e075918d27f (patch)
tree18ffaa4082d813c87fb826b5869c14dae49e460c /llvm/lib/CodeGen
parent18695f97088daf6622c28cc01c3b25e931adf5ed (diff)
downloadbcm5719-llvm-05aeeb5cf19ec8964efe699c2cf45e075918d27f.tar.gz
bcm5719-llvm-05aeeb5cf19ec8964efe699c2cf45e075918d27f.zip
[CodeGen] Fix problem with X86 byte registers in CriticalAntiDepBreaker
CriticalAntiDepBreaker was not correctly tracking defs of the high X86 byte registers, leading to incorrect use of a busy register to break an antidependence. Fixes pr27681, and its duplicates pr27580, pr27804. Differential Revision: http://reviews.llvm.org/D20456 llvm-svn: 270935
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp b/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp
index d693af4a0a2..a0189a172bf 100644
--- a/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp
+++ b/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp
@@ -260,22 +260,24 @@ void CriticalAntiDepBreaker::ScanInstruction(MachineInstr &MI, unsigned Count) {
if (Reg == 0) continue;
if (!MO.isDef()) continue;
- // If we've already marked this reg as unchangeable, carry on.
- if (KeepRegs.test(Reg)) continue;
-
// Ignore two-addr defs.
if (MI.isRegTiedToUseOperand(i))
continue;
+ // If we've already marked this reg as unchangeable, don't remove
+ // it or any of its subregs from KeepRegs.
+ bool Keep = KeepRegs.test(Reg);
+
// For the reg itself and all subregs: update the def to current;
// reset the kill state, any restrictions, and references.
for (MCSubRegIterator SRI(Reg, TRI, true); SRI.isValid(); ++SRI) {
unsigned SubregReg = *SRI;
DefIndices[SubregReg] = Count;
KillIndices[SubregReg] = ~0u;
- KeepRegs.reset(SubregReg);
Classes[SubregReg] = nullptr;
RegRefs.erase(SubregReg);
+ if (!Keep)
+ KeepRegs.reset(SubregReg);
}
// Conservatively mark super-registers as unusable.
for (MCSuperRegIterator SR(Reg, TRI); SR.isValid(); ++SR)
OpenPOWER on IntegriCloud