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

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 29 03:08:38 PDT 2025


phoebewang wrote:

> I also ran into this issue. The miscompilations can be reproduced with https://martin.st/temp/apv_entropy-preproc.c, compiled with `clang -target x86_64-linux-gnu apv_entropy-preproc.c -c -o out.o -O2`. The diff in output looks like this:
> 
> ```diff
> --- good.s      2025-08-29 09:34:24.970634708 +0300
> +++ bad.s       2025-08-29 09:34:16.822610156 +0300
> @@ -1228,7 +1228,6 @@
>         jmp     .LBB1_19
>  .LBB1_34:                               # %if.else157
>         movl    %r11d, %r9d
> -       testb   $1, %cl
>         jne     .LBB1_69
>         jmp     .LBB1_55
>  .LBB1_35:                               # %if.end104
> ```
> 
> It's possible to reproduce the failures at runtime, by cloning [http://github.com/ffmpeg/ffmpeg](https://github.com/ffmpeg/ffmpeg), configuring it with `./configure --cc=clang` and building `make -j$(nproc) fate-apv-entropy`, on x86_64 linux. The object file impacted by the miscompilation is `libavcodec/apv_entropy.o`.

Great! It's very helpful!

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


More information about the llvm-commits mailing list