[PATCH] Do not make -pass-remarks additive.

Diego Novillo dnovillo at google.com
Mon May 5 12:53:48 PDT 2014


Hi qcolombet,

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.

http://reviews.llvm.org/D3614

Files:
  lib/IR/LLVMContextImpl.cpp

Index: lib/IR/LLVMContextImpl.cpp
===================================================================
--- lib/IR/LLVMContextImpl.cpp
+++ lib/IR/LLVMContextImpl.cpp
@@ -73,22 +73,12 @@
 /// LLVMContext::emitOptimizationRemark.
 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 {
   void operator=(const std::string &Val) const {
     // Create a regexp object to match pass names for emitOptimizationRemark.
     if (!Val.empty()) {
-      if (!OptimizationRemarkExpr.empty())
-        OptimizationRemarkExpr += "|";
-      OptimizationRemarkExpr += "(" + Val + ")";
       delete OptimizationRemarkPattern;
-      OptimizationRemarkPattern = new Regex(OptimizationRemarkExpr);
+      OptimizationRemarkPattern = new Regex(Val);
       std::string RegexError;
       if (!OptimizationRemarkPattern->isValid(RegexError))
         report_fatal_error("Invalid regular expression '" + Val +
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3614.9085.patch
Type: text/x-patch
Size: 1289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140505/e6004662/attachment.bin>


More information about the llvm-commits mailing list