-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
miscompilation due to LoopVectorize making a function vulnerable to integer divide-by-zero #89958
Labels
Comments
cc @fhahn |
fhahn
added a commit
to fhahn/llvm-project
that referenced
this issue
May 14, 2024
Introduce a utility to check if a SCEV expansion may introduce UB (couldn't find a similar utility after a quick glance) and use to the avoid vectorizing when expanding the trip count introduces UB. Fixes llvm#89958.
mub-at-arm
pushed a commit
to mub-at-arm/llvm-project
that referenced
this issue
May 16, 2024
Add test cases for llvm#89958.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://alive2.llvm.org/ce/z/Kx2anL
this function:
is getting optimized to:
the problem is that the optimized code can divide by zero even when the original code doesn't. to see this, pass 0 as an argument to
f
. I also independently verified on an x64-64 that the optimized code traps out with an FPE while the original code does not. it's LoopVectorize that's the culprit.cc @nunoplopes @Hatsunespica
The text was updated successfully, but these errors were encountered: