Skip to content

Commit 55d3b6d

Browse files
committed
Revert "[utils] Add script to generate elaborated IR and assembly tests (llvm#89026)"
breaks 4 rhel lit tests This reverts commit aacea0d. Change-Id: I5ab315d33441fcebfb2b08b2402b780953dfd30a
1 parent 970ea3e commit 55d3b6d

15 files changed

+22
-314
lines changed

llvm/docs/TestingGuide.rst

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -433,87 +433,6 @@ actually participate in the test besides holding the ``RUN:`` lines.
433433
putting the extra files in an ``Inputs/`` directory. This pattern is
434434
deprecated.
435435

436-
Elaborated tests
437-
----------------
438-
439-
Generally, IR and assembly test files benefit from being cleaned to remove
440-
unnecessary details. However, for tests requiring elaborate IR or assembly
441-
files where cleanup is less practical (e.g., large amount of debug information
442-
output from Clang), you can include generation instructions within
443-
``split-file`` part called ``gen``. Then, run
444-
``llvm/utils/update_test_body.py`` on the test file to generate the needed
445-
content.
446-
447-
.. code-block:: none
448-
449-
; RUN: rm -rf %t && split-file %s %t && cd %t
450-
; RUN: opt -S a.ll ... | FileCheck %s
451-
452-
; CHECK: hello
453-
454-
;--- a.cc
455-
int va;
456-
;--- gen
457-
clang --target=x86_64-linux -S -emit-llvm -g a.cc -o -
458-
459-
;--- a.ll
460-
# content generated by the script 'gen'
461-
462-
.. code-block:: bash
463-
464-
PATH=/path/to/clang_build/bin:$PATH llvm/utils/update_test_body.py path/to/test.ll
465-
466-
The script will prepare extra files with ``split-file``, invoke ``gen``, and
467-
then rewrite the part after ``gen`` with its stdout.
468-
469-
For convenience, if the test needs one single assembly file, you can also wrap
470-
``gen`` and its required files with ``.ifdef`` and ``.endif``. Then you can
471-
skip ``split-file`` in RUN lines.
472-
473-
.. code-block:: none
474-
475-
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o a.o
476-
# RUN: ... | FileCheck %s
477-
478-
# CHECK: hello
479-
480-
.ifdef GEN
481-
#--- a.cc
482-
int va;
483-
#--- gen
484-
clang --target=x86_64-linux -S -g a.cc -o -
485-
.endif
486-
# content generated by the script 'gen'
487-
488-
.. note::
489-
490-
Consider specifying an explicit target triple to avoid differences when
491-
regeneration is needed on another machine.
492-
493-
``gen`` is invoked with ``PWD`` set to ``/proc/self/cwd``. Clang commands
494-
don't need ``-fdebug-compilation-dir=`` since its default value is ``PWD``.
495-
496-
Check prefixes should be placed before ``.endif`` since the part after
497-
``.endif`` is replaced.
498-
499-
If the test body contains multiple files, you can print ``---`` separators and
500-
utilize ``split-file`` in ``RUN`` lines.
501-
502-
.. code-block:: none
503-
504-
# RUN: rm -rf %t && split-file %s %t && cd %t
505-
...
506-
507-
#--- a.cc
508-
int va;
509-
#--- b.cc
510-
int vb;
511-
#--- gen
512-
clang --target=x86_64-linux -S -O1 -g a.cc -o -
513-
echo '#--- b.s'
514-
clang --target=x86_64-linux -S -O1 -g b.cc -o -
515-
#--- a.s
516-
517436
Fragile tests
518437
-------------
519438

llvm/test/tools/UpdateTestChecks/lit.local.cfg

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ def add_update_script_substition(
1919
# Specify an explicit default version in UTC tests, so that the --version
2020
# embedded in UTC_ARGS does not change in all test expectations every time
2121
# the default is bumped.
22-
if name != "%update_test_body":
23-
extra_args += " --version=1"
22+
extra_args += " --version=1"
2423
config.substitutions.append(
2524
(name, "'%s' %s %s" % (python_exe, script_path, extra_args))
2625
)
@@ -48,7 +47,3 @@ if os.path.isfile(llvm_mca_path):
4847
config.available_features.add("llvm-mca-binary")
4948
mca_arg = "--llvm-mca-binary " + shell_quote(llvm_mca_path)
5049
add_update_script_substition("%update_test_checks", extra_args=mca_arg)
51-
52-
split_file_path = os.path.join(config.llvm_tools_dir, "split-file")
53-
if os.path.isfile(split_file_path):
54-
add_update_script_substition("%update_test_body")

llvm/test/tools/UpdateTestChecks/update_test_body/Inputs/basic-asm.test.expected

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

llvm/test/tools/UpdateTestChecks/update_test_body/Inputs/basic.test.expected

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

llvm/test/tools/UpdateTestChecks/update_test_body/basic-asm.test

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

llvm/test/tools/UpdateTestChecks/update_test_body/basic.test

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

llvm/test/tools/UpdateTestChecks/update_test_body/empty-stdout.test

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

llvm/test/tools/UpdateTestChecks/update_test_body/gen-absent.test

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

llvm/test/tools/UpdateTestChecks/update_test_body/gen-fail.test

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

llvm/test/tools/UpdateTestChecks/update_test_body/gen-unterminated.test

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

llvm/test/tools/UpdateTestChecks/update_test_body/lit.local.cfg

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

llvm/test/tools/llvm-dwarfdump/X86/formclass4.s

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1+
# Source:
2+
# struct e {
3+
# enum {} f[16384];
4+
# short g;
5+
# };
6+
# e foo() {
7+
# auto E = new e;
8+
# return *E;
9+
# }
10+
# Compile with:
11+
# clang -O2 -gdwarf-4 -S a.cpp -o a4.s
12+
113
# RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o %t.o
214
# RUN: llvm-dwarfdump -debug-info -name g %t.o | FileCheck %s
315

416
# CHECK: DW_TAG_member
517
# CHECK: DW_AT_name ("g")
618
# CHECK: DW_AT_data_member_location (0x4000)
719

8-
.ifdef GEN
9-
#--- a.cpp
10-
struct e {
11-
enum {} f[16384];
12-
short g;
13-
};
14-
e foo() {
15-
auto E = new e;
16-
return *E;
17-
}
18-
#--- gen
19-
clang --target=x86_64-apple-macosx -O2 -gdwarf-4 -S a.cpp -o -
20-
.endif
21-
2220
.section __TEXT,__text,regular,pure_instructions
2321
.macosx_version_min 10, 14
2422
.globl __Z3foov ## -- Begin function _Z3foov

llvm/test/tools/llvm-dwarfdump/X86/prettyprint_type_units_split_v5.s

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# RUN: llvm-mc < %s -filetype obj -triple x86_64 -o - \
22
# RUN: | llvm-dwarfdump - | FileCheck %s
33

4+
# Generated from:
5+
#
6+
# struct t1 { };
7+
# t1 v1;
8+
#
9+
# $ clang++ -S -g -fdebug-types-section -gsplit-dwarf -o test.5.split.s -gdwarf-5 -g
10+
411
# CHECK: DW_TAG_variable
512
# CHECK: DW_AT_type ({{.*}} "t1")
613

7-
.ifdef GEN
8-
#--- test.cpp
9-
struct t1 { };
10-
t1 v1;
11-
#--- gen
12-
clang++ --target=x86_64-linux -S -g -fdebug-types-section -gsplit-dwarf -gdwarf-5 test.cpp -o -
13-
.endif
1414
.text
1515
.file "test.cpp"
1616
.section .debug_types.dwo,"e",@progbits

llvm/utils/update_test_body.py

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

revert_patches.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,5 @@ Reverts: breaks oclConformance
5050
SWDEV-460097
5151
merges: revert : 41466a177a95 [SelectionDAG] Correct the implementation of m_AllOnes. (#90776)
5252

53+
Revert "[utils] Add script to generate elaborated IR and assembly tests (#89026)"
54+
breaks 4 rhel lit tests

0 commit comments

Comments
 (0)