[polly] 1a53b73 - Compile-fix after StringRef's conversion operator has been made explicit.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 5 20:29:31 PST 2020


Author: Michael Kruse
Date: 2020-02-05T22:28:05-06:00
New Revision: 1a53b732e6bf1bbadd8d352573172c9d0c8b0cca

URL: https://github.com/llvm/llvm-project/commit/1a53b732e6bf1bbadd8d352573172c9d0c8b0cca
DIFF: https://github.com/llvm/llvm-project/commit/1a53b732e6bf1bbadd8d352573172c9d0c8b0cca.diff

LOG: 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."

Added: 
    

Modified: 
    polly/lib/CodeGen/ManagedMemoryRewrite.cpp
    polly/lib/CodeGen/PPCGCodeGeneration.cpp

Removed: 
    


################################################################################
diff  --git a/polly/lib/CodeGen/ManagedMemoryRewrite.cpp b/polly/lib/CodeGen/ManagedMemoryRewrite.cpp
index 7c2dba1a5ecf..ad74fa276934 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<GlobalVariable>(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 7224cbec1c3d..522dc3e3674b 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -1402,13 +1402,14 @@ const std::map<std::string, std::string> 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<Function *> 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() {


        


More information about the llvm-commits mailing list