summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/RegAllocGreedy.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-12-10 20:45:04 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-12-10 20:45:04 +0000
commit1c6196228ab79375fca7b9ad4fb32da4279c8d1a (patch)
tree910b1723f7d321a25fb6a0260cd9bd9a61e7099c /llvm/lib/CodeGen/RegAllocGreedy.cpp
parent704e7c23322c51c5c395c2a30234b501d2088542 (diff)
downloadbcm5719-llvm-1c6196228ab79375fca7b9ad4fb32da4279c8d1a.tar.gz
bcm5719-llvm-1c6196228ab79375fca7b9ad4fb32da4279c8d1a.zip
Fix miscompilation caused by trivial logic error in the reassignVReg()
interference check. llvm-svn: 121519
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocGreedy.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocGreedy.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index 3c166bac4b4..ecdc4193558 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -81,6 +81,7 @@ public:
static char ID;
private:
+ bool checkUncachedInterference(LiveInterval &, unsigned);
bool reassignVReg(LiveInterval &InterferingVReg, unsigned OldPhysReg);
bool reassignInterferences(LiveInterval &VirtReg, unsigned PhysReg);
};
@@ -146,6 +147,20 @@ float RAGreedy::getPriority(LiveInterval *LI) {
return Priority;
}
+// Check interference without using the cache.
+bool RAGreedy::checkUncachedInterference(LiveInterval &VirtReg,
+ unsigned PhysReg) {
+ LiveIntervalUnion::Query subQ(&VirtReg, &PhysReg2LiveUnion[PhysReg]);
+ if (subQ.checkInterference())
+ return true;
+ for (const unsigned *AliasI = TRI->getAliasSet(PhysReg); *AliasI; ++AliasI) {
+ subQ.init(&VirtReg, &PhysReg2LiveUnion[*AliasI]);
+ if (subQ.checkInterference())
+ return true;
+ }
+ return false;
+}
+
// Attempt to reassign this virtual register to a different physical register.
//
// FIXME: we are not yet caching these "second-level" interferences discovered
@@ -168,18 +183,9 @@ bool RAGreedy::reassignVReg(LiveInterval &InterferingVReg,
if (PhysReg == OldPhysReg || ReservedRegs.test(PhysReg))
continue;
- // Instantiate a "subquery", not to be confused with the Queries array.
- LiveIntervalUnion::Query subQ(&InterferingVReg,
- &PhysReg2LiveUnion[PhysReg]);
- if (subQ.checkInterference())
+ if (checkUncachedInterference(InterferingVReg, PhysReg))
continue;
- for (const unsigned *AliasI = TRI->getAliasSet(PhysReg);
- *AliasI; ++AliasI) {
- subQ.init(&InterferingVReg, &PhysReg2LiveUnion[*AliasI]);
- if (subQ.checkInterference())
- continue;
- }
DEBUG(dbgs() << "reassigning: " << InterferingVReg << " from " <<
TRI->getName(OldPhysReg) << " to " << TRI->getName(PhysReg) << '\n');
OpenPOWER on IntegriCloud