[llvm] [IPO] NFC: avoid recalculating FunctionId hashes (PR #109014)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 17 10:04:35 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 823eab2bd5fcdade92790d0f53fc5978ae068e46 f4d6006516cd2a7f21af2d384bb894177dca648d --extensions h -- llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h b/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
index a09a35f804..4d6223a2a0 100644
--- a/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
+++ b/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
@@ -62,15 +62,14 @@ struct PrehashedFunctionId {
PrehashedFunctionId() = default;
- /* implicit */ PrehashedFunctionId(FunctionId FId) : Id(FId), Hash(hash_value(Id)) {}
+ /* implicit */ PrehashedFunctionId(FunctionId FId)
+ : Id(FId), Hash(hash_value(Id)) {}
FunctionId Id;
uint64_t Hash;
};
-inline uint64_t hash_value(const PrehashedFunctionId& Obj) {
- return Obj.Hash;
-}
+inline uint64_t hash_value(const PrehashedFunctionId &Obj) { return Obj.Hash; }
class ProfiledCallGraph {
public:
@@ -158,15 +157,15 @@ private:
// Link to synthetic root to make sure every node is reachable
// from root. This does not affect SCC order.
// Store the pointer of the node because the map can be rehashed.
- auto &Node =
- ProfiledCallGraphNodeList.emplace_back(ProfiledCallGraphNode(Name.Id));
+ auto &Node = ProfiledCallGraphNodeList.emplace_back(
+ ProfiledCallGraphNode(Name.Id));
ProfiledFunctions[Name] = &Node;
Root.Edges.emplace(&Root, ProfiledFunctions[Name], 0);
}
}
- void addProfiledCall(PrehashedFunctionId CallerName, PrehashedFunctionId CalleeName,
- uint64_t Weight = 0) {
+ void addProfiledCall(PrehashedFunctionId CallerName,
+ PrehashedFunctionId CalleeName, uint64_t Weight = 0) {
assert(ProfiledFunctions.count(CallerName));
auto CalleeIt = ProfiledFunctions.find(CalleeName);
if (CalleeIt == ProfiledFunctions.end())
@@ -226,7 +225,7 @@ private:
ProfiledCallGraphNode Root;
// backing buffer for ProfiledCallGraphNodes.
std::list<ProfiledCallGraphNode> ProfiledCallGraphNodeList;
- HashKeyMap<llvm::DenseMap, PrehashedFunctionId, ProfiledCallGraphNode*>
+ HashKeyMap<llvm::DenseMap, PrehashedFunctionId, ProfiledCallGraphNode *>
ProfiledFunctions;
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/109014
More information about the llvm-commits
mailing list