summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-11-15 18:13:20 +0000
committerChad Rosier <mcrosier@apple.com>2012-11-15 18:13:20 +0000
commit4823be3be1d87632fbd51ce8e51a58ee5e44b115 (patch)
treebe9d3e486d6b3d8396897f8e810c51e3639bc1ae /include
parent009cf9e9a3a386f89db2686a105736481aed10ca (diff)
downloadllvm-4823be3be1d87632fbd51ce8e51a58ee5e44b115.tar.gz
llvm-4823be3be1d87632fbd51ce8e51a58ee5e44b115.tar.bz2
llvm-4823be3be1d87632fbd51ce8e51a58ee5e44b115.tar.xz
[reg scavenger] Fix the isUsed/isAliasUsed functions so as to not report a false
positive. In this particular case, R6 was being spilled by the register scavenger when it was in fact dead. The isUsed function reported R6 as used because the R6_R7 alias was reserved (due to the fact that we've reserved R7 as the FP). The solution is to only check if the original register (i.e., R6) isReserved and not the aliases. The aliases are only checked to make sure they're available. The test case is derived from one of the nightly tester benchmarks and is rather intractable and difficult to reproduce, so I haven't included it. rdar://12592448 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168054 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/RegisterScavenging.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/llvm/CodeGen/RegisterScavenging.h b/include/llvm/CodeGen/RegisterScavenging.h
index 08d316992e..8752e67a79 100644
--- a/include/llvm/CodeGen/RegisterScavenging.h
+++ b/include/llvm/CodeGen/RegisterScavenging.h
@@ -129,10 +129,12 @@ private:
/// isReserved - Returns true if a register is reserved. It is never "unused".
bool isReserved(unsigned Reg) const { return MRI->isReserved(Reg); }
- /// isUsed / isUnused - Test if a register is currently being used.
+ /// isUsed - Test if a register is currently being used. When called by the
+ /// isAliasUsed function, we only check isReserved if this is the original
+ /// register, not an alias register.
///
- bool isUsed(unsigned Reg) const {
- return !RegsAvailable.test(Reg) || isReserved(Reg);
+ bool isUsed(unsigned Reg, bool CheckReserved = true) const {
+ return !RegsAvailable.test(Reg) || (CheckReserved && isReserved(Reg));
}
/// isAliasUsed - Is Reg or an alias currently in use?