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
GVNHoist illegally hoists div instruction #31077
Comments
Fix for the bug: https://reviews.llvm.org/D29092 |
Is this a duplicate of bug #30154 ? |
As far as I understand this bug only affects -Os and -Oz users, so #30154 is probably not a duplicate. |
After some more discussion in the fix for this bug, it may very well be the same (and just the currently proposed fix being too narrow). |
bug 30806 is different. It is related to jump-threading. |
This was committed in r296642. I'll merge that to 4.0 once it's been in trunk for a bit. |
Thanks Hans. |
Merged to 4.0 in r296761. |
Extended Description
The attached testcase performs a division (by zero) before checking the condition present in the original sourcecode. The problem appears when compiling test-suite/SingleSource/UnitTests/SignlessTypes/rem.c with the -Oz flag.
I reduced the test to a small reproducer and will attach them here. Looking at the -print-after-all output it seems GVNHoist is to blame and the problem goes away with -gvn-max-hoisted=0 for me.
I can reproduce this on a macOS system with:
$ clang -Oz reduced.c
$ ./a.out
Floating point exception: 8
I attached a -O0 -emit-llvm .ll file for convenience but did not test whether that reproduces as well.
The text was updated successfully, but these errors were encountered: