[llvm] [AggressiveInstCombine] Inline strcmp/strncmp (PR #89371)

Franklin Zhang via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 00:20:52 PDT 2024


FLZ101 wrote:

> This caused a miscompile in ffmpeg for x86 platforms.
> 
> It's reproducible on both Linux and MinGW, for both i686 and x86_64. To reproduce on linux on x86:
> 
> ```
> $ git clone https://github.com/ffmpeg/ffmpeg
> $ mkdir ffmpeg-build
> $ cd ffmpeg-build
> $ ../ffmpeg/configure --cc=clang --samples=$(pwd)/../samples
> $ make fate-rsync # download test samples
> $ make -j$(nproc) fate-subtitles
> ```
> 
> The miscompilation lies in the object file `libavformat/subtitles.o`.
> 
> I presume we should revert this until the issue has been resolved?

I can not reproduce the issue on an intel machine. 

The build script I use:

```sh
#!/bin/bash

set -e

llvm_dir=$(pwd)/llvm-project/install-x
export PATH=$llvm_dir/bin:$PATH

clang --version

export RSYNC_PROXY=$http_proxy
# git clone https://github.com/ffmpeg/ffmpeg
mkdir ffmpeg-build
cd ffmpeg-build
../ffmpeg/configure --cc=clang --samples=$(pwd)/../samples
make fate-rsync # download test samples
make -j$(nproc) fate-subtitles
```

I use the clang built from the latest main branch.

```
clang version 19.0.0git (https://github.com/FLZ101/llvm-project.git d70267fbae228990c47b5bdbce7aa659e8b5146e)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/zhangfenglei/work/llvm/llvm-project/install-x/bin
Build config: +assertions
```

And libavformat/subtitles.o is built without error.

![image](https://github.com/llvm/llvm-project/assets/10524662/2b27e581-9882-468a-a73a-1cfc97d73677)

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


More information about the llvm-commits mailing list