[LoopUnroll] Port to the new streaming interface for opt remarks.
llvm-svn: 282834
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
index a8442e6..ab8c7b6 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -809,10 +809,11 @@
}
if (UP.Count < 2) {
if (PragmaEnableUnroll)
- ORE->emitOptimizationRemarkMissed(
- DEBUG_TYPE, L,
- "Unable to unroll loop as directed by unroll(enable) pragma "
- "because unrolled size is too large.");
+ ORE->emit(
+ OptimizationRemarkMissed(DEBUG_TYPE, "UnrollAsDirectedTooLarge",
+ L->getStartLoc(), L->getHeader())
+ << "Unable to unroll loop as directed by unroll(enable) pragma "
+ "because unrolled size is too large.");
UP.Count = 0;
}
} else {
@@ -820,19 +821,22 @@
}
if ((PragmaFullUnroll || PragmaEnableUnroll) && TripCount &&
UP.Count != TripCount)
- ORE->emitOptimizationRemarkMissed(
- DEBUG_TYPE, L,
- "Unable to fully unroll loop as directed by unroll pragma because "
- "unrolled size is too large.");
+ ORE->emit(
+ OptimizationRemarkMissed(DEBUG_TYPE, "FullUnrollAsDirectedTooLarge",
+ L->getStartLoc(), L->getHeader())
+ << "Unable to fully unroll loop as directed by unroll pragma because "
+ "unrolled size is too large.");
return ExplicitUnroll;
}
assert(TripCount == 0 &&
"All cases when TripCount is constant should be covered here.");
if (PragmaFullUnroll)
- ORE->emitOptimizationRemarkMissed(
- DEBUG_TYPE, L,
- "Unable to fully unroll loop as directed by unroll(full) pragma "
- "because loop has a runtime trip count.");
+ ORE->emit(
+ OptimizationRemarkMissed(DEBUG_TYPE,
+ "CantFullUnrollAsDirectedRuntimeTripCount",
+ L->getStartLoc(), L->getHeader())
+ << "Unable to fully unroll loop as directed by unroll(full) pragma "
+ "because loop has a runtime trip count.");
// 5th priority is runtime unrolling.
// Don't unroll a runtime trip count loop when it is disabled.
@@ -872,16 +876,19 @@
"multiple, "
<< TripMultiple << ". Reducing unroll count from "
<< OrigCount << " to " << UP.Count << ".\n");
+ using namespace ore;
if (PragmaCount > 0 && !UP.AllowRemainder)
- ORE->emitOptimizationRemarkMissed(
- DEBUG_TYPE, L,
- Twine("Unable to unroll loop the number of times directed by "
- "unroll_count pragma because remainder loop is restricted "
- "(that could architecture specific or because the loop "
- "contains a convergent instruction) and so must have an unroll "
- "count that divides the loop trip multiple of ") +
- Twine(TripMultiple) + ". Unrolling instead " + Twine(UP.Count) +
- " time(s).");
+ ORE->emit(
+ OptimizationRemarkMissed(DEBUG_TYPE,
+ "DifferentUnrollCountFromDirected",
+ L->getStartLoc(), L->getHeader())
+ << "Unable to unroll loop the number of times directed by "
+ "unroll_count pragma because remainder loop is restricted "
+ "(that could architecture specific or because the loop "
+ "contains a convergent instruction) and so must have an unroll "
+ "count that divides the loop trip multiple of "
+ << NV("TripMultiple", TripMultiple) << ". Unrolling instead "
+ << NV("UnrollCount", UP.Count) << " time(s).");
}
if (UP.Count > UP.MaxCount)