[llvm] dac9732 - [SCEV] Print block dispositions on mismatch (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 26 06:26:52 PDT 2023
Author: Nikita Popov
Date: 2023-06-26T15:26:44+02:00
New Revision: dac973226a600e93be6fafe742d7f5fe534b1572
URL: https://github.com/llvm/llvm-project/commit/dac973226a600e93be6fafe742d7f5fe534b1572
DIFF: https://github.com/llvm/llvm-project/commit/dac973226a600e93be6fafe742d7f5fe534b1572.diff
LOG: [SCEV] Print block dispositions on mismatch (NFC)
Added:
Modified:
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 59fd7a36edadb..513be579ce614 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -13567,16 +13567,36 @@ static void PrintLoopInfo(raw_ostream &OS, ScalarEvolution *SE,
}
}
-static StringRef loopDispositionToStr(ScalarEvolution::LoopDisposition LD) {
+namespace llvm {
+raw_ostream &operator<<(raw_ostream &OS, ScalarEvolution::LoopDisposition LD) {
switch (LD) {
case ScalarEvolution::LoopVariant:
- return "Variant";
+ OS << "Variant";
+ break;
case ScalarEvolution::LoopInvariant:
- return "Invariant";
+ OS << "Invariant";
+ break;
case ScalarEvolution::LoopComputable:
- return "Computable";
+ OS << "Computable";
+ break;
+ }
+ return OS;
+}
+
+raw_ostream &operator<<(raw_ostream &OS, ScalarEvolution::BlockDisposition BD) {
+ switch (BD) {
+ case ScalarEvolution::DoesNotDominateBlock:
+ OS << "DoesNotDominate";
+ break;
+ case ScalarEvolution::DominatesBlock:
+ OS << "Dominates";
+ break;
+ case ScalarEvolution::ProperlyDominatesBlock:
+ OS << "ProperlyDominates";
+ break;
}
- llvm_unreachable("Unknown ScalarEvolution::LoopDisposition kind!");
+ return OS;
+}
}
void ScalarEvolution::print(raw_ostream &OS) const {
@@ -13638,7 +13658,7 @@ void ScalarEvolution::print(raw_ostream &OS) const {
}
Iter->getHeader()->printAsOperand(OS, /*PrintType=*/false);
- OS << ": " << loopDispositionToStr(SE.getLoopDisposition(SV, Iter));
+ OS << ": " << SE.getLoopDisposition(SV, Iter);
}
for (const auto *InnerL : depth_first(L)) {
@@ -13652,7 +13672,7 @@ void ScalarEvolution::print(raw_ostream &OS) const {
}
InnerL->getHeader()->printAsOperand(OS, /*PrintType=*/false);
- OS << ": " << loopDispositionToStr(SE.getLoopDisposition(SV, InnerL));
+ OS << ": " << SE.getLoopDisposition(SV, InnerL);
}
OS << " }";
@@ -14238,9 +14258,8 @@ void ScalarEvolution::verify() const {
const auto RecomputedDisposition = SE2.getLoopDisposition(S, Loop);
if (CachedDisposition != RecomputedDisposition) {
dbgs() << "Cached disposition of " << *S << " for loop " << *Loop
- << " is incorrect: cached "
- << loopDispositionToStr(CachedDisposition) << ", actual "
- << loopDispositionToStr(RecomputedDisposition) << "\n";
+ << " is incorrect: cached " << CachedDisposition << ", actual "
+ << RecomputedDisposition << "\n";
std::abort();
}
}
@@ -14252,7 +14271,8 @@ void ScalarEvolution::verify() const {
const auto RecomputedDisposition = SE2.getBlockDisposition(S, BB);
if (CachedDisposition != RecomputedDisposition) {
dbgs() << "Cached disposition of " << *S << " for block %"
- << BB->getName() << " is incorrect! \n";
+ << BB->getName() << " is incorrect: cached " << CachedDisposition
+ << ", actual " << RecomputedDisposition << "\n";
std::abort();
}
}
More information about the llvm-commits
mailing list