[llvm] [X86][APX] Remove redundant TEST*ri instructions (PR #155586)

Nathan Chancellor via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 28 16:28:58 PDT 2025


nathanchance wrote:

I also bisected strange behavior to this change, namely an `ld.lld` test now failing that did not at the parent commit.

```
# bad: [b34258a540d6d88d99269e870bc0e086762b7698] [X86] Add -fexperimental-new-constant-interpreter test coverage to the AVX1/F16C/XOP constexpr test files (#155865)
# good: [5d111a20c566d16f80faaa8eed1a382aacd045de] [DAGCombiner] Avoid double deletion when replacing multiple frozen/unfrozen uses (#155427)
git bisect start 'b34258a540d6d88d99269e870bc0e086762b7698' '5d111a20c566d16f80faaa8eed1a382aacd045de'
# good: [658a931c5bf3968daec1f020c3a403b1019dabd9] [CodeGen][RISCV] Add support of RISCV nontemporal to vector predication instructions. (#153033)
git bisect good 658a931c5bf3968daec1f020c3a403b1019dabd9
# bad: [7db1b2ad1e30a614677e6fa7195a127d7b04a0e8] [lldb][test] Run ranges::ref_vew test only for libc++ (#155813)
git bisect bad 7db1b2ad1e30a614677e6fa7195a127d7b04a0e8
# bad: [5a9f1039c7732920dd1f4374074fdf09b58184ea] [clang] Create PointerToBoolean casts for C casts (#155368)
git bisect bad 5a9f1039c7732920dd1f4374074fdf09b58184ea
# bad: [c2be0351a725c95e3841a8d59ee432f5b205763f] [LLDB] Omit loading local symbols in LLDB symbol table (#154809)
git bisect bad c2be0351a725c95e3841a8d59ee432f5b205763f
# good: [cb0ce1e4d1a37468d261e1c0a4b32f40b5ae5c20] [CI] Bump Linux Contaienr LLVM to 21.1.0 (#155658)
git bisect good cb0ce1e4d1a37468d261e1c0a4b32f40b5ae5c20
# good: [238fe4e908b9d6520fd719b076e88046cc6d5e17] [MLIR] Refix pr154556 (#155726)
git bisect good 238fe4e908b9d6520fd719b076e88046cc6d5e17
# good: [ebb305e3c789ba29d6711f3e78fe7324c257c7cc] [CI][NFC] Format files with Black
git bisect good ebb305e3c789ba29d6711f3e78fe7324c257c7cc
# bad: [9c9e56b81cdfd42ddb0de4f5efb3bf787978894e] [X86][APX] Remove redundant TEST*ri instructions (#155586)
git bisect bad 9c9e56b81cdfd42ddb0de4f5efb3bf787978894e
# good: [7f4d2c7e908373531a72729c12acf66077d5477f] gn build: Port f1ee0473209e
git bisect good 7f4d2c7e908373531a72729c12acf66077d5477f
# first bad commit: [9c9e56b81cdfd42ddb0de4f5efb3bf787978894e] [X86][APX] Remove redundant TEST*ri instructions (#155586)
```

```
$ cmake \
-B build/bootstrap \
-G Ninja \
-S llvm \
-Wno-dev \
--log-level=NOTICE \
-DCLANG_ENABLE_STATIC_ANALYZER=OFF \
-DCLANG_PLUGIN_SUPPORT=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DLLVM_BUILD_UTILS=OFF \
-DLLVM_DISTRIBUTION_COMPONENTS='llvm-ar;llvm-nm;llvm-objcopy;llvm-objdump;llvm-ranlib;llvm-readelf;llvm-strip;clang;clang-resource-headers;lld' \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_BACKTRACES=OFF \
-DLLVM_ENABLE_BINDINGS=OFF \
-DLLVM_ENABLE_LIBXML2=OFF \
-DLLVM_ENABLE_OCAMLDOC=OFF \
-DLLVM_ENABLE_PROJECTS='clang;lld' \
-DLLVM_ENABLE_WARNINGS=OFF \
-DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR= \
-DLLVM_INCLUDE_DOCS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_LINK_LLVM_DYLIB=OFF \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_USE_LINKER=lld
-- Configuring done (8.5s)
-- Generating done (1.1s)
-- Build files have been written to: .../build/bootstrap

$ ninja -C build/bootstrap distribution
ninja: Entering directory `build/bootstrap'
[3139/3139] Generating ../../bin/llvm-readelf

$ cmake \
-B build/final \
-G Ninja \
-S llvm \
-Wno-dev \
--log-level=NOTICE \
-DCLANG_ENABLE_STATIC_ANALYZER=OFF \
-DCLANG_PLUGIN_SUPPORT=OFF \
-DCLANG_TABLEGEN=$PWD/build/bootstrap/bin/clang-tblgen \
-DCMAKE_AR=$PWD/build/bootstrap/bin/llvm-ar \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=$PWD/build/bootstrap/bin/clang++ \
-DCMAKE_C_COMPILER=$PWD/build/bootstrap/bin/clang \
-DCMAKE_RANLIB=$PWD/build/bootstrap/bin/llvm-ranlib \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_BINDINGS=OFF \
-DLLVM_ENABLE_LIBXML2=OFF \
-DLLVM_ENABLE_OCAMLDOC=OFF \
-DLLVM_ENABLE_PROJECTS='clang;lld' \
-DLLVM_ENABLE_WARNINGS=OFF \
-DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR= \
-DLLVM_INCLUDE_DOCS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_LINK_LLVM_DYLIB=OFF \
-DLLVM_TABLEGEN=$PWD/build/bootstrap/bin/llvm-tblgen \
-DLLVM_TARGETS_TO_BUILD='AArch64;ARM;BPF;Hexagon;Mips;PowerPC;RISCV;Sparc;SystemZ;X86;LoongArch' \
-DLLVM_USE_LINKER=$PWD/build/bootstrap/bin/ld.lld
-- Configuring done (10.5s)
-- Generating done (2.6s)
-- Build files have been written to: .../build/final

$ ninja -C build/final check-lld
ninja: Entering directory `build/final'
[2764/2765] Running lld test suite
llvm-lit: .../llvm/utils/lit/lit/llvm/config.py:527: note: using ld.lld: .../build/final/bin/ld.lld
llvm-lit: .../llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: .../build/final/bin/lld-link
llvm-lit: .../llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: .../build/final/bin/ld64.lld
llvm-lit: .../llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: .../build/final/bin/wasm-ld
FAIL: lld :: COFF/unwind.test (497 of 3134)
******************** TEST 'lld :: COFF/unwind.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
.../build/final/bin/yaml2obj .../lld/test/COFF/unwind.test -o .../build/final/tools/lld/test/COFF/Output/unwind.test.tmp.obj # RUN: at line 1
+ .../build/final/bin/yaml2obj .../lld/test/COFF/unwind.test -o .../build/final/tools/lld/test/COFF/Output/unwind.test.tmp.obj
.../build/final/bin/lld-link /out:.../build/final/tools/lld/test/COFF/Output/unwind.test.tmp.exe /entry:main .../build/final/tools/lld/test/COFF/Output/unwind.test.tmp.obj # RUN: at line 3
+ .../build/final/bin/lld-link /out:.../build/final/tools/lld/test/COFF/Output/unwind.test.tmp.exe /entry:main .../build/final/tools/lld/test/COFF/Output/unwind.test.tmp.obj
.../build/final/bin/llvm-readobj --file-headers .../build/final/tools/lld/test/COFF/Output/unwind.test.tmp.exe | .../build/final/bin/FileCheck -check-prefix=HEADER .../lld/test/COFF/unwind.test # RUN: at line 4
+ .../build/final/bin/llvm-readobj --file-headers .../build/final/tools/lld/test/COFF/Output/unwind.test.tmp.exe
+ .../build/final/bin/FileCheck -check-prefix=HEADER .../lld/test/COFF/unwind.test
.../build/final/bin/llvm-objdump --unwind-info .../build/final/tools/lld/test/COFF/Output/unwind.test.tmp.exe | .../build/final/bin/FileCheck --check-prefix=UNWIND .../lld/test/COFF/unwind.test # RUN: at line 5
+ .../build/final/bin/llvm-objdump --unwind-info .../build/final/tools/lld/test/COFF/Output/unwind.test.tmp.exe
+ .../build/final/bin/FileCheck --check-prefix=UNWIND .../lld/test/COFF/unwind.test
.../lld/test/COFF/unwind.test:43:11: error: UNWIND: expected string not found in input
# UNWIND: Flags: 4 UNW_ChainInfo
          ^
<stdin>:27:12: note: scanning from here
 Version: 1
           ^
<stdin>:28:23: note: possible intended match here
 Flags: 4 UNW_ExceptionHandler UNW_ChainInfo
                      ^

Input file: <stdin>
Check file: .../lld/test/COFF/unwind.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
           22:
           23: Function Table:
           24:  Start Address: 0x1012
           25:  End Address: 0x1012
           26:  Unwind Info Address: 0x2020
           27:  Version: 1
check:43'0                X error: no match found
           28:  Flags: 4 UNW_ExceptionHandler UNW_ChainInfo
check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:43'1                           ?                       possible intended match
           29:  Size of prolog: 0
check:43'0     ~~~~~~~~~~~~~~~~~~~
           30:  Number of Codes: 0
check:43'0     ~~~~~~~~~~~~~~~~~~~~
           31:  No frame pointer used
check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~
           32:
check:43'0     ~
           33: Function Table:
check:43'0     ~~~~~~~~~~~~~~~~
            .
            .
            .
>>>>>>

--

********************
********************
Failed Tests (1):
  lld :: COFF/unwind.test


Testing Time: 6.38s

Total Discovered Tests: 3134
  Unsupported      :  255 (8.14%)
  Passed           : 2877 (91.80%)
  Expectedly Failed:    1 (0.03%)
  Failed           :    1 (0.03%)
FAILED: tools/lld/test/CMakeFiles/check-lld .../build/final/tools/lld/test/CMakeFiles/check-lld
cd .../build/final/tools/lld/test && /usr/bin/python3.13 .../build/final/./bin/llvm-lit -sv .../build/final/tools/lld/test
ninja: build stopped: subcommand failed.
```

https://github.com/llvm/llvm-project/pull/155586


More information about the llvm-commits mailing list