aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/RegisterScavenging.cpp
diff options
context:
space:
mode:
authorSilviu Baranga <silviu.baranga@arm.com>2016-09-06 10:10:21 +0000
committerSilviu Baranga <silviu.baranga@arm.com>2016-09-06 10:10:21 +0000
commit0b7c4af35904070513a2beba4f4e647acba33274 (patch)
tree3d4e0d2ffc0f6865043f57c0156d092fa6f1c031 /llvm/lib/CodeGen/RegisterScavenging.cpp
parent5cf1ece222936a0b7d6cc053c6db71a1956412d9 (diff)
downloadllvm-0b7c4af35904070513a2beba4f4e647acba33274.zip
llvm-0b7c4af35904070513a2beba4f4e647acba33274.tar.gz
llvm-0b7c4af35904070513a2beba4f4e647acba33274.tar.bz2
[RegisterScavenger] Remove aliasing registers of operands from the candidate set
Summary: In addition to not including the register operand of the current instruction also don't include any aliasing registers. We can't consider these as candidates because using them will clobber the corresponding register operand of the current instruction. This change doesn't include a test case and it would probably be difficult to produce a stable one since the bug depends on the results of register allocation. Reviewers: MatzeB, qcolombet, hfinkel Subscribers: hfinkel, llvm-commits Differential Revision: https://reviews.llvm.org/D24130 llvm-svn: 280698
Diffstat (limited to 'llvm/lib/CodeGen/RegisterScavenging.cpp')
-rw-r--r--llvm/lib/CodeGen/RegisterScavenging.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/RegisterScavenging.cpp b/llvm/lib/CodeGen/RegisterScavenging.cpp
index 953e535..be56861 100644
--- a/llvm/lib/CodeGen/RegisterScavenging.cpp
+++ b/llvm/lib/CodeGen/RegisterScavenging.cpp
@@ -419,7 +419,8 @@ unsigned RegScavenger::scavengeRegister(const TargetRegisterClass *RC,
for (const MachineOperand &MO : MI.operands()) {
if (MO.isReg() && MO.getReg() != 0 && !(MO.isUse() && MO.isUndef()) &&
!TargetRegisterInfo::isVirtualRegister(MO.getReg()))
- Candidates.reset(MO.getReg());
+ for (MCRegAliasIterator AI(MO.getReg(), TRI, true); AI.isValid(); ++AI)
+ Candidates.reset(*AI);
}
// Try to find a register that's unused if there is one, as then we won't