summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SpillPlacement.cpp
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2014-02-28 23:05:31 +0000
committerManman Ren <manman.ren@gmail.com>2014-02-28 23:05:31 +0000
commit709c951b42f78de2ee5da58d1e57a9d622257e7c (patch)
tree8cd16e5a8a5324897fd709a27867f51437897928 /llvm/lib/CodeGen/SpillPlacement.cpp
parent7c8743da5988d150ad5672554e80076eb7ad8068 (diff)
downloadbcm5719-llvm-709c951b42f78de2ee5da58d1e57a9d622257e7c.tar.gz
bcm5719-llvm-709c951b42f78de2ee5da58d1e57a9d622257e7c.zip
SpillPlacement: fix a bug in iterate.
Inside iterate, we scan backwards then scan forwards in a loop. When iteration is not zero, the last node was just updated so we can skip it. But when iteration is zero, we can't skip the last node. For the testing case, fixing this will save a spill and move register copies from hot path to cold path. llvm-svn: 202557
Diffstat (limited to 'llvm/lib/CodeGen/SpillPlacement.cpp')
-rw-r--r--llvm/lib/CodeGen/SpillPlacement.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SpillPlacement.cpp b/llvm/lib/CodeGen/SpillPlacement.cpp
index 02c2035f4f6..fb5b927d499 100644
--- a/llvm/lib/CodeGen/SpillPlacement.cpp
+++ b/llvm/lib/CodeGen/SpillPlacement.cpp
@@ -323,10 +323,12 @@ void SpillPlacement::iterate() {
// affect the entire network in a single iteration. That means very fast
// convergence, usually in a single iteration.
for (unsigned iteration = 0; iteration != 10; ++iteration) {
- // Scan backwards, skipping the last node which was just updated.
+ // Scan backwards, skipping the last node when iteration is not zero. When
+ // iteration is not zero, the last node was just updated.
bool Changed = false;
for (SmallVectorImpl<unsigned>::const_reverse_iterator I =
- llvm::next(Linked.rbegin()), E = Linked.rend(); I != E; ++I) {
+ iteration == 0 ? Linked.rbegin() : llvm::next(Linked.rbegin()),
+ E = Linked.rend(); I != E; ++I) {
unsigned n = *I;
if (nodes[n].update(nodes)) {
Changed = true;
OpenPOWER on IntegriCloud