[PATCH] D85182: [LTO,NFC] Skip generateParamAccessSummary when empty

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 19:01:34 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5c6d9b2bbfaf: [LTO,NFC] Skip generateParamAccessSummary when empty (authored by vitalybuka).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85182/new/

https://reviews.llvm.org/D85182

Files:
  llvm/include/llvm/IR/ModuleSummaryIndex.h
  llvm/lib/Analysis/StackSafetyAnalysis.cpp


Index: llvm/lib/Analysis/StackSafetyAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/StackSafetyAnalysis.cpp
+++ llvm/lib/Analysis/StackSafetyAnalysis.cpp
@@ -921,6 +921,8 @@
 }
 
 void llvm::generateParamAccessSummary(ModuleSummaryIndex &Index) {
+  if (!Index.hasParamAccess())
+    return;
   const ConstantRange FullSet(FunctionSummary::ParamAccess::RangeWidth, true);
   std::map<const FunctionSummary *, FunctionInfo<FunctionSummary>> Functions;
 
Index: llvm/include/llvm/IR/ModuleSummaryIndex.h
===================================================================
--- llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -1061,6 +1061,9 @@
   // some were not. Set when the combined index is created during the thin link.
   bool PartiallySplitLTOUnits = false;
 
+  /// True if some of the FunctionSummary contains a ParamAccess.
+  bool HasParamAccess = false;
+
   std::set<std::string> CfiFunctionDefs;
   std::set<std::string> CfiFunctionDecls;
 
@@ -1213,6 +1216,8 @@
   bool partiallySplitLTOUnits() const { return PartiallySplitLTOUnits; }
   void setPartiallySplitLTOUnits() { PartiallySplitLTOUnits = true; }
 
+  bool hasParamAccess() const { return HasParamAccess; }
+
   bool isGlobalValueLive(const GlobalValueSummary *GVS) const {
     return !WithGlobalValueDeadStripping || GVS->isLive();
   }
@@ -1284,6 +1289,8 @@
   /// Add a global value summary for the given ValueInfo.
   void addGlobalValueSummary(ValueInfo VI,
                              std::unique_ptr<GlobalValueSummary> Summary) {
+    if (const FunctionSummary *FS = dyn_cast<FunctionSummary>(Summary.get()))
+      HasParamAccess |= !FS->paramAccesses().empty();
     addOriginalName(VI.getGUID(), Summary->getOriginalName());
     // Here we have a notionally const VI, but the value it points to is owned
     // by the non-const *this.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85182.283792.patch
Type: text/x-patch
Size: 1922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200807/fc99e157/attachment.bin>


More information about the llvm-commits mailing list