Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[Remarks] Introduce count subcommand for llvm-remarkutil. (#66214)" #68905

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 0 additions & 74 deletions llvm/docs/CommandGuide/llvm-remarkutil.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,80 +110,6 @@ if `--use-debug-loc` is passed then the CSV will include the source path, line n
Source,Function,Count
path:line:column,foo,3

.. _count_subcommand:

count
~~~~~

..program:: llvm-remarkutil count

USAGE: :program:`llvm-remarkutil` count [*options*] <input file>

Summary
^^^^^^^

:program:`llvm-remarkutil count` counts `remarks <https://llvm.org/docs/Remarks.html>` based on specified properties.
By default the tool counts remarks based on how many occour in a source file or function or total for the generated remark file.
The tool also supports collecting count based on specific remark arguments. The specified arguments should have an integer value to be able to report a count.

The tool contains utilities to filter the remark count based on remark name, pass name, argument value and remark type.
OPTIONS
-------

.. option:: --parser=<yaml|bitstream>

Select the type of input remark parser. Required.
* ``yaml``: The tool will parse YAML remarks.
* ``bitstream``: The tool will parse bitstream remarks.

.. option:: --count-by<value>
Select option to collect remarks by.
* ``remark-name``: count how many individual remarks exist.
* ``arg``: count remarks based on specified arguments passed by --(r)args. The argument value must be a number.

.. option:: --group-by=<value>
group count of remarks by property.
* ``source``: Count will be collected per source path. Remarks with no debug location will not be counted.
* ``function``: Count is collected per function.
* ``function-with-loc``: Count is collected per function per source. Remarks with no debug location will not be counted.
* ``Total``: Report a count for the provided remark file.

.. option:: --args[=arguments]
If `count-by` is set to `arg` this flag can be used to collect from specified remark arguments represented as a comma seperated string.
The arguments must have a numeral value to be able to count remarks by

.. option:: --rargs[=arguments]
If `count-by` is set to `arg` this flag can be used to collect from specified remark arguments using regular expression.
The arguments must have a numeral value to be able to count remarks by

.. option:: --pass-name[=<string>]
Filter count by pass name.

.. option:: --rpass-name[=<string>]
Filter count by pass name using regular expressions.

.. option:: --remark-name[=<string>]
Filter count by remark name.

.. option:: --rremark-name[=<string>]
Filter count by remark name using regular expressions.

.. option:: --filter-arg-by[=<string>]
Filter count by argument value.

.. option:: --rfilter-arg-by[=<string>]
Filter count by argument value using regular expressions.

.. option:: --remark-type=<value>
Filter remarks by type with the following options.
* ``unknown``
* ``passed``
* ``missed``
* ``analysis``
* ``analysis-fp-commute``
* ``analysis-aliasing``
* ``failure``

.. _size-diff_subcommand:

size-diff
Expand Down
4 changes: 0 additions & 4 deletions llvm/include/llvm/Remarks/Remark.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ struct Argument {

/// Implement operator<< on Argument.
void print(raw_ostream &OS) const;
/// Return the value of argument as int.
std::optional<int> getValAsInt() const;
/// Check if the argument value can be parsed as int.
bool isValInt() const;
};

// Create wrappers for C Binding types (see CBindingWrapping.h).
Expand Down
11 changes: 0 additions & 11 deletions llvm/lib/Remarks/Remark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//

#include "llvm/Remarks/Remark.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include <optional>

Expand All @@ -26,16 +25,6 @@ std::string Remark::getArgsAsMsg() const {
return OS.str();
}

/// Returns the value of a specified key parsed from StringRef.
std::optional<int> Argument::getValAsInt() const {
APInt KeyVal;
if (Val.getAsInteger(10, KeyVal))
return std::nullopt;
return KeyVal.getSExtValue();
}

bool Argument::isValInt() const { return getValAsInt().has_value(); }

void RemarkLocation::print(raw_ostream &OS) const {
OS << "{ "
<< "File: " << SourceFilePath << ", Line: " << SourceLine
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
RUN: llvm-remarkutil annotation-count --use-debug-loc --parser=yaml --annotation-type=remark %p/Inputs/annotation-count-with-dbg-loc.yaml | FileCheck %s
RUN: llvm-remarkutil yaml2bitstream %p/Inputs/annotation-count-with-dbg-loc.yaml | llvm-remarkutil annotation-count --use-debug-loc --parser=bitstream --annotation-type=remark | FileCheck %s
RUN: llvm-remarkutil count --parser=yaml --count-by=arg --group-by=function-with-loc --remark-name="AnnotationSummary" %p/Inputs/annotation-count-with-dbg-loc.yaml | FileCheck %s --check-prefix=COUNT-CHECK
RUN: llvm-remarkutil yaml2bitstream %p/Inputs/annotation-count-with-dbg-loc.yaml | llvm-remarkutil count --parser=bitstream --count-by=arg --group-by=function-with-loc --remark-name="AnnotationSummary" | FileCheck %s --check-prefix=COUNT-CHECK

; CHECK-LABEL: Source,Function,Count
; CHECK: path/to/anno.c:1:2,func1,1
; CHECK: path/to/anno2.c:1:2,func2,2
; CHECK: path/to/anno3.c:1:2,func3,3

; COUNT-CHECK-LABEL: FuctionWithDebugLoc,count
; COUNT-CHECK: path/to/anno.c:func1,1
; COUNT-CHECK: path/to/anno2.c:func2,2
; COUNT-CHECK: path/to/anno3.c:func3,3
7 changes: 0 additions & 7 deletions llvm/test/tools/llvm-remarkutil/annotation-count.test
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
RUN: llvm-remarkutil annotation-count --parser=yaml --annotation-type=remark %p/Inputs/annotation-count.yaml | FileCheck %s
RUN: llvm-remarkutil yaml2bitstream %p/Inputs/annotation-count.yaml | llvm-remarkutil annotation-count --parser=bitstream --annotation-type=remark | FileCheck %s
RUN: llvm-remarkutil count --parser=yaml --count-by=arg --group-by=function --remark-name="AnnotationSummary" %p/Inputs/annotation-count.yaml | FileCheck %s --check-prefix=COUNT-CHECK
RUN: llvm-remarkutil yaml2bitstream %p/Inputs/annotation-count.yaml | llvm-remarkutil count --parser=bitstream --count-by=arg --group-by=function --remark-name="AnnotationSummary" | FileCheck %s --check-prefix=COUNT-CHECK

; CHECK-LABEL: Function,Count
; CHECK: func1,1
; CHECK: func2,2
; CHECK: func3,3

; COUNT-CHECK-LABEL: Function,count
; COUNT-CHECK: func1,1
; COUNT-CHECK: func2,2
; COUNT-CHECK: func3,3
2 changes: 0 additions & 2 deletions llvm/test/tools/llvm-remarkutil/broken-bitstream-remark.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
RUN: not llvm-remarkutil bitstream2yaml %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s
RUN: not llvm-remarkutil instruction-count --parser=bitstream %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s
RUN: not llvm-remarkutil annotation-count --parser=bitstream --annotation-type=remark %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s
RUN: not llvm-remarkutil count --parser=bitstream %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s

CHECK: error: Unknown magic number: expecting RMRK, got --- .
2 changes: 0 additions & 2 deletions llvm/test/tools/llvm-remarkutil/broken-yaml-remark.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
RUN: not llvm-remarkutil yaml2bitstream %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s
RUN: not llvm-remarkutil instruction-count --parser=yaml %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s
RUN: not llvm-remarkutil annotation-count --parser=yaml --annotation-type=remark %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s
RUN: not llvm-remarkutil count --parser=yaml %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s

CHECK: error: Type, Pass, Name or Function missing
43 changes: 0 additions & 43 deletions llvm/test/tools/llvm-remarkutil/count/Inputs/remark-count-by.yaml

This file was deleted.

40 changes: 0 additions & 40 deletions llvm/test/tools/llvm-remarkutil/count/Inputs/remark-filter-by.yaml

This file was deleted.

54 changes: 0 additions & 54 deletions llvm/test/tools/llvm-remarkutil/count/Inputs/remark-group-by.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions llvm/test/tools/llvm-remarkutil/count/count-by-keys.test

This file was deleted.

20 changes: 0 additions & 20 deletions llvm/test/tools/llvm-remarkutil/count/count-by-remark.test

This file was deleted.

10 changes: 0 additions & 10 deletions llvm/test/tools/llvm-remarkutil/count/filter-by-pass-name.test

This file was deleted.

10 changes: 0 additions & 10 deletions llvm/test/tools/llvm-remarkutil/count/filter-by-remark-name.test

This file was deleted.

16 changes: 0 additions & 16 deletions llvm/test/tools/llvm-remarkutil/count/filter-by-type.test

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions llvm/test/tools/llvm-remarkutil/count/group-by-function.test

This file was deleted.

Loading