Issue |
122400
|
Summary |
Incorrect fold unsigned icmp in glibc/wcsmbs/mbrtowc.c
|
Labels |
new issue
|
Assignees |
|
Reporter |
wzssyqa
|
Since commit
```
commit ae73bc8e94b3174e2b495eee544cf843b6e51899
Author: Nikita Popov <npo...@redhat.com>
Date: Tue Dec 3 14:28:56 2024 +0100
Reapply [InstCombine] Support gep nuw in icmp folds (#118472)
The profile runtime test failure this caused has been addressed in:
https://github.com/llvm/llvm-project/pull/118782
-----
Unsigned icmp of gep nuw folds to unsigned icmp of offsets. Unsigned
icmp of gep nusw nuw folds to unsigned samesign icmp of offsets.
Proofs: https://alive2.llvm.org/ce/z/VEwQY8
.../Transforms/InstCombine/InstCombineCompares.cpp | 36 ++++++++---
llvm/test/Transforms/InstCombine/icmp-gep.ll | 75 ++++++++++++++++++++++
2 files changed, 102 insertions(+), 9 deletions(-)
```
I meet a regression problem when build glibc with clang
In `glibc/wcsmbs/mbrtowc.c`, the follow code
```
inbuf = (const unsigned char *) s;
endbuf = inbuf + n;
if (__glibc_unlikely (endbuf < inbuf))
{
endbuf = (const unsigned char *) ~(uintptr_t) 0;
if (endbuf == inbuf)
goto ilseq;
}
```
is folded.
Howto reproduce:
1. git clone glibc and checkout branch `azanella/clang`
2. Build glibc with
```
CC=/build/llvm-project/build/bin/clang CXX=/build/llvm-project/build/bin/clang++ CFLAGS="-g -O2 -Wno-unused-command-line-argument" CXXFLAGS="-g -O2 -Wno-unused-command-line-argument" ../configure --host=riscv64-linux-gnu --prefix=/usr
make
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs