summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-05-07 06:18:01 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-05-07 06:18:01 +0000
commit15007ba94a581bac1cf167db0f18ea607823477f (patch)
treec23be445a3a89be1d907c6be8dacc8551387d535 /clang/lib
parent5944d9ce3e53a479ca2e780a54eb1309e31da097 (diff)
downloadbcm5719-llvm-15007ba94a581bac1cf167db0f18ea607823477f.tar.gz
bcm5719-llvm-15007ba94a581bac1cf167db0f18ea607823477f.zip
[OPENMP] Fixed problem with temp removal on some platforms in codegen for '#pragma omp parallel'
llvm-svn: 208162
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGOpenMPRuntime.cpp14
-rw-r--r--clang/lib/CodeGen/CGOpenMPRuntime.h3
2 files changed, 7 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 2009f409118..da86e2b52d0 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -38,10 +38,7 @@ CGOpenMPRuntime::CGOpenMPRuntime(CodeGenModule &CGM)
llvm::Value *
CGOpenMPRuntime::GetOrCreateDefaultOpenMPLocation(OpenMPLocationFlags Flags) {
- llvm::Twine OpenMPDefaultLocName =
- ".kmpc_default_loc_" + llvm::Twine::utohexstr(Flags) + ".addr";
- llvm::Value *Entry =
- CGM.getModule().getNamedValue(OpenMPDefaultLocName.str());
+ llvm::Value *Entry = OpenMPDefaultLocMap.lookup(Flags);
if (!Entry) {
if (!DefaultOpenMPPSource) {
// Initialize default location for psource field of ident_t structure of
@@ -54,7 +51,7 @@ CGOpenMPRuntime::GetOrCreateDefaultOpenMPLocation(OpenMPLocationFlags Flags) {
llvm::ConstantExpr::getBitCast(DefaultOpenMPPSource, CGM.Int8PtrTy);
}
llvm::GlobalVariable *DefaultOpenMPLocation = cast<llvm::GlobalVariable>(
- CGM.CreateRuntimeVariable(IdentTy, OpenMPDefaultLocName.str()));
+ CGM.CreateRuntimeVariable(IdentTy, ".kmpc_default_loc.addr"));
DefaultOpenMPLocation->setUnnamedAddr(true);
DefaultOpenMPLocation->setConstant(true);
DefaultOpenMPLocation->setLinkage(llvm::GlobalValue::PrivateLinkage);
@@ -79,16 +76,13 @@ llvm::Value *CGOpenMPRuntime::EmitOpenMPUpdateLocation(
assert(CGF.CurFn && "No function in current CodeGenFunction.");
- llvm::Twine OpenMPLocName =
- ".kmpc_loc_" + llvm::Twine::utohexstr(Flags) + ".addr";
-
llvm::Value *LocValue = nullptr;
OpenMPLocMapTy::iterator I = OpenMPLocMap.find(CGF.CurFn);
if (I != OpenMPLocMap.end()) {
LocValue = I->second;
} else {
- // Generate "ident_t .kmpc_loc_<flags>.addr;"
- llvm::AllocaInst *AI = CGF.CreateTempAlloca(IdentTy, OpenMPLocName);
+ // Generate "ident_t .kmpc_loc.addr;"
+ llvm::AllocaInst *AI = CGF.CreateTempAlloca(IdentTy, ".kmpc_loc.addr");
AI->setAlignment(CGM.getDataLayout().getPrefTypeAlignment(IdentTy));
OpenMPLocMap[CGF.CurFn] = AI;
LocValue = AI;
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h
index 7ba7ada2b13..06103cf4d6f 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.h
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -76,6 +76,9 @@ private:
/// \brief Default const ident_t object used for initialization of all other
/// ident_t objects.
llvm::Constant *DefaultOpenMPPSource;
+ /// \brief Map of flags and corrsponding default locations.
+ typedef llvm::DenseMap<unsigned, llvm::Value *> OpenMPDefaultLocMapTy;
+ OpenMPDefaultLocMapTy OpenMPDefaultLocMap;
llvm::Value *GetOrCreateDefaultOpenMPLocation(OpenMPLocationFlags Flags);
/// \brief Describes ident structure that describes a source location.
/// All descriptions are taken from
OpenPOWER on IntegriCloud