-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[flang] Eliminate workaround for optimizing maxval Fortran intrinsic #65814
Conversation
Following llvm#65213, the optimization of the `arith.maxf` operation has transitioned from using the `maxnum` LLVM intrinsic to `maximum`. This modification renders the statement in the previous commit obsolete and the associated workaround unnecessary. Consequently, this commit removes the workaround and rectifies related test cases.
@vzakhari It seems like you've written this workaround. Could you please review the PR and tell if this change is ok? |
Also, if this PR is going to be merged, I would do it after #65800 is landed. |
Thank you! Would you be able to check what happens with F128 maxval case right now? Does LLVM call |
I'll try. Could you share some Fortran program reproducer, please? |
So I used this program to reproduce: program quad_precision_maxval
use, intrinsic :: iso_fortran_env, only: real128
real(real128) :: quad_array(5)
quad_array = [1.0_16, 2.0_16, 3.0_16, 4.0_16, 5.0_16]
max_value = maxval(quad_array)
print *, "Maximum value in the array:", max_value
end program quad_precision_maxval
$ ./build/bin/flang-new f.f90 $ ./a.out
Maximum value in the array: 5 $ objdump -d a.out | grep fmaxl
Works fine and no
$ ./build/bin/flang-new -ffast-math f.f90 $ ./a.out
Maximum value in the array: 5 $ objdump -d a.out | grep fmaxl
Works fine and no So, is this enough or have I missed something? |
Yes, it might be a bit complex to properly check this. Please try this:
|
Oh, so I forgot about optimizations flags in Flang.. |
Yes, I am reluctant to merge this change if it is going to cause tests failures. Filing an issue for LLVM would be great. |
@vzakhari |
I am not sure that |
There is no actual usecase. I just thought that narrowing the workaround down to the cases it is actually needed for would be better. |
Following #65213, the lowering of the
arith.maxf
operation has transitioned from using themaxnum
LLVM intrinsic tomaximum
. This modification renders the statement in the deleted here comment obsolete and the associated workaround unnecessary. Consequently, this commit removes the workaround and rectifies related test cases.