Navigation Menu

Skip to content
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

Closed
MatzeB opened this issue Jan 24, 2017 · 8 comments
Closed

GVNHoist illegally hoists div instruction #31077

MatzeB opened this issue Jan 24, 2017 · 8 comments
Labels
bugzilla Issues migrated from bugzilla

Comments

@MatzeB
Copy link
Contributor

MatzeB commented Jan 24, 2017

Bugzilla Link 31729
Resolution FIXED
Resolved on Mar 02, 2017 08:56
Version trunk
OS All
Blocks #30970
Attachments C reproducer, llvm ir reproducer
CC @zmodem,@hfinkel,@hiraditya,@sanjoy,@sebpop

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.

@hiraditya
Copy link
Collaborator

Fix for the bug: https://reviews.llvm.org/D29092

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 23, 2017

Is this a duplicate of bug #30154 ?

@MatzeB
Copy link
Contributor Author

MatzeB commented Feb 23, 2017

As far as I understand this bug only affects -Os and -Oz users, so #30154 is probably not a duplicate.

@MatzeB
Copy link
Contributor Author

MatzeB commented Feb 23, 2017

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).

@hiraditya
Copy link
Collaborator

bug 30806 is different. It is related to jump-threading.

@zmodem
Copy link
Collaborator

zmodem commented Mar 1, 2017

Fix for the bug: https://reviews.llvm.org/D29092

This was committed in r296642.

I'll merge that to 4.0 once it's been in trunk for a bit.

@hiraditya
Copy link
Collaborator

Thanks Hans.

@zmodem
Copy link
Collaborator

zmodem commented Mar 2, 2017

Merged to 4.0 in r296761.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

4 participants