[llvm] [CodeLayout] Fixing initialization of empty ranges (PR #68917)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 12 11:13:31 PDT 2023
https://github.com/spupyrev created https://github.com/llvm/llvm-project/pull/68917
None
>From 3113e07bdc73cfb5fe883bf3c2ab17fd6ecea733 Mon Sep 17 00:00:00 2001
From: spupyrev <spupyrev at fb.com>
Date: Thu, 12 Oct 2023 10:50:10 -0700
Subject: [PATCH] [CodeLayout] Fixing initialization of empty ranges
---
llvm/lib/Transforms/Utils/CodeLayout.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
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) {}
More information about the llvm-commits
mailing list