diff options
Diffstat (limited to 'polly/lib/Analysis')
-rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 1 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopDetectionDiagnostic.cpp | 24 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopGraphPrinter.cpp | 15 |
3 files changed, 16 insertions, 24 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index a0385a66437..db04f0b0a88 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -51,6 +51,7 @@ #include "polly/ScopDetection.h" #include "polly/Support/SCEVValidator.h" #include "polly/Support/ScopHelper.h" +#include "polly/Support/ScopLocation.h" #include "polly/CodeGen/CodeGeneration.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/AliasAnalysis.h" diff --git a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp index c7d2b338797..f5b57f0fc83 100644 --- a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp +++ b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp @@ -18,6 +18,7 @@ // //===----------------------------------------------------------------------===// #include "polly/ScopDetectionDiagnostic.h" +#include "polly/Support/ScopLocation.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/AliasSetTracker.h" @@ -60,29 +61,6 @@ template <typename T> std::string operator+(Twine LHS, const T &RHS) { return LHS.concat(Buf).str(); } - -void getDebugLocation(const Region *R, unsigned &LineBegin, unsigned &LineEnd, - std::string &FileName) { - LineBegin = -1; - LineEnd = 0; - - for (const BasicBlock *BB : R->blocks()) - for (const Instruction &Inst : *BB) { - DebugLoc DL = Inst.getDebugLoc(); - if (!DL) - continue; - - auto *Scope = cast<DIScope>(DL.getScope()); - - if (FileName.empty()) - FileName = Scope->getFilename(); - - unsigned NewLine = DL.getLine(); - - LineBegin = std::min(LineBegin, NewLine); - LineEnd = std::max(LineEnd, NewLine); - } -} } namespace llvm { diff --git a/polly/lib/Analysis/ScopGraphPrinter.cpp b/polly/lib/Analysis/ScopGraphPrinter.cpp index ca1013341c8..f39893ea8a4 100644 --- a/polly/lib/Analysis/ScopGraphPrinter.cpp +++ b/polly/lib/Analysis/ScopGraphPrinter.cpp @@ -16,6 +16,7 @@ #include "polly/LinkAllPasses.h" #include "polly/ScopDetection.h" +#include "polly/Support/ScopLocation.h" #include "llvm/Analysis/DOTGraphTraitsPass.h" #include "llvm/Analysis/RegionInfo.h" #include "llvm/Analysis/RegionIterator.h" @@ -112,9 +113,21 @@ struct DOTGraphTraits<ScopDetection *> : public DOTGraphTraits<RegionNode *> { raw_ostream &O, unsigned depth = 0) { O.indent(2 * depth) << "subgraph cluster_" << static_cast<const void *>(R) << " {\n"; + unsigned LineBegin, LineEnd; + std::string FileName; + + getDebugLocation(R, LineBegin, LineEnd, FileName); + + std::string Location; + if (LineBegin != (unsigned)-1) { + Location = escapeString(FileName + ":" + std::to_string(LineBegin) + "-" + + std::to_string(LineEnd) + "\n"); + } + std::string ErrorMessage = SD->regionIsInvalidBecause(R); ErrorMessage = escapeString(ErrorMessage); - O.indent(2 * (depth + 1)) << "label = \"" << ErrorMessage << "\";\n"; + O.indent(2 * (depth + 1)) << "label = \"" << Location << ErrorMessage + << "\";\n"; if (SD->isMaxRegionInScop(*R)) { O.indent(2 * (depth + 1)) << "style = filled;\n"; |