From 1a53b732e6bf1bbadd8d352573172c9d0c8b0cca Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Wed, 5 Feb 2020 22:23:29 -0600 Subject: [PATCH] Compile-fix after StringRef's conversion operator has been made explicit. Commit 777180a "[ADT] Make StringRef's std::string conversion operator explicit" caused Polly's GPU code generator to not compile anymore. The rest of Polly has already been fixed in commit 0257a9 "Fix polly build after StringRef change." --- polly/lib/CodeGen/ManagedMemoryRewrite.cpp | 4 ++-- polly/lib/CodeGen/PPCGCodeGeneration.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/polly/lib/CodeGen/ManagedMemoryRewrite.cpp b/polly/lib/CodeGen/ManagedMemoryRewrite.cpp index 7c2dba1..ad74fa2 100644 --- a/polly/lib/CodeGen/ManagedMemoryRewrite.cpp +++ b/polly/lib/CodeGen/ManagedMemoryRewrite.cpp @@ -212,14 +212,14 @@ replaceGlobalArray(Module &M, const DataLayout &DL, GlobalVariable &Array, // At this point, we have committed to replacing this array. ReplacedGlobals.insert(&Array); - std::string NewName = Array.getName(); + std::string NewName = Array.getName().str(); NewName += ".toptr"; GlobalVariable *ReplacementToArr = cast(M.getOrInsertGlobal(NewName, ElemPtrTy)); ReplacementToArr->setInitializer(ConstantPointerNull::get(ElemPtrTy)); Function *PollyMallocManaged = getOrCreatePollyMallocManaged(M); - std::string FnName = Array.getName(); + std::string FnName = Array.getName().str(); FnName += ".constructor"; PollyIRBuilder Builder(M.getContext()); FunctionType *Ty = FunctionType::get(Builder.getVoidTy(), false); diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp index 7224cbe..522dc3e 100644 --- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp +++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp @@ -1402,13 +1402,14 @@ const std::map IntrinsicToLibdeviceFunc = { /// so that we use intrinsics whenever possible. /// /// Return "" if we are not compiling for CUDA. -std::string getCUDALibDeviceFuntion(StringRef Name) { +std::string getCUDALibDeviceFuntion(StringRef NameRef) { + std::string Name = NameRef.str(); auto It = IntrinsicToLibdeviceFunc.find(Name); if (It != IntrinsicToLibdeviceFunc.end()) return getCUDALibDeviceFuntion(It->second); if (CUDALibDeviceFunctions.count(Name)) - return ("__nv_" + Name).str(); + return ("__nv_" + Name); return ""; } @@ -1760,7 +1761,7 @@ GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel, Function *F, void GPUNodeBuilder::setupKernelSubtreeFunctions( SetVector SubtreeFunctions) { for (auto Fn : SubtreeFunctions) { - const std::string ClonedFnName = Fn->getName(); + const std::string ClonedFnName = Fn->getName().str(); Function *Clone = GPUModule->getFunction(ClonedFnName); if (!Clone) Clone = @@ -2377,7 +2378,7 @@ std::string GPUNodeBuilder::createKernelASM() { PM.run(*GPUModule); - return ASMStream.str(); + return ASMStream.str().str(); } bool GPUNodeBuilder::requiresCUDALibDevice() { -- 2.7.4