[llvm] [CodeLayout] Fixing initialization of empty ranges (PR #68917)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 12 11:17:49 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: None (spupyrev)
<details>
<summary>Changes</summary>
Fixing libc++'s consistency checks, by eliminating ranges of singular iterators.
---
Full diff: https://github.com/llvm/llvm-project/pull/68917.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Utils/CodeLayout.cpp (+6-3)
``````````diff
diff --git a/llvm/lib/Transforms/Utils/CodeLayout.cpp b/llvm/lib/Transforms/Utils/CodeLayout.cpp
index 057a5e86c04aca1..6a789e5187f1310 100644
--- a/llvm/lib/Transforms/Utils/CodeLayout.cpp
+++ b/llvm/lib/Transforms/Utils/CodeLayout.cpp
@@ -476,13 +476,16 @@ void ChainT::mergeEdges(ChainT *Other) {
}
using NodeIter = std::vector<NodeT *>::const_iterator;
+static std::vector<NodeT *> EmptyList;
/// A wrapper around three chains of nodes; it is used to avoid extra
/// instantiation of the vectors.
struct MergedChain {
- MergedChain(NodeIter Begin1, NodeIter End1, NodeIter Begin2 = NodeIter(),
- NodeIter End2 = NodeIter(), NodeIter Begin3 = NodeIter(),
- NodeIter End3 = NodeIter())
+ MergedChain(NodeIter Begin1, NodeIter End1,
+ NodeIter Begin2 = EmptyList.begin(),
+ NodeIter End2 = EmptyList.end(),
+ NodeIter Begin3 = EmptyList.begin(),
+ NodeIter End3 = EmptyList.end())
: Begin1(Begin1), End1(End1), Begin2(Begin2), End2(End2), Begin3(Begin3),
End3(End3) {}
``````````
</details>
https://github.com/llvm/llvm-project/pull/68917
More information about the llvm-commits
mailing list