[llvm-dev] [Unsafe-fp-math] Merge attribute for inlining

Finkel, Hal J. via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 4 11:34:26 PST 2018


On 12/4/18 12:34 PM, Yan Luo via llvm-dev wrote:
Hello dev,

I have a question about unsafe-fp-math function attribute. Currently LLVM merges this attribute for inlining with logical AND. That means if caller has this attribute set but callee has not, LLVM will reset this attribute on caller. But shouldn’t we respect this attribute on caller? If caller wants to perform unsafe fp operation, any code that gets inlined should be allowed to do unsafe fp operation, right? Thanks!

The answer, by design, is no. At this point, all frontends should be generating per-instruction fast-math flags, and that should also have the property that the relevant semantics are preserved across inlining. The underlying concern is that, under LTO, code that was compiled without -ffast-math can be inlined into code compiled with -ffast-math, and this combined code must continue to work even when the strict semantics are required for correctness for the code compiled without -ffast-math.

 -Hal



Regards,
Yan



_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181204/4cbec955/attachment.html>


More information about the llvm-dev mailing list