forked from OSchip/llvm-project
[OPENMP]Avoid string concat where possible and use standard name
generation function, NFC.
This commit is contained in:
parent
cbc63fbdc4
commit
8b32192948
|
@ -24,6 +24,7 @@
|
|||
#include "clang/CodeGen/ConstantInitBuilder.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/SetOperations.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Bitcode/BitcodeReader.h"
|
||||
#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
|
@ -9085,8 +9086,9 @@ void CGOpenMPRuntime::emitUDMapperArrayInitOrDel(
|
|||
|
||||
// Evaluate if this is an array section.
|
||||
llvm::BasicBlock *IsDeleteBB =
|
||||
MapperCGF.createBasicBlock("omp.array" + Prefix + ".evaldelete");
|
||||
llvm::BasicBlock *BodyBB = MapperCGF.createBasicBlock("omp.array" + Prefix);
|
||||
MapperCGF.createBasicBlock(getName({"omp.array", Prefix, ".evaldelete"}));
|
||||
llvm::BasicBlock *BodyBB =
|
||||
MapperCGF.createBasicBlock(getName({"omp.array", Prefix}));
|
||||
llvm::Value *IsArray = MapperCGF.Builder.CreateICmpSGE(
|
||||
Size, MapperCGF.Builder.getInt64(1), "omp.arrayinit.isarray");
|
||||
MapperCGF.Builder.CreateCondBr(IsArray, IsDeleteBB, ExitBB);
|
||||
|
@ -9099,10 +9101,10 @@ void CGOpenMPRuntime::emitUDMapperArrayInitOrDel(
|
|||
llvm::Value *DeleteCond;
|
||||
if (IsInit) {
|
||||
DeleteCond = MapperCGF.Builder.CreateIsNull(
|
||||
DeleteBit, "omp.array" + Prefix + ".delete");
|
||||
DeleteBit, getName({"omp.array", Prefix, ".delete"}));
|
||||
} else {
|
||||
DeleteCond = MapperCGF.Builder.CreateIsNotNull(
|
||||
DeleteBit, "omp.array" + Prefix + ".delete");
|
||||
DeleteBit, getName({"omp.array", Prefix, ".delete"}));
|
||||
}
|
||||
MapperCGF.Builder.CreateCondBr(DeleteCond, BodyBB, ExitBB);
|
||||
|
||||
|
@ -11000,7 +11002,7 @@ Address CGOpenMPRuntime::getAddressOfLocalVariable(CodeGenFunction &CGF,
|
|||
|
||||
llvm::Value *Addr =
|
||||
CGF.EmitRuntimeCall(createRuntimeFunction(OMPRTL__kmpc_alloc), Args,
|
||||
CVD->getName() + ".void.addr");
|
||||
getName({CVD->getName(), ".void.addr"}));
|
||||
llvm::Value *FiniArgs[OMPAllocateCleanupTy::CleanupArgs] = {ThreadID, Addr,
|
||||
Allocator};
|
||||
llvm::FunctionCallee FiniRTLFn = createRuntimeFunction(OMPRTL__kmpc_free);
|
||||
|
@ -11010,7 +11012,7 @@ Address CGOpenMPRuntime::getAddressOfLocalVariable(CodeGenFunction &CGF,
|
|||
Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
Addr,
|
||||
CGF.ConvertTypeForMem(CGM.getContext().getPointerType(CVD->getType())),
|
||||
CVD->getName() + ".addr");
|
||||
getName({CVD->getName(), ".addr"}));
|
||||
return Address(Addr, Align);
|
||||
}
|
||||
|
||||
|
@ -11361,8 +11363,6 @@ CGOpenMPRuntime::LastprivateConditionalRAII::LastprivateConditionalRAII(
|
|||
Data.UseOriginalIV = true;
|
||||
return;
|
||||
}
|
||||
llvm::SmallString<16> Buffer;
|
||||
llvm::raw_svector_ostream OS(Buffer);
|
||||
PresumedLoc PLoc =
|
||||
CGM.getContext().getSourceManager().getPresumedLoc(S.getBeginLoc());
|
||||
assert(PLoc.isValid() && "Source location is expected to be always valid.");
|
||||
|
@ -11371,9 +11371,9 @@ CGOpenMPRuntime::LastprivateConditionalRAII::LastprivateConditionalRAII(
|
|||
if (auto EC = llvm::sys::fs::getUniqueID(PLoc.getFilename(), ID))
|
||||
CGM.getDiags().Report(diag::err_cannot_open_file)
|
||||
<< PLoc.getFilename() << EC.message();
|
||||
OS << "$pl_cond_" << ID.getDevice() << "_" << ID.getFile() << "_"
|
||||
<< PLoc.getLine() << "_" << PLoc.getColumn() << "$iv";
|
||||
Data.IVName = OS.str();
|
||||
Data.IVName = CGM.getOpenMPRuntime().getName(
|
||||
{"pl_cond", llvm::utostr(ID.getDevice()), llvm::utostr(ID.getFile()),
|
||||
llvm::utostr(PLoc.getLine()), llvm::utostr(PLoc.getColumn()), "iv"});
|
||||
}
|
||||
|
||||
CGOpenMPRuntime::LastprivateConditionalRAII::~LastprivateConditionalRAII() {
|
||||
|
@ -11496,7 +11496,7 @@ void CGOpenMPRuntime::checkAndEmitLastprivateConditional(CodeGenFunction &CGF,
|
|||
// int<xx> last_iv = 0;
|
||||
llvm::Type *LLIVTy = CGF.ConvertTypeForMem(IVLVal.getType());
|
||||
llvm::Constant *LastIV =
|
||||
getOrCreateInternalVariable(LLIVTy, UniqueDeclName + "$iv");
|
||||
getOrCreateInternalVariable(LLIVTy, getName({UniqueDeclName, "iv"}));
|
||||
cast<llvm::GlobalVariable>(LastIV)->setAlignment(
|
||||
IVLVal.getAlignment().getAsAlign());
|
||||
LValue LastIVLVal = CGF.MakeNaturalAlignAddrLValue(LastIV, IVLVal.getType());
|
||||
|
|
Loading…
Reference in New Issue