aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorRoman Levenstein <romix.llvm@googlemail.com>2008-03-27 09:14:57 +0000
committerRoman Levenstein <romix.llvm@googlemail.com>2008-03-27 09:14:57 +0000
commit95d4184e7218d7ec21b5b8d693dd3b14146eefdc (patch)
tree89abde9eaa522b8d8369934dffe4fd3e9b415dc2 /lib/CodeGen
parent9ba8a5736a9140232629fdbbad7b7c5c2bd5ffcb (diff)
downloadexternal_llvm-95d4184e7218d7ec21b5b8d693dd3b14146eefdc.zip
external_llvm-95d4184e7218d7ec21b5b8d693dd3b14146eefdc.tar.gz
external_llvm-95d4184e7218d7ec21b5b8d693dd3b14146eefdc.tar.bz2
Speed-up the SumOfUnscheduledPredsOfSuccs by introducing a new function
called LimitedSumOfUnscheduledPredsOfSuccs. It terminates the computation after a given treshold is reached. This new function is always faster, but brings real wins only on bigger test-cases. The old function SumOfUnscheduledPredsOfSuccs is left in-place for now and therefore a warning about an unused static function is produced. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48872 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
index 8d63631..caaa6a5 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
@@ -1724,6 +1724,29 @@ static unsigned SumOfUnscheduledPredsOfSuccs(const SUnit *SU) {
return Sum;
}
+/// LimitedSumOfUnscheduledPredsOfSuccs - compute the sum of the unscheduled
+/// predecessors of the successors of the SUnit SU. Stop when the provided
+/// limit is exceeded.
+
+static unsigned LimitedSumOfUnscheduledPredsOfSuccs(const SUnit *SU,
+ unsigned Limit) {
+ unsigned Sum = 0;
+ for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
+ I != E; ++I) {
+ SUnit *SuccSU = I->Dep;
+ for (SUnit::const_pred_iterator II = SuccSU->Preds.begin(),
+ EE = SuccSU->Preds.end(); II != EE; ++II) {
+ SUnit *PredSU = II->Dep;
+ if (!PredSU->isScheduled) {
+ ++Sum;
+ if(Sum > Limit)
+ return Sum;
+ }
+ }
+ }
+ return Sum;
+}
+
// Top down
bool td_ls_rr_sort::operator()(const SUnit *left, const SUnit *right) const {
@@ -1733,8 +1756,8 @@ bool td_ls_rr_sort::operator()(const SUnit *left, const SUnit *right) const {
bool RIsTarget = right->Node && right->Node->isTargetOpcode();
bool LIsFloater = LIsTarget && left->NumPreds == 0;
bool RIsFloater = RIsTarget && right->NumPreds == 0;
- unsigned LBonus = (SumOfUnscheduledPredsOfSuccs(left) == 1) ? 2 : 0;
- unsigned RBonus = (SumOfUnscheduledPredsOfSuccs(right) == 1) ? 2 : 0;
+ unsigned LBonus = (LimitedSumOfUnscheduledPredsOfSuccs(left,1) == 1) ? 2 : 0;
+ unsigned RBonus = (LimitedSumOfUnscheduledPredsOfSuccs(right,1) == 1) ? 2 : 0;
if (left->NumSuccs == 0 && right->NumSuccs != 0)
return false;