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
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);
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;
/// \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
// RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
// RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix=CHECK-DEBUG %s
// expected-no-diagnostics
-// FIXME: This test stiil crashing because of mem leak.
-// REQUIRES: disabled
#ifndef HEADER
#define HEADER