[llvm] 3d75c7c - [CodeLayout] Fixing initialization of empty ranges (#68917)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 13 09:36:02 PDT 2023
Author: spupyrev
Date: 2023-10-13T09:35:56-07:00
New Revision: 3d75c7c11b5a9ccb66e16df65a37f981ae6f0083
URL: https://github.com/llvm/llvm-project/commit/3d75c7c11b5a9ccb66e16df65a37f981ae6f0083
DIFF: https://github.com/llvm/llvm-project/commit/3d75c7c11b5a9ccb66e16df65a37f981ae6f0083.diff
LOG: [CodeLayout] Fixing initialization of empty ranges (#68917)
Fixing libc++'s consistency checks, by eliminating ranges of singular
iterators.
Added:
Modified:
llvm/lib/Transforms/Utils/CodeLayout.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/CodeLayout.cpp b/llvm/lib/Transforms/Utils/CodeLayout.cpp
index dea91dcac21ae14..620b52b69c31d57 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 concatenated vectors (chains) of nodes; it is used
/// to avoid extra instantiation of the vectors.
struct MergedNodesT {
- MergedNodesT(NodeIter Begin1, NodeIter End1, NodeIter Begin2 = NodeIter(),
- NodeIter End2 = NodeIter(), NodeIter Begin3 = NodeIter(),
- NodeIter End3 = NodeIter())
+ MergedNodesT(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) {}
More information about the llvm-commits
mailing list