Skip to content

Commit 3e9eda3

Browse files
committed
[TSAR, Parallel, DVMH] Fix, insertion into a map invalidates non-persistent iterators.
1 parent c0af9cc commit 3e9eda3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/Transform/Clang/DVMHSMAutoPar.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
//===----------------------------------------------------------------------===//
2525

2626
#include "SharedMemoryAutoPar.h"
27+
#include "tsar/ADT/PersistentMap.h"
2728
#include "tsar/ADT/SpanningTreeRelation.h"
2829
#include "tsar/Analysis/AnalysisServer.h"
2930
#include "tsar/Analysis/Attributes.h"
@@ -241,7 +242,7 @@ class ClangDVMHSMParallelization : public ClangSMParallelization {
241242
bcl::tagged<SmallVector<VariableT, 1>, VariableT>,
242243
bcl::tagged<unsigned, Hierarchy>>>;
243244

244-
using IPOMap = DenseMap<
245+
using IPOMap = PersistentMap<
245246
const Function *,
246247
std::tuple<bool, SmallPtrSet<const Value *, 4>,
247248
SmallVector<PragmaActual *, 4>,
@@ -1002,7 +1003,9 @@ bool ClangDVMHSMParallelization::initializeIPO(
10021003
continue;
10031004
if (isParallelCallee(*F, Node.get<Id>(), Reachability))
10041005
continue;
1005-
auto [ToIgnoreItr, IsNew] = mIPOMap.try_emplace(F);
1006+
IPOMap::persistent_iterator ToIgnoreItr;
1007+
bool IsNew;
1008+
std::tie(ToIgnoreItr, IsNew) = mIPOMap.try_emplace(F);
10061009
if (!GO.NoExternalCalls && hasExternalCalls(Node.template get<Id>()) ||
10071010
Node.template get<InCycle>() || !OptimizeAll ||
10081011
any_of(F->users(), [](auto *U) { return !isa<CallBase>(U); }))

0 commit comments

Comments
 (0)