Skip to content

Commit e92a1c5

Browse files
committed
Revert "[Remarks] Introduce count subcommand for llvm-remarkutil. (llvm#66214)"
This reverts commit 31c2cf1, as it results in a broken LLVM build.
1 parent 31c2cf1 commit e92a1c5

24 files changed

+0
-914
lines changed

llvm/docs/CommandGuide/llvm-remarkutil.rst

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -110,80 +110,6 @@ if `--use-debug-loc` is passed then the CSV will include the source path, line n
110110
Source,Function,Count
111111
path:line:column,foo,3
112112

113-
.. _count_subcommand:
114-
115-
count
116-
~~~~~
117-
118-
..program:: llvm-remarkutil count
119-
120-
USAGE: :program:`llvm-remarkutil` count [*options*] <input file>
121-
122-
Summary
123-
^^^^^^^
124-
125-
:program:`llvm-remarkutil count` counts `remarks <https://llvm.org/docs/Remarks.html>` based on specified properties.
126-
By default the tool counts remarks based on how many occour in a source file or function or total for the generated remark file.
127-
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.
128-
129-
The tool contains utilities to filter the remark count based on remark name, pass name, argument value and remark type.
130-
OPTIONS
131-
-------
132-
133-
.. option:: --parser=<yaml|bitstream>
134-
135-
Select the type of input remark parser. Required.
136-
* ``yaml``: The tool will parse YAML remarks.
137-
* ``bitstream``: The tool will parse bitstream remarks.
138-
139-
.. option:: --count-by<value>
140-
Select option to collect remarks by.
141-
* ``remark-name``: count how many individual remarks exist.
142-
* ``arg``: count remarks based on specified arguments passed by --(r)args. The argument value must be a number.
143-
144-
.. option:: --group-by=<value>
145-
group count of remarks by property.
146-
* ``source``: Count will be collected per source path. Remarks with no debug location will not be counted.
147-
* ``function``: Count is collected per function.
148-
* ``function-with-loc``: Count is collected per function per source. Remarks with no debug location will not be counted.
149-
* ``Total``: Report a count for the provided remark file.
150-
151-
.. option:: --args[=arguments]
152-
If `count-by` is set to `arg` this flag can be used to collect from specified remark arguments represented as a comma seperated string.
153-
The arguments must have a numeral value to be able to count remarks by
154-
155-
.. option:: --rargs[=arguments]
156-
If `count-by` is set to `arg` this flag can be used to collect from specified remark arguments using regular expression.
157-
The arguments must have a numeral value to be able to count remarks by
158-
159-
.. option:: --pass-name[=<string>]
160-
Filter count by pass name.
161-
162-
.. option:: --rpass-name[=<string>]
163-
Filter count by pass name using regular expressions.
164-
165-
.. option:: --remark-name[=<string>]
166-
Filter count by remark name.
167-
168-
.. option:: --rremark-name[=<string>]
169-
Filter count by remark name using regular expressions.
170-
171-
.. option:: --filter-arg-by[=<string>]
172-
Filter count by argument value.
173-
174-
.. option:: --rfilter-arg-by[=<string>]
175-
Filter count by argument value using regular expressions.
176-
177-
.. option:: --remark-type=<value>
178-
Filter remarks by type with the following options.
179-
* ``unknown``
180-
* ``passed``
181-
* ``missed``
182-
* ``analysis``
183-
* ``analysis-fp-commute``
184-
* ``analysis-aliasing``
185-
* ``failure``
186-
187113
.. _size-diff_subcommand:
188114

189115
size-diff

llvm/include/llvm/Remarks/Remark.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ struct Argument {
5252

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

6157
// Create wrappers for C Binding types (see CBindingWrapping.h).

llvm/lib/Remarks/Remark.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "llvm/Remarks/Remark.h"
14-
#include "llvm/ADT/APInt.h"
1514
#include "llvm/ADT/ArrayRef.h"
1615
#include <optional>
1716

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

29-
/// Returns the value of a specified key parsed from StringRef.
30-
std::optional<int> Argument::getValAsInt() const {
31-
APInt KeyVal;
32-
if (Val.getAsInteger(10, KeyVal))
33-
return std::nullopt;
34-
return KeyVal.getSExtValue();
35-
}
36-
37-
bool Argument::isValInt() const { return getValAsInt().has_value(); }
38-
3928
void RemarkLocation::print(raw_ostream &OS) const {
4029
OS << "{ "
4130
<< "File: " << SourceFilePath << ", Line: " << SourceLine
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
RUN: llvm-remarkutil annotation-count --use-debug-loc --parser=yaml --annotation-type=remark %p/Inputs/annotation-count-with-dbg-loc.yaml | FileCheck %s
22
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
3-
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
4-
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
53

64
; CHECK-LABEL: Source,Function,Count
75
; CHECK: path/to/anno.c:1:2,func1,1
86
; CHECK: path/to/anno2.c:1:2,func2,2
97
; CHECK: path/to/anno3.c:1:2,func3,3
10-
11-
; COUNT-CHECK-LABEL: FuctionWithDebugLoc,count
12-
; COUNT-CHECK: path/to/anno.c:func1,1
13-
; COUNT-CHECK: path/to/anno2.c:func2,2
14-
; COUNT-CHECK: path/to/anno3.c:func3,3
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
RUN: llvm-remarkutil annotation-count --parser=yaml --annotation-type=remark %p/Inputs/annotation-count.yaml | FileCheck %s
22
RUN: llvm-remarkutil yaml2bitstream %p/Inputs/annotation-count.yaml | llvm-remarkutil annotation-count --parser=bitstream --annotation-type=remark | FileCheck %s
3-
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
4-
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
53

64
; CHECK-LABEL: Function,Count
75
; CHECK: func1,1
86
; CHECK: func2,2
97
; CHECK: func3,3
10-
11-
; COUNT-CHECK-LABEL: Function,count
12-
; COUNT-CHECK: func1,1
13-
; COUNT-CHECK: func2,2
14-
; COUNT-CHECK: func3,3
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
RUN: not llvm-remarkutil bitstream2yaml %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s
22
RUN: not llvm-remarkutil instruction-count --parser=bitstream %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s
33
RUN: not llvm-remarkutil annotation-count --parser=bitstream --annotation-type=remark %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s
4-
RUN: not llvm-remarkutil count --parser=bitstream %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s
5-
64
CHECK: error: Unknown magic number: expecting RMRK, got --- .
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
RUN: not llvm-remarkutil yaml2bitstream %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s
22
RUN: not llvm-remarkutil instruction-count --parser=yaml %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s
33
RUN: not llvm-remarkutil annotation-count --parser=yaml --annotation-type=remark %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s
4-
RUN: not llvm-remarkutil count --parser=yaml %p/Inputs/broken-remark -o - 2>&1 | FileCheck %s
5-
64
CHECK: error: Type, Pass, Name or Function missing

llvm/test/tools/llvm-remarkutil/count/Inputs/remark-count-by.yaml

Lines changed: 0 additions & 43 deletions
This file was deleted.

llvm/test/tools/llvm-remarkutil/count/Inputs/remark-filter-by.yaml

Lines changed: 0 additions & 40 deletions
This file was deleted.

llvm/test/tools/llvm-remarkutil/count/Inputs/remark-group-by.yaml

Lines changed: 0 additions & 54 deletions
This file was deleted.

llvm/test/tools/llvm-remarkutil/count/count-by-keys.test

Lines changed: 0 additions & 20 deletions
This file was deleted.

llvm/test/tools/llvm-remarkutil/count/count-by-remark.test

Lines changed: 0 additions & 20 deletions
This file was deleted.

llvm/test/tools/llvm-remarkutil/count/filter-by-pass-name.test

Lines changed: 0 additions & 10 deletions
This file was deleted.

llvm/test/tools/llvm-remarkutil/count/filter-by-remark-name.test

Lines changed: 0 additions & 10 deletions
This file was deleted.

llvm/test/tools/llvm-remarkutil/count/filter-by-type.test

Lines changed: 0 additions & 16 deletions
This file was deleted.

llvm/test/tools/llvm-remarkutil/count/group-by-function-with-loc.test

Lines changed: 0 additions & 7 deletions
This file was deleted.

llvm/test/tools/llvm-remarkutil/count/group-by-function.test

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)