This is an archive of the discontinued LLVM Phabricator instance.

[[flang]] Set default to -ffp-contract=fast
ClosedPublic

Authored by tblah on Nov 15 2022, 3:22 AM.

Details

Summary

Following the RFC at https://discourse.llvm.org/t/rfc-ffp-contract-default-value/66301

Set the default value for -ffp-contract to fast

This adds the fastmath<contract> attribute to fir.call and some floating point arithmetic operations, leading to the many test changes. Instead of testing for this specific attribute, I am using a regular expression to match all attributes.

Diff Detail

Event Timeline

tblah created this revision.Nov 15 2022, 3:22 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: arphaman. · View Herald Transcript
tblah requested review of this revision.Nov 15 2022, 3:22 AM
vzakhari accepted this revision.Nov 15 2022, 9:56 AM

Thank you for the changes! LGTM

flang/test/Fir/achar.f90
24

Just an observation: I think we should not be setting fastmath flags for calls that do not return any FP result. Such calls are not allowed to have fastmath flags in LLVM IR. I think we can fixup the flags in TargetRewrite where we create the final function signature for fir.call. I will look into it. This issue should not affect your changes in any way.

flang/test/Lower/HLFIR/expr-addr.f90
11

I personally would prefer that the pattern would look like {{.*}}: (without the space between } and :). The reason is to avoid further modifications if we stop attaching fastmath flags to such calls.

This revision is now accepted and ready to land.Nov 15 2022, 9:56 AM
tblah updated this revision to Diff 475766.Nov 16 2022, 4:07 AM

Thanks for review @vzakhari

I have updated " {{.*}} :" -> " {{.*}}:"

Thanks for review @vzakhari

I have updated " {{.*}} :" -> " {{.*}}:"

Thank you!

tblah closed this revision.Nov 17 2022, 8:02 AM

I pushed this with commit ID 4cc9437a7e649e2d1a1a47578f6ffb4d420b8d60

Apologies for forgetting to tag this differential in the commit message. I will be more careful next time.