From 3b348d91028726f840868875dac3bcefcefda917 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Fri, 14 Aug 2020 04:17:08 -0700 Subject: [PATCH] [NFC][StackSafety] Move out sort from the loop --- llvm/lib/Analysis/StackSafetyAnalysis.cpp | 10 ++++++---- llvm/test/Bitcode/thinlto-function-summary-paramaccess.ll | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Analysis/StackSafetyAnalysis.cpp b/llvm/lib/Analysis/StackSafetyAnalysis.cpp index 0a8a4cc..023a72d 100644 --- a/llvm/lib/Analysis/StackSafetyAnalysis.cpp +++ b/llvm/lib/Analysis/StackSafetyAnalysis.cpp @@ -846,12 +846,14 @@ StackSafetyInfo::getParamAccesses(ModuleSummaryIndex &Index) const { Param.Calls.emplace_back(C.first.ParamNo, Index.getOrInsertValueInfo(C.first.Callee), C.second); - llvm::sort(Param.Calls, [](const FunctionSummary::ParamAccess::Call &L, - const FunctionSummary::ParamAccess::Call &R) { - return std::tie(L.ParamNo, L.Callee) < std::tie(R.ParamNo, R.Callee); - }); } } + for (FunctionSummary::ParamAccess &Param : ParamAccesses) { + sort(Param.Calls, [](const FunctionSummary::ParamAccess::Call &L, + const FunctionSummary::ParamAccess::Call &R) { + return std::tie(L.ParamNo, L.Callee) < std::tie(R.ParamNo, R.Callee); + }); + } return ParamAccesses; } diff --git a/llvm/test/Bitcode/thinlto-function-summary-paramaccess.ll b/llvm/test/Bitcode/thinlto-function-summary-paramaccess.ll index 3b53e73..8b6b0bb 100644 --- a/llvm/test/Bitcode/thinlto-function-summary-paramaccess.ll +++ b/llvm/test/Bitcode/thinlto-function-summary-paramaccess.ll @@ -230,7 +230,7 @@ entry: } ; SSI-LABEL: for function 'CallMany2' -; SSI: p[]: empty-set, @Callee(arg0, [-715,125)) +; SSI: p[]: empty-set, @Callee(arg0, [-715,125)), @Callee2(arg1, [-33,-32)) ; BC-NEXT: ; BC-NEXT: