-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wrong code at -Os and above on x86_64-linux-gnu #50288
Comments
assigned to @rotateright |
Looks like something broke in instcombine with respect to poison. Taking a look now... |
Something in this patch: Reduced test: define i1 @#50944 (i1 %b) { $ opt -instcombine selpoison.ll -S ...which is wrong because there's clearly no poison returned if %b is false. This was and should be simplified to 'false'. Interestingly, the bug is not visible if I run instsimplify directly: So something is going wrong with the SimplifyQuery? |
Stepped through in the debugger to see why -instcombine behaves differently: we have this FIXME:
...so we don't simplify the select directly. We end up in SimplifyICmp which then calls handleOtherCmpSelSimplifications() -
...and that conversion to logic ops looks suspect. |
*** Bug llvm/llvm-bugzilla-archive#50952 has been marked as a duplicate of this bug. *** |
The final fix looks valid to me as well! |
mentioned in issue llvm/llvm-bugzilla-archive#50947 |
mentioned in issue llvm/llvm-bugzilla-archive#50952 |
Extended Description
This seems to be a recent regression.
[512] % clangtk -v
clang version 13.0.0 (https://github.com/llvm/llvm-project.git 0c96a92)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/opfuzz/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@MX32
Selected multilib: .;@m64
[513] %
[513] % clangtk -O1 small.c; ./a.out
[514] %
[514] % clangtk -Os small.c
[515] % ./a.out
Aborted
[516] %
[516] % cat small.c
static int a, b, *c = &b, d;
int main() {
int e;
for (; a < 1; a++)
if (b)
d++;
b = 0;
if (!a)
b = 0 >> e;
c = 0;
if (d != 0)
__builtin_abort ();
return 0;
}
The text was updated successfully, but these errors were encountered: