[llvm] [LTO] Simplify calculateCallGraphRoot (NFC) (PR #107765)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 8 08:56:33 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-ir

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

The function returns an instance of FunctionSummary populated by
calculateCallGraphRoot regardless of whether Edges is empty or not.


---
Full diff: https://github.com/llvm/llvm-project/pull/107765.diff


1 Files Affected:

- (modified) llvm/include/llvm/IR/ModuleSummaryIndex.h (+1-8) 


``````````diff
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index dae208d0b132e4..288aba16702f56 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -1544,14 +1544,7 @@ class ModuleSummaryIndex {
         continue; // skip over non-root nodes
       Edges.push_back(std::make_pair(P.first, CalleeInfo{}));
     }
-    if (Edges.empty()) {
-      // Failed to find root - return an empty node
-      return FunctionSummary::makeDummyFunctionSummary(
-          SmallVector<FunctionSummary::EdgeTy, 0>());
-    }
-    auto CallGraphRoot =
-        FunctionSummary::makeDummyFunctionSummary(std::move(Edges));
-    return CallGraphRoot;
+    return FunctionSummary::makeDummyFunctionSummary(std::move(Edges));
   }
 
   bool withGlobalValueDeadStripping() const {

``````````

</details>


https://github.com/llvm/llvm-project/pull/107765


More information about the llvm-commits mailing list