Skip to content

Commit 929d7c0

Browse files
authored
Merge branch 'main' into main
2 parents 9f2fb43 + f94e36d commit 929d7c0

File tree

3 files changed

+37
-41
lines changed

3 files changed

+37
-41
lines changed

llvm/docs/TestingGuide.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ tests are contained inside the LLVM repository itself under ``llvm/unittests``
3535
and ``llvm/test`` respectively and are expected to always pass. They should be
3636
run before every commit.
3737

38-
The whole programs tests are referred to as the "LLVM test suite" (or
38+
The whole-program tests are referred to as the "LLVM test suite" (or
3939
"test-suite") and are in the ``test-suite``
4040
`repository on GitHub <https://github.com/llvm/llvm-test-suite.git>`_.
4141
For historical reasons, these tests are also referred to as the "nightly
@@ -49,7 +49,7 @@ Unit tests are written using `Google Test <https://github.com/google/googletest/
4949
and `Google Mock <https://github.com/google/googletest/blob/master/docs/gmock_for_dummies.md>`_
5050
and are located in the ``llvm/unittests`` directory.
5151
In general, unit tests are reserved for targeting the support library and other
52-
generic data structure, we prefer relying on regression tests for testing
52+
generic data structure. We prefer relying on regression tests for testing
5353
transformations and analysis on the IR.
5454

5555
Regression tests
@@ -69,7 +69,7 @@ piece of LLVM IR distilled from an actual application or benchmark.
6969
Testing Analysis
7070
----------------
7171

72-
An analysis is a pass that infer properties on some part of the IR and not
72+
An analysis is a pass to infer properties on some part of the IR without
7373
transforming it. They are tested in general using the same infrastructure as the
7474
regression tests, by creating a separate "Printer" pass to consume the analysis
7575
result and print it on the standard output in a textual format suitable for
@@ -90,7 +90,7 @@ flags, and then executed to capture the program output and timing
9090
information. The output of these programs is compared to a reference
9191
output to ensure that the program is being compiled correctly.
9292

93-
In addition to compiling and executing programs, whole program tests
93+
In addition to compiling and executing programs, whole-program tests
9494
serve as a way of benchmarking LLVM performance, both in terms of the
9595
efficiency of the programs generated as well as the speed with which
9696
LLVM compiles, optimizes, and generates code.
@@ -104,7 +104,7 @@ Debugging Information tests
104104
---------------------------
105105

106106
The test suite contains tests to check the quality of debugging information.
107-
The tests are written in C based languages or in LLVM assembly language.
107+
The tests are written in C-based languages or in LLVM assembly language.
108108

109109
These tests are compiled and run under a debugger. The debugger output
110110
is checked to validate the debugging information. See ``README.txt`` in the
@@ -139,7 +139,7 @@ To run all of the LLVM regression tests, use the ``check-llvm`` target:
139139
% make check-llvm
140140
141141
In order to get reasonable testing performance, build LLVM and subprojects
142-
in release mode, i.e.
142+
in release mode, i.e.,
143143

144144
.. code-block:: bash
145145
@@ -159,7 +159,7 @@ variable to pass the required options to lit. For example, you can use:
159159
160160
% make check LIT_OPTS="-v --vg --vg-leak"
161161
162-
to enable testing with valgrind and with leak checking enabled.
162+
to enable testing with Valgrind and with leak checking enabled.
163163

164164
To run individual tests or subsets of tests, you can use the ``llvm-lit``
165165
script which is built as part of LLVM. For example, to run the
@@ -202,13 +202,13 @@ The LLVM regression tests are driven by :program:`lit` and are located in the
202202

203203
This directory contains a large array of small tests that exercise
204204
various features of LLVM and to ensure that regressions do not occur.
205-
The directory is broken into several sub-directories, each focused on a
205+
The directory is broken into several subdirectories, each focused on a
206206
particular area of LLVM.
207207

208208
Writing new regression tests
209209
----------------------------
210210

211-
The regression test structure is very simple, but does require some
211+
The regression test structure is very simple but does require some
212212
information to be set. This information is gathered via ``cmake``
213213
and is written to a file, ``test/lit.site.cfg.py`` in the build directory.
214214
The ``llvm/test`` Makefile does this work for you.
@@ -299,7 +299,7 @@ top to indicate that assertions were automatically generated.
299299
If you want to update assertions in an existing test case, pass the `-u` option
300300
which first checks the ``NOTE:`` line exists and matches the script name.
301301

302-
Sometimes a test absolutely depends on hand-written assertions and should not
302+
Sometimes, a test absolutely depends on hand-written assertions and should not
303303
have assertions automatically generated. In that case, add the text ``NOTE: Do
304304
not autogenerate`` to the first line, and the scripts will skip that test. It
305305
is a good idea to explain why generated assertions will not work for the test
@@ -428,7 +428,7 @@ For convenience, these are the contents:
428428
!llvm.ident = !{!0}
429429
!0 = metadata !{metadata !"Compiler V3"}
430430
431-
For symmetry reasons, ``ident.ll`` is just a dummy file that doesn't
431+
For symmetry, ``ident.ll`` is just a dummy file that doesn't
432432
actually participate in the test besides holding the ``RUN:`` lines.
433433

434434
.. note::
@@ -470,7 +470,7 @@ content.
470470
The script will prepare extra files with ``split-file``, invoke ``gen``, and
471471
then rewrite the part after ``gen`` with its stdout.
472472

473-
For convenience, if the test needs one single assembly file, you can also wrap
473+
For convenience, if the test needs a single assembly file, you can also wrap
474474
``gen`` and its required files with ``.ifdef`` and ``.endif``. Then you can
475475
skip ``split-file`` in ``RUN`` lines.
476476

@@ -869,7 +869,7 @@ Additional substitutions can be defined as follows:
869869
substitutions for all tests in a test directory. They do so by extending the
870870
substitution list, ``config.substitutions``. Each item in the list is a tuple
871871
consisting of a pattern and its replacement, which lit applies as plain text
872-
(even if it contains sequences that python's ``re.sub`` considers to be
872+
(even if it contains sequences that Python's ``re.sub`` considers to be
873873
escape sequences).
874874
- To define substitutions within a single test file, lit supports the
875875
``DEFINE:`` and ``REDEFINE:`` directives, described in detail below. So that
@@ -976,7 +976,7 @@ directives:
976976
colons. This syntax has a few advantages:
977977

978978
- It is impossible for ``%{name}`` to contain sequences that are special in
979-
python's ``re.sub`` patterns. Otherwise, attempting to specify
979+
Python's ``re.sub`` patterns. Otherwise, attempting to specify
980980
``%{name}`` as a substitution pattern in a lit configuration file could
981981
produce confusing expansions.
982982
- The braces help avoid the possibility that another substitution's pattern
@@ -1039,7 +1039,7 @@ To address such use cases, lit configuration files support
10391039
to specify the maximum number of passes through the substitution list. Thus, in
10401040
the above example, setting the limit to 2 would cause lit to make a second pass
10411041
that expands ``%{inner}`` in the ``RUN:`` line, and the output from the ``echo``
1042-
command when then be:
1042+
command would then be:
10431043

10441044
.. code-block:: shell
10451045
@@ -1094,7 +1094,7 @@ a test fails.
10941094

10951095
Finally, any line that contains "END." will cause the special
10961096
interpretation of lines to terminate. This is generally done right after
1097-
the last RUN: line. This has two side effects:
1097+
the last ``RUN:`` line. This has two side effects:
10981098

10991099
(a) it prevents special interpretation of lines that are part of the test
11001100
program, not the instructions to the test case, and

llvm/include/llvm/ADT/Twine.h

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ class Twine {
150150
char character;
151151
unsigned int decUI;
152152
int decI;
153-
const unsigned long *decUL;
154-
const long *decL;
155-
const unsigned long long *decULL;
156-
const long long *decLL;
157-
const uint64_t *uHex;
153+
unsigned long decUL;
154+
long decL;
155+
unsigned long long decULL;
156+
long long decLL;
157+
uint64_t uHex;
158158
};
159159

160160
/// LHS - The prefix in the concatenation, which may be uninitialized for
@@ -336,22 +336,18 @@ class Twine {
336336
explicit Twine(int Val) : LHSKind(DecIKind) { LHS.decI = Val; }
337337

338338
/// Construct a twine to print \p Val as an unsigned decimal integer.
339-
explicit Twine(const unsigned long &Val) : LHSKind(DecULKind) {
340-
LHS.decUL = &Val;
341-
}
339+
explicit Twine(unsigned long Val) : LHSKind(DecULKind) { LHS.decUL = Val; }
342340

343341
/// Construct a twine to print \p Val as a signed decimal integer.
344-
explicit Twine(const long &Val) : LHSKind(DecLKind) { LHS.decL = &Val; }
342+
explicit Twine(long Val) : LHSKind(DecLKind) { LHS.decL = Val; }
345343

346344
/// Construct a twine to print \p Val as an unsigned decimal integer.
347-
explicit Twine(const unsigned long long &Val) : LHSKind(DecULLKind) {
348-
LHS.decULL = &Val;
345+
explicit Twine(unsigned long long Val) : LHSKind(DecULLKind) {
346+
LHS.decULL = Val;
349347
}
350348

351349
/// Construct a twine to print \p Val as a signed decimal integer.
352-
explicit Twine(const long long &Val) : LHSKind(DecLLKind) {
353-
LHS.decLL = &Val;
354-
}
350+
explicit Twine(long long Val) : LHSKind(DecLLKind) { LHS.decLL = Val; }
355351

356352
// FIXME: Unfortunately, to make sure this is as efficient as possible we
357353
// need extra binary constructors from particular types. We can't rely on
@@ -389,9 +385,9 @@ class Twine {
389385
/// @{
390386

391387
// Construct a twine to print \p Val as an unsigned hexadecimal integer.
392-
static Twine utohexstr(const uint64_t &Val) {
388+
static Twine utohexstr(uint64_t Val) {
393389
Child LHS, RHS;
394-
LHS.uHex = &Val;
390+
LHS.uHex = Val;
395391
RHS.twine = nullptr;
396392
return Twine(LHS, UHexKind, RHS, EmptyKind);
397393
}

llvm/lib/Support/Twine.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,19 @@ void Twine::printOneChild(raw_ostream &OS, Child Ptr, NodeKind Kind) const {
8888
OS << Ptr.decI;
8989
break;
9090
case Twine::DecULKind:
91-
OS << *Ptr.decUL;
91+
OS << Ptr.decUL;
9292
break;
9393
case Twine::DecLKind:
94-
OS << *Ptr.decL;
94+
OS << Ptr.decL;
9595
break;
9696
case Twine::DecULLKind:
97-
OS << *Ptr.decULL;
97+
OS << Ptr.decULL;
9898
break;
9999
case Twine::DecLLKind:
100-
OS << *Ptr.decLL;
100+
OS << Ptr.decLL;
101101
break;
102102
case Twine::UHexKind:
103-
OS.write_hex(*Ptr.uHex);
103+
OS.write_hex(Ptr.uHex);
104104
break;
105105
}
106106
}
@@ -144,16 +144,16 @@ void Twine::printOneChildRepr(raw_ostream &OS, Child Ptr, NodeKind Kind) const {
144144
OS << "decI:\"" << Ptr.decI << "\"";
145145
break;
146146
case Twine::DecULKind:
147-
OS << "decUL:\"" << *Ptr.decUL << "\"";
147+
OS << "decUL:\"" << Ptr.decUL << "\"";
148148
break;
149149
case Twine::DecLKind:
150-
OS << "decL:\"" << *Ptr.decL << "\"";
150+
OS << "decL:\"" << Ptr.decL << "\"";
151151
break;
152152
case Twine::DecULLKind:
153-
OS << "decULL:\"" << *Ptr.decULL << "\"";
153+
OS << "decULL:\"" << Ptr.decULL << "\"";
154154
break;
155155
case Twine::DecLLKind:
156-
OS << "decLL:\"" << *Ptr.decLL << "\"";
156+
OS << "decLL:\"" << Ptr.decLL << "\"";
157157
break;
158158
case Twine::UHexKind:
159159
OS << "uhex:\"" << Ptr.uHex << "\"";

0 commit comments

Comments
 (0)