aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/LLVMContext.cpp
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2014-05-22 14:19:46 +0000
committerDiego Novillo <dnovillo@google.com>2014-05-22 14:19:46 +0000
commit7f8af8bf91ac2d33eceac932e3f5282ab2db25ba (patch)
treeb06d9fa0fdd5966834b5095d553f2c184128e61c /llvm/lib/IR/LLVMContext.cpp
parent8ff177ede3a1647b71a7db11e273f3dd81ef0ccb (diff)
downloadllvm-7f8af8bf91ac2d33eceac932e3f5282ab2db25ba.zip
llvm-7f8af8bf91ac2d33eceac932e3f5282ab2db25ba.tar.gz
llvm-7f8af8bf91ac2d33eceac932e3f5282ab2db25ba.tar.bz2
Add support for missed and analysis optimization remarks.
Summary: This adds two new diagnostics: -pass-remarks-missed and -pass-remarks-analysis. They take the same values as -pass-remarks but are intended to be triggered in different contexts. -pass-remarks-missed is used by LLVMContext::emitOptimizationRemarkMissed, which passes call when they tried to apply a transformation but couldn't. -pass-remarks-analysis is used by LLVMContext::emitOptimizationRemarkAnalysis, which passes call when they want to inform the user about analysis results. The patch also: 1- Adds support in the inliner for the two new remarks and a test case. 2- Moves emitOptimizationRemark* functions to the llvm namespace. 3- Adds an LLVMContext argument instead of making them member functions of LLVMContext. Reviewers: qcolombet Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D3682 llvm-svn: 209442
Diffstat (limited to 'llvm/lib/IR/LLVMContext.cpp')
-rw-r--r--llvm/lib/IR/LLVMContext.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp
index 5f94dca..7b75d42 100644
--- a/llvm/lib/IR/LLVMContext.cpp
+++ b/llvm/lib/IR/LLVMContext.cpp
@@ -142,14 +142,26 @@ void LLVMContext::diagnose(const DiagnosticInfo &DI) {
return;
}
- // Optimization remarks are selective. They need to check whether
- // the regexp pattern, passed via -pass-remarks, matches the name
- // of the pass that is emitting the diagnostic. If there is no match,
- // ignore the diagnostic and return.
- if (DI.getKind() == llvm::DK_OptimizationRemark &&
- !pImpl->optimizationRemarksEnabledFor(
- cast<DiagnosticInfoOptimizationRemark>(DI).getPassName()))
- return;
+ // Optimization remarks are selective. They need to check whether the regexp
+ // pattern, passed via one of the -pass-remarks* flags, matches the name of
+ // the pass that is emitting the diagnostic. If there is no match, ignore the
+ // diagnostic and return.
+ switch (DI.getKind()) {
+ case llvm::DK_OptimizationRemark:
+ if (!cast<DiagnosticInfoOptimizationRemark>(DI).isEnabled(pImpl))
+ return;
+ break;
+ case llvm::DK_OptimizationRemarkMissed:
+ if (!cast<DiagnosticInfoOptimizationRemarkMissed>(DI).isEnabled(pImpl))
+ return;
+ break;
+ case llvm::DK_OptimizationRemarkAnalysis:
+ if (!cast<DiagnosticInfoOptimizationRemarkAnalysis>(DI).isEnabled(pImpl))
+ return;
+ break;
+ default:
+ break;
+ }
// Otherwise, print the message with a prefix based on the severity.
std::string MsgStorage;
@@ -177,13 +189,6 @@ void LLVMContext::emitError(unsigned LocCookie, const Twine &ErrorStr) {
diagnose(DiagnosticInfoInlineAsm(LocCookie, ErrorStr));
}
-void LLVMContext::emitOptimizationRemark(const char *PassName,
- const Function &Fn,
- const DebugLoc &DLoc,
- const Twine &Msg) {
- diagnose(DiagnosticInfoOptimizationRemark(PassName, Fn, DLoc, Msg));
-}
-
//===----------------------------------------------------------------------===//
// Metadata Kind Uniquing
//===----------------------------------------------------------------------===//