-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Misoptimization: EarlyCSEPass
uses replaces powi.f16
with float
result
#98665
Labels
Comments
Reproducer: https://godbolt.org/z/jhM834G3z
There is a bug in constant folding. |
85 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It looks like EarlyCSEPass is transformin the following:
Into this:
And later InstCombine folds further into:
EarlyCSE seems to be doing an incorrect transformation: the result of
powi.f16(1.0, 1)
should behalf
1.0 (0x3c00), but it is returningfloat
1.0 (0x3f800000). This is incorrect and an OOB write.This comes from the following rust code, which asserts only when optimizations are enabled:
Link to compiler explorer: https://rust.godbolt.org/z/zsbzzxGvj
I'm not sure how to reduce to a llc example since the passes appear different. I have been testing on aarch64 since x86 has other f16 ABI bugs, but I don't think this is limited to aarch64.
The text was updated successfully, but these errors were encountered: