mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-18 06:38:41 +00:00
Do not make -pass-remarks additive.
Summary: When I initially introduced -pass-remarks, I thought it would be a neat idea to make it additive. So, if one used it as: $ llc -pass-remarks=inliner --pass-remarks=loop.* the compiler would build the regular expression '(inliner)|(loop.*)'. The more I think about it, the more I regret it. This is not how other flags work. The standard semantics are right-to-left overrides. This is how clang interprets -Rpass. And I think the two should be compatible in this respect. Reviewers: qcolombet Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D3614 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208122 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2c06cd8612
commit
e3e870face
@ -73,22 +73,12 @@ namespace {
|
|||||||
/// LLVMContext::emitOptimizationRemark.
|
/// LLVMContext::emitOptimizationRemark.
|
||||||
static Regex *OptimizationRemarkPattern = nullptr;
|
static Regex *OptimizationRemarkPattern = nullptr;
|
||||||
|
|
||||||
/// \brief String to hold all the values passed via -pass-remarks. Every
|
|
||||||
/// instance of -pass-remarks on the command line will be concatenated
|
|
||||||
/// to this string. Values are stored inside braces and concatenated with
|
|
||||||
/// the '|' operator. This implements the expected semantics that multiple
|
|
||||||
/// -pass-remarks are additive.
|
|
||||||
static std::string OptimizationRemarkExpr;
|
|
||||||
|
|
||||||
struct PassRemarksOpt {
|
struct PassRemarksOpt {
|
||||||
void operator=(const std::string &Val) const {
|
void operator=(const std::string &Val) const {
|
||||||
// Create a regexp object to match pass names for emitOptimizationRemark.
|
// Create a regexp object to match pass names for emitOptimizationRemark.
|
||||||
if (!Val.empty()) {
|
if (!Val.empty()) {
|
||||||
if (!OptimizationRemarkExpr.empty())
|
|
||||||
OptimizationRemarkExpr += "|";
|
|
||||||
OptimizationRemarkExpr += "(" + Val + ")";
|
|
||||||
delete OptimizationRemarkPattern;
|
delete OptimizationRemarkPattern;
|
||||||
OptimizationRemarkPattern = new Regex(OptimizationRemarkExpr);
|
OptimizationRemarkPattern = new Regex(Val);
|
||||||
std::string RegexError;
|
std::string RegexError;
|
||||||
if (!OptimizationRemarkPattern->isValid(RegexError))
|
if (!OptimizationRemarkPattern->isValid(RegexError))
|
||||||
report_fatal_error("Invalid regular expression '" + Val +
|
report_fatal_error("Invalid regular expression '" + Val +
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
; RUN: opt < %s -inline -pass-remarks='inline' -S 2>&1 | FileCheck %s
|
; RUN: opt < %s -inline -pass-remarks='inline' -S 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -inline -pass-remarks='inl.*' -S 2>&1 | FileCheck %s
|
; RUN: opt < %s -inline -pass-remarks='inl.*' -S 2>&1 | FileCheck %s
|
||||||
; RUN: opt < %s -inline -pass-remarks='vector' -pass-remarks='inl' -S 2>&1 | FileCheck %s
|
; RUN: opt < %s -inline -pass-remarks='vector' -pass-remarks='inl' -S 2>&1 | FileCheck %s
|
||||||
|
|
||||||
|
; These two should not yield an inline remark for the same reason.
|
||||||
|
; In the first command, we only ask for vectorizer remarks, in the
|
||||||
|
; second one we ask for the inliner, but we then ask for the vectorizer
|
||||||
|
; (thus overriding the first flag).
|
||||||
; RUN: opt < %s -inline -pass-remarks='vector' -S 2>&1 | FileCheck --check-prefix=REMARKS %s
|
; RUN: opt < %s -inline -pass-remarks='vector' -S 2>&1 | FileCheck --check-prefix=REMARKS %s
|
||||||
|
; RUN: opt < %s -inline -pass-remarks='inl' -pass-remarks='vector' -S 2>&1 | FileCheck --check-prefix=REMARKS %s
|
||||||
|
|
||||||
; RUN: opt < %s -inline -S 2>&1 | FileCheck --check-prefix=REMARKS %s
|
; RUN: opt < %s -inline -S 2>&1 | FileCheck --check-prefix=REMARKS %s
|
||||||
; RUN: not opt < %s -pass-remarks='(' 2>&1 | FileCheck --check-prefix=BAD-REGEXP %s
|
; RUN: not opt < %s -pass-remarks='(' 2>&1 | FileCheck --check-prefix=BAD-REGEXP %s
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user