aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-03-15 00:50:21 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-03-15 00:50:21 +0000
commit0e33d9fea245d67f71a7f7138c8094a9c809613e (patch)
treefd95507a1380000dd60d0a7454decb71862106ea /lib/Analysis
parent38ca0d78a2b3bb23d3121613b0781023fa9cd2a8 (diff)
downloadexternal_llvm-0e33d9fea245d67f71a7f7138c8094a9c809613e.zip
external_llvm-0e33d9fea245d67f71a7f7138c8094a9c809613e.tar.gz
external_llvm-0e33d9fea245d67f71a7f7138c8094a9c809613e.tar.bz2
Don't assume that the arguments are processed in some particular order.
This appears to not be the case with dragonegg at least in some contexts. Hopefully will fix the bootstrap assert failure there. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152763 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/InlineCost.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp
index fa683f6..37aa729 100644
--- a/lib/Analysis/InlineCost.cpp
+++ b/lib/Analysis/InlineCost.cpp
@@ -434,9 +434,11 @@ void InlineCostAnalyzer::FunctionInfo::countCodeReductionForPointerPair(
= PointerArgs.find(OtherArg);
if (ArgIt == PointerArgs.end())
continue;
- assert(ArgIt->second < ArgIdx);
+ std::pair<unsigned, unsigned> ArgPair(ArgIt->second, ArgIdx);
+ if (ArgIt->second > ArgIdx)
+ std::swap(ArgPair.first, ArgPair.second);
- PointerArgPairWeights[std::make_pair(ArgIt->second, ArgIdx)]
+ PointerArgPairWeights[ArgPair]
+= countCodeReductionForConstant(Metrics, I);
}
} while (!Worklist.empty());