[PATCH] D142907: LangRef: Add "dynamic" option to "denormal-fp-math"

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 21 13:37:55 PDT 2023


efriedma added a comment.

If you have a library function that's built with "denormal-fp-math"="dynamic,dynamic", you can link it into code built in any mode, and LTO should be able to propagate that mode from the caller to the callee.  That doesn't require clang to do anything special; you can just specify -fdenormal-fp-math=dynamic while building the library, and the user specifies -fdenormal-fp-math=ieee while building their code.

I guess you're worried specifically about ODR inline functions, defined in headers?  The user specifies a specific mode because they know their code honors it... but the user might not be aware of the effect on functions defined in library headers.  Other libraries in the same binary might use the same header, but specify a different mode.  So if the user specifies a denormal mode, we should ignore it for ODR inline functions, because they didn't actually mean to apply the denormal mode to those definitions?

I'm not sure about applying those semantics automatically; I don't think there's any precedent in clang for anything like this.  The closest thing I can think of is -fvisibility-inlines-hidden.  I'd prefer to RFC it separately from the rest of the patch, and loop in clang frontend owners, since the precedent we set here will apply to other sorts of attributes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142907/new/

https://reviews.llvm.org/D142907



More information about the cfe-commits mailing list