diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp index fa683f695e7..37aa729552b 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 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());