-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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. |
86 tasks
tgross35
added a commit
to tgross35/rust
that referenced
this issue
Mar 11, 2025
This has been disabled due to an LLVM misoptimization with `powi.f16` [1]. This was fixed upstream and the fix is included in LLVM20, so tests no longer need to be disabled. [1]: llvm/llvm-project#98665
tgross35
added a commit
to tgross35/rust
that referenced
this issue
Mar 11, 2025
This has been disabled due to an LLVM misoptimization with `powi.f16` [1]. This was fixed upstream and the fix is included in LLVM20, so tests no longer need to be disabled. `f16` still remains disabled on MinGW due to the ABI issue. [1]: llvm/llvm-project#98665
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Mar 11, 2025
Enable `reliable_f16_math` on x86 This has been disabled due to an LLVM misoptimization with `powi.f16` [1]. This was fixed upstream and the fix is included in LLVM20, so tests no longer need to be disabled. `f16` still remains disabled on MinGW due to the ABI issue. [1]: llvm/llvm-project#98665 try-job: x86_64-gnu try-job: i686-gnu-1
jhpratt
added a commit
to jhpratt/rust
that referenced
this issue
Mar 27, 2025
Enable `reliable_f16_math` on x86 This has been disabled due to an LLVM misoptimization with `powi.f16` [1]. This was fixed upstream and the fix is included in LLVM20, so tests no longer need to be disabled. `f16` still remains disabled on MinGW due to the ABI issue. [1]: llvm/llvm-project#98665 try-job: x86_64-gnu try-job: i686-gnu-1
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: