diff options
author | Adam Nemet <anemet@apple.com> | 2016-04-28 23:08:32 +0000 |
---|---|---|
committer | Adam Nemet <anemet@apple.com> | 2016-04-28 23:08:32 +0000 |
commit | 0ba164bbcba92404f2f8df7ee4129f2b059776a1 (patch) | |
tree | a020f2f12512d19c00a936097bae4787f3c72e0a /llvm/lib/Transforms/Scalar/LoopDistribute.cpp | |
parent | adeccf7658246b5a7f75a1d8b379e371bf9a2c9a (diff) | |
download | llvm-0ba164bbcba92404f2f8df7ee4129f2b059776a1.zip llvm-0ba164bbcba92404f2f8df7ee4129f2b059776a1.tar.gz llvm-0ba164bbcba92404f2f8df7ee4129f2b059776a1.tar.bz2 |
[LoopDist] Emit optimization remarks (-Rpass*)
I closely followed the precedents set by the vectorizer:
* With -Rpass-missed, the loop is reported with further details pointing
to -Rpass--analysis.
* -Rpass-analysis reports the details why distribution has failed.
* Regardless of -Rpass*, when distribution fails for a loop where
distribution was forced with the pragma, a warning is produced according
to -Wpass-failed. In this case the analysis info is also printed even
without -Rpass-analysis.
llvm-svn: 267952
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopDistribute.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopDistribute.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopDistribute.cpp b/llvm/lib/Transforms/Scalar/LoopDistribute.cpp index 1dcfcda..3b484f3 100644 --- a/llvm/lib/Transforms/Scalar/LoopDistribute.cpp +++ b/llvm/lib/Transforms/Scalar/LoopDistribute.cpp @@ -28,6 +28,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/LoopAccessAnalysis.h" #include "llvm/Analysis/LoopInfo.h" +#include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/Dominators.h" #include "llvm/Pass.h" #include "llvm/Support/CommandLine.h" @@ -745,7 +746,31 @@ public: /// \brief Provide diagnostics then \return with false. bool fail(llvm::StringRef Message) { + Function *F = L->getHeader()->getParent(); + LLVMContext &Ctx = F->getContext(); + bool Forced = isForced().getValueOr(false); + DEBUG(dbgs() << "Skipping; " << Message << "\n"); + + // With Rpass-missed report that distribution failed. + emitOptimizationRemarkMissed( + Ctx, LDIST_NAME, *F, L->getStartLoc(), + "loop not distributed: use -Rpass-analysis=loop-distribute for more " + "info"); + + // With Rpass-analysis report why. This is on by default if distribution + // was requested explicitly. + emitOptimizationRemarkAnalysis( + Ctx, Forced ? DiagnosticInfo::AlwaysPrint : LDIST_NAME, *F, + L->getStartLoc(), Twine("loop not distributed: ") + Message); + + // Also issue a warning if distribution was requested explicitly but it + // failed. + if (Forced) + Ctx.diagnose(DiagnosticInfoOptimizationFailure( + *F, L->getStartLoc(), "loop not disributed: failed " + "explicitly specified loop distribution")); + return false; } |