Skip to content

Commit f15e3e5

Browse files
[CGOpenMPRuntime] Use DenseMap::operator[] (NFC) (llvm#107158)
I'm planning to deprecate DenseMap::FindAndConstruct in favor of DenseMap::operator[].
1 parent 9a17a60 commit f15e3e5

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,10 +1149,8 @@ void CGOpenMPRuntime::emitUserDefinedReduction(
11491149
/*IsCombiner=*/false);
11501150
}
11511151
UDRMap.try_emplace(D, Combiner, Initializer);
1152-
if (CGF) {
1153-
auto &Decls = FunctionUDRMap.FindAndConstruct(CGF->CurFn);
1154-
Decls.second.push_back(D);
1155-
}
1152+
if (CGF)
1153+
FunctionUDRMap[CGF->CurFn].push_back(D);
11561154
}
11571155

11581156
std::pair<llvm::Function *, llvm::Function *>
@@ -1432,10 +1430,8 @@ llvm::Value *CGOpenMPRuntime::getThreadID(CodeGenFunction &CGF,
14321430
ThreadID = CGF.EmitLoadOfScalar(LVal, Loc);
14331431
// If value loaded in entry block, cache it and use it everywhere in
14341432
// function.
1435-
if (CGF.Builder.GetInsertBlock() == TopBlock) {
1436-
auto &Elem = OpenMPLocThreadIDMap.FindAndConstruct(CGF.CurFn);
1437-
Elem.second.ThreadID = ThreadID;
1438-
}
1433+
if (CGF.Builder.GetInsertBlock() == TopBlock)
1434+
OpenMPLocThreadIDMap[CGF.CurFn].ThreadID = ThreadID;
14391435
return ThreadID;
14401436
}
14411437
}
@@ -8640,8 +8636,7 @@ class MappableExprsHandler {
86408636
const MapData &BaseData = CI == CE ? L : L1;
86418637
OMPClauseMappableExprCommon::MappableExprComponentListRef SubData =
86428638
SI == SE ? Components : Components1;
8643-
auto &OverlappedElements = OverlappedData.FindAndConstruct(&BaseData);
8644-
OverlappedElements.getSecond().push_back(SubData);
8639+
OverlappedData[&BaseData].push_back(SubData);
86458640
}
86468641
}
86478642
}
@@ -9316,10 +9311,8 @@ void CGOpenMPRuntime::emitUserDefinedMapper(const OMPDeclareMapperDecl *D,
93169311
MapperCGF.EmitBlock(DoneBB, /*IsFinished=*/true);
93179312
MapperCGF.FinishFunction();
93189313
UDMMap.try_emplace(D, Fn);
9319-
if (CGF) {
9320-
auto &Decls = FunctionUDMMap.FindAndConstruct(CGF->CurFn);
9321-
Decls.second.push_back(D);
9322-
}
9314+
if (CGF)
9315+
FunctionUDMMap[CGF->CurFn].push_back(D);
93239316
}
93249317

93259318
/// Emit the array initialization or deletion portion for user-defined mapper

0 commit comments

Comments
 (0)