[llvm-branch-commits] [llvm-branch] r90203 - in /llvm/branches/Apple/Zoidberg: lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2009-09-19-SchedCustomLoweringBug.ll
Jakob Stoklund Olesen
stoklund at 2pi.dk
Mon Nov 30 19:30:05 PST 2009
Author: stoklund
Date: Mon Nov 30 21:30:05 2009
New Revision: 90203
URL: http://llvm.org/viewvc/llvm-project?rev=90203&view=rev
Log:
Merge r90194
Modified:
llvm/branches/Apple/Zoidberg/lib/CodeGen/SimpleRegisterCoalescing.cpp
llvm/branches/Apple/Zoidberg/test/CodeGen/X86/2009-09-19-SchedCustomLoweringBug.ll
Modified: llvm/branches/Apple/Zoidberg/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=90203&r1=90202&r2=90203&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Nov 30 21:30:05 2009
@@ -2371,9 +2371,19 @@
struct DepthMBBCompare {
typedef std::pair<unsigned, MachineBasicBlock*> DepthMBBPair;
bool operator()(const DepthMBBPair &LHS, const DepthMBBPair &RHS) const {
- if (LHS.first > RHS.first) return true; // Deeper loops first
- return LHS.first == RHS.first &&
- LHS.second->getNumber() < RHS.second->getNumber();
+ // Deeper loops first
+ if (LHS.first != RHS.first)
+ return LHS.first > RHS.first;
+
+ // Prefer blocks that are more connected in the CFG. This takes care of
+ // the most difficult copies first while intervals are short.
+ unsigned cl = LHS.second->pred_size() + LHS.second->succ_size();
+ unsigned cr = RHS.second->pred_size() + RHS.second->succ_size();
+ if (cl != cr)
+ return cl > cr;
+
+ // As a last resort, sort by block number.
+ return LHS.second->getNumber() < RHS.second->getNumber();
}
};
}
Modified: llvm/branches/Apple/Zoidberg/test/CodeGen/X86/2009-09-19-SchedCustomLoweringBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/test/CodeGen/X86/2009-09-19-SchedCustomLoweringBug.ll?rev=90203&r1=90202&r2=90203&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/test/CodeGen/X86/2009-09-19-SchedCustomLoweringBug.ll (original)
+++ llvm/branches/Apple/Zoidberg/test/CodeGen/X86/2009-09-19-SchedCustomLoweringBug.ll Mon Nov 30 21:30:05 2009
@@ -10,6 +10,7 @@
bb: ; preds = %bb1, %entry
; CHECK: addl $1
+; CHECK-NEXT: movl %e
; CHECK-NEXT: adcl $0
%i.0 = phi i64 [ 0, %entry ], [ %0, %bb1 ] ; <i64> [#uses=1]
%0 = add nsw i64 %i.0, 1 ; <i64> [#uses=2]
More information about the llvm-branch-commits
mailing list