[llvm] 3b348d9 - [NFC][StackSafety] Move out sort from the loop

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 03:30:26 PDT 2020


Author: Vitaly Buka
Date: 2020-08-17T03:30:14-07:00
New Revision: 3b348d91028726f840868875dac3bcefcefda917

URL: https://github.com/llvm/llvm-project/commit/3b348d91028726f840868875dac3bcefcefda917
DIFF: https://github.com/llvm/llvm-project/commit/3b348d91028726f840868875dac3bcefcefda917.diff

LOG: [NFC][StackSafety] Move out sort from the loop

Added: 
    

Modified: 
    llvm/lib/Analysis/StackSafetyAnalysis.cpp
    llvm/test/Bitcode/thinlto-function-summary-paramaccess.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/StackSafetyAnalysis.cpp b/llvm/lib/Analysis/StackSafetyAnalysis.cpp
index 0a8a4cc446b4..023a72df1ca1 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 3b53e73ce1d4..8b6b0bb48ff9 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: <PARAM_ACCESS op0=0 op1=0 op2=0 op3=2 op4=0 op5=[[CALLEE]] op6=1431 op7=250 op8=1 op9=[[CALLEE2:-?[0-9]+]] op10=67 op11=65/>
 ; BC-NEXT: <PERMODULE
 ; DIS-DAG: = gv: (name: "CallMany2", summaries: {{.*}} calls: ((callee: ^{{.*}}), (callee: ^{{.*}})), params: ((param: 0, offset: [0, -1], calls: ((callee: ^{{.*}}, param: 0, offset: [-715, 124]), (callee: ^{{.*}}, param: 1, offset: [-33, -33]))))))) ; guid = 16654048340802466690


        


More information about the llvm-commits mailing list