From 0257a9218ba24fb9152faf267353b77c1fd17859 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 28 Jan 2020 19:44:20 -0800 Subject: [PATCH] Fix polly build after StringRef change. --- polly/lib/Analysis/ScopDetectionDiagnostic.cpp | 6 +++--- polly/lib/Analysis/ScopInfo.cpp | 4 ++-- polly/lib/CodeGen/BlockGenerators.cpp | 2 +- polly/lib/CodeGen/LoopGenerators.cpp | 2 +- polly/lib/Exchange/JSONExporter.cpp | 21 +++++++++++---------- polly/lib/Support/ScopLocation.cpp | 2 +- .../lib/Transform/RewriteByReferenceParameters.cpp | 2 +- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp index 1c116ec..d4e70d3 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 differ " "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 7925f105e..71bf8a0 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -1465,7 +1465,7 @@ StringMap 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(Val)) { auto *LoadOrigin = LI->getPointerOperand()->stripInBoundsOffsets(); if (LoadOrigin->hasName()) { diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp index c19d724..d844f87 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 4df1cef..fca800d 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 9276dfa..707260b 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 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 *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> result = diff --git a/polly/lib/Support/ScopLocation.cpp b/polly/lib/Support/ScopLocation.cpp index 1b5e82e..01f3d68 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(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 494280e..c742fa5 100644 --- a/polly/lib/Transform/RewriteByReferenceParameters.cpp +++ b/polly/lib/Transform/RewriteByReferenceParameters.cpp @@ -63,7 +63,7 @@ public: if (!Alloca) return; - std::string InstName = Alloca->getName(); + std::string InstName = Alloca->getName().str(); auto NewAlloca = new AllocaInst(Alloca->getType()->getElementType(), 0, -- 2.7.4