[polly] 0257a92 - Fix polly build after StringRef change.

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 19:45:45 PST 2020


Author: Eli Friedman
Date: 2020-01-28T19:44:20-08:00
New Revision: 0257a9218ba24fb9152faf267353b77c1fd17859

URL: https://github.com/llvm/llvm-project/commit/0257a9218ba24fb9152faf267353b77c1fd17859
DIFF: https://github.com/llvm/llvm-project/commit/0257a9218ba24fb9152faf267353b77c1fd17859.diff

LOG: Fix polly build after StringRef change.

Added: 
    

Modified: 
    polly/lib/Analysis/ScopDetectionDiagnostic.cpp
    polly/lib/Analysis/ScopInfo.cpp
    polly/lib/CodeGen/BlockGenerators.cpp
    polly/lib/CodeGen/LoopGenerators.cpp
    polly/lib/Exchange/JSONExporter.cpp
    polly/lib/Support/ScopLocation.cpp
    polly/lib/Transform/RewriteByReferenceParameters.cpp

Removed: 
    


################################################################################
diff  --git a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
index 1c116ec3d1a8..d4e70d3dce4a 100644
--- a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
+++ b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
@@ -225,7 +225,7 @@ std::string ReportUnreachableInExit::getRemarkName() const {
 const Value *ReportUnreachableInExit::getRemarkBB() const { return BB; }
 
 std::string ReportUnreachableInExit::getMessage() const {
-  std::string BBName = BB->getName();
+  std::string BBName = BB->getName().str();
   return "Unreachable in exit block" + BBName;
 }
 
@@ -411,7 +411,7 @@ bool ReportDifferentArrayElementSize::classof(const RejectReason *RR) {
 
 std::string ReportDifferentArrayElementSize::getEndUserMessage() const {
   StringRef BaseName = BaseValue->getName();
-  std::string Name = BaseName.empty() ? "UNKNOWN" : BaseName;
+  std::string Name = BaseName.empty() ? "UNKNOWN" : BaseName.str();
   return "The array \"" + Name +
          "\" is accessed through elements that 
diff er "
          "in size";
@@ -438,7 +438,7 @@ bool ReportNonAffineAccess::classof(const RejectReason *RR) {
 
 std::string ReportNonAffineAccess::getEndUserMessage() const {
   StringRef BaseName = BaseValue->getName();
-  std::string Name = BaseName.empty() ? "UNKNOWN" : BaseName;
+  std::string Name = BaseName.empty() ? "UNKNOWN" : BaseName.str();
   return "The array subscript of \"" + Name + "\" is not affine";
 }
 

diff  --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 7925f105e84f..71bf8a0e6d3a 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -1465,7 +1465,7 @@ StringMap<std::string> KnownNames = {
 static std::string getCallParamName(CallInst *Call) {
   std::string Result;
   raw_string_ostream OS(Result);
-  std::string Name = Call->getCalledFunction()->getName();
+  std::string Name = Call->getCalledFunction()->getName().str();
 
   auto Iterator = KnownNames.find(Name);
   if (Iterator != KnownNames.end())
@@ -1496,7 +1496,7 @@ void Scop::createParameterId(const SCEV *Parameter) {
       // we use this name as it is likely to be unique and more useful than just
       // a number.
       if (Val->hasName())
-        ParameterName = Val->getName();
+        ParameterName = Val->getName().str();
       else if (LoadInst *LI = dyn_cast<LoadInst>(Val)) {
         auto *LoadOrigin = LI->getPointerOperand()->stripInBoundsOffsets();
         if (LoadOrigin->hasName()) {

diff  --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index c19d7241bc18..d844f8714051 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -956,7 +956,7 @@ void BlockGenerator::createExitPHINodeMerges(Scop &S) {
     if (PHI->getParent() != AfterMergeBB)
       continue;
 
-    std::string Name = PHI->getName();
+    std::string Name = PHI->getName().str();
     Value *ScalarAddr = getOrCreateAlloca(SAI);
     Value *Reload = Builder.CreateLoad(ScalarAddr, Name + ".ph.final_reload");
     Reload = Builder.CreateBitOrPointerCast(Reload, PHI->getType());

diff  --git a/polly/lib/CodeGen/LoopGenerators.cpp b/polly/lib/CodeGen/LoopGenerators.cpp
index 4df1cef16079..fca800dd511a 100644
--- a/polly/lib/CodeGen/LoopGenerators.cpp
+++ b/polly/lib/CodeGen/LoopGenerators.cpp
@@ -204,7 +204,7 @@ Function *ParallelLoopGenerator::createSubFnDefinition() {
 
   // Certain backends (e.g., NVPTX) do not support '.'s in function names.
   // Hence, we ensure that all '.'s are replaced by '_'s.
-  std::string FunctionName = SubFn->getName();
+  std::string FunctionName = SubFn->getName().str();
   std::replace(FunctionName.begin(), FunctionName.end(), '.', '_');
   SubFn->setName(FunctionName);
 

diff  --git a/polly/lib/Exchange/JSONExporter.cpp b/polly/lib/Exchange/JSONExporter.cpp
index 9276dfab7871..707260bb29fa 100644
--- a/polly/lib/Exchange/JSONExporter.cpp
+++ b/polly/lib/Exchange/JSONExporter.cpp
@@ -80,7 +80,7 @@ struct JSONImporter : public ScopPass {
 } // namespace
 
 static std::string getFileName(Scop &S, StringRef Suffix = "") {
-  std::string FunctionName = S.getFunction().getName();
+  std::string FunctionName = S.getFunction().getName().str();
   std::string FileName = FunctionName + "___" + S.getNameStr() + ".jscop";
 
   if (Suffix != "")
@@ -180,7 +180,7 @@ static void exportScop(Scop &S) {
   std::error_code EC;
   ToolOutputFile F(FileName, EC, llvm::sys::fs::OF_Text);
 
-  std::string FunctionName = S.getFunction().getName();
+  std::string FunctionName = S.getFunction().getName().str();
   errs() << "Writing JScop '" << S.getNameStr() << "' in function '"
          << FunctionName << "' to '" << FileName << "'.\n";
 
@@ -215,8 +215,8 @@ static bool importContext(Scop &S, const json::Object &JScop) {
     return false;
   }
 
-  isl::set NewContext =
-      isl::set{S.getIslCtx().get(), JScop.getString("context").getValue()};
+  isl::set NewContext = isl::set{S.getIslCtx().get(),
+                                 JScop.getString("context").getValue().str()};
 
   // Check whether the context was parsed successfully.
   if (!NewContext) {
@@ -528,7 +528,7 @@ importAccesses(Scop &S, const json::Object &JScop, const DataLayout &DL,
         // Statistics.
         ++NewAccessMapFound;
         if (NewAccessStrings)
-          NewAccessStrings->push_back(Accesses);
+          NewAccessStrings->push_back(Accesses.str());
         MA->setNewAccessRelation(isl::manage(NewAccessMap));
       } else {
         isl_map_free(NewAccessMap);
@@ -651,8 +651,9 @@ static bool importArrays(Scop &S, const json::Object &JScop) {
 
   for (; ArrayIdx < Arrays.size(); ArrayIdx++) {
     const json::Object &Array = *Arrays[ArrayIdx].getAsObject();
-    auto *ElementType = parseTextType(
-        Array.get("type")->getAsString().getValue(), S.getSE()->getContext());
+    auto *ElementType =
+        parseTextType(Array.get("type")->getAsString().getValue().str(),
+                      S.getSE()->getContext());
     if (!ElementType) {
       errs() << "Error while parsing element type for new array.\n";
       return false;
@@ -660,7 +661,7 @@ static bool importArrays(Scop &S, const json::Object &JScop) {
     const json::Array &SizesArray = *Array.getArray("sizes");
     std::vector<unsigned> DimSizes;
     for (unsigned i = 0; i < SizesArray.size(); i++) {
-      auto Size = std::stoi(SizesArray[i].getAsString().getValue());
+      auto Size = std::stoi(SizesArray[i].getAsString().getValue().str());
 
       // Check if the size if positive.
       if (Size <= 0) {
@@ -672,7 +673,7 @@ static bool importArrays(Scop &S, const json::Object &JScop) {
     }
 
     auto NewSAI = S.createScopArrayInfo(
-        ElementType, Array.getString("name").getValue(), DimSizes);
+        ElementType, Array.getString("name").getValue().str(), DimSizes);
 
     if (Array.get("allocation")) {
       NewSAI->setIsOnHeap(Array.getString("allocation").getValue() == "heap");
@@ -695,7 +696,7 @@ static bool importScop(Scop &S, const Dependences &D, const DataLayout &DL,
                        std::vector<std::string> *NewAccessStrings = nullptr) {
   std::string FileName = ImportDir + "/" + getFileName(S, ImportPostfix);
 
-  std::string FunctionName = S.getFunction().getName();
+  std::string FunctionName = S.getFunction().getName().str();
   errs() << "Reading JScop '" << S.getNameStr() << "' in function '"
          << FunctionName << "' from '" << FileName << "'.\n";
   ErrorOr<std::unique_ptr<MemoryBuffer>> result =

diff  --git a/polly/lib/Support/ScopLocation.cpp b/polly/lib/Support/ScopLocation.cpp
index 1b5e82ea6da9..01f3d68926d8 100644
--- a/polly/lib/Support/ScopLocation.cpp
+++ b/polly/lib/Support/ScopLocation.cpp
@@ -32,7 +32,7 @@ void getDebugLocation(const Region *R, unsigned &LineBegin, unsigned &LineEnd,
       auto *Scope = cast<DIScope>(DL.getScope());
 
       if (FileName.empty())
-        FileName = Scope->getFilename();
+        FileName = Scope->getFilename().str();
 
       unsigned NewLine = DL.getLine();
 

diff  --git a/polly/lib/Transform/RewriteByReferenceParameters.cpp b/polly/lib/Transform/RewriteByReferenceParameters.cpp
index 494280e3c83a..c742fa53e360 100644
--- a/polly/lib/Transform/RewriteByReferenceParameters.cpp
+++ b/polly/lib/Transform/RewriteByReferenceParameters.cpp
@@ -63,7 +63,7 @@ class RewriteByrefParams : public FunctionPass {
     if (!Alloca)
       return;
 
-    std::string InstName = Alloca->getName();
+    std::string InstName = Alloca->getName().str();
 
     auto NewAlloca =
         new AllocaInst(Alloca->getType()->getElementType(), 0,


        


More information about the llvm-commits mailing list