[clang] [CGOpenMPRuntime] Use DenseMap::operator[] (NFC) (PR #107158)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 3 15:12:18 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-codegen
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
I'm planning to deprecate DenseMap::FindAndConstruct in favor of
DenseMap::operator[].
---
Full diff: https://github.com/llvm/llvm-project/pull/107158.diff
1 Files Affected:
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+7-14)
``````````diff
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 34120486996fb1..23b977be816025 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -1149,10 +1149,8 @@ void CGOpenMPRuntime::emitUserDefinedReduction(
/*IsCombiner=*/false);
}
UDRMap.try_emplace(D, Combiner, Initializer);
- if (CGF) {
- auto &Decls = FunctionUDRMap.FindAndConstruct(CGF->CurFn);
- Decls.second.push_back(D);
- }
+ if (CGF)
+ FunctionUDRMap[CGF->CurFn].push_back(D);
}
std::pair<llvm::Function *, llvm::Function *>
@@ -1432,10 +1430,8 @@ llvm::Value *CGOpenMPRuntime::getThreadID(CodeGenFunction &CGF,
ThreadID = CGF.EmitLoadOfScalar(LVal, Loc);
// If value loaded in entry block, cache it and use it everywhere in
// function.
- if (CGF.Builder.GetInsertBlock() == TopBlock) {
- auto &Elem = OpenMPLocThreadIDMap.FindAndConstruct(CGF.CurFn);
- Elem.second.ThreadID = ThreadID;
- }
+ if (CGF.Builder.GetInsertBlock() == TopBlock)
+ OpenMPLocThreadIDMap[CGF.CurFn].ThreadID = ThreadID;
return ThreadID;
}
}
@@ -8640,8 +8636,7 @@ class MappableExprsHandler {
const MapData &BaseData = CI == CE ? L : L1;
OMPClauseMappableExprCommon::MappableExprComponentListRef SubData =
SI == SE ? Components : Components1;
- auto &OverlappedElements = OverlappedData.FindAndConstruct(&BaseData);
- OverlappedElements.getSecond().push_back(SubData);
+ OverlappedData[&BaseData].push_back(SubData);
}
}
}
@@ -9316,10 +9311,8 @@ void CGOpenMPRuntime::emitUserDefinedMapper(const OMPDeclareMapperDecl *D,
MapperCGF.EmitBlock(DoneBB, /*IsFinished=*/true);
MapperCGF.FinishFunction();
UDMMap.try_emplace(D, Fn);
- if (CGF) {
- auto &Decls = FunctionUDMMap.FindAndConstruct(CGF->CurFn);
- Decls.second.push_back(D);
- }
+ if (CGF)
+ FunctionUDMMap[CGF->CurFn].push_back(D);
}
/// Emit the array initialization or deletion portion for user-defined mapper
``````````
</details>
https://github.com/llvm/llvm-project/pull/107158
More information about the cfe-commits
mailing list