<div dir="ltr">So, here are my thoughts on this. I'm curious what you, Steven, and others think though....<div><br></div><div>My initial feeling is that -ffinite-math-only should apply to *math* and not to *tests*. That is, we should be free to transform and optimize math assuming finite operands, but we can't make any assumptions about the results of testing for finite values. This means that the implementaiton of complex gets to leverage finite-math-only, but we can't nuke tests for infinities. I also think that we should aggressively optimize how the tests are done while preserving their functionality. So I guess I'm suggesting #2, #3, and #4 from your email as the path forward.</div><div><br></div><div>However, I can see an argument that forcing users to leverage __FINITE_MATH_ONLY__ in their library code is really annoying. So I would also be happy having two different mechanisms for testing for infinities (and NaNs, I'm just using the inf case an my example) -- one which is folded under finite-math-only, and one which survives. I'm not sure what to call the two interfaces though. Ideas?</div><div><br></div><div>In either case, I think we should definitely replace calls to functions with fast, inline, and ensured correct (according to whatever rules are appropriate in the particular case) implementations of these tests.</div><div><br></div><div>Also in either case, I think we should change the frontend and/or headers to add *call* attributes (on the actual call instruction) marking these operations as finite-math-only rather than relying on *caller* attributes or having to chase operands through phi nodes. This should essentially follow the same model we use for tagging floating point operations that can be optimized.</div><div><br></div><div>-Chandler</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Mar 28, 2016 at 3:23 AM Hal Finkel via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hfinkel updated this revision to Diff 51774.<br>
hfinkel added a comment.<br>
<br>
Updated library function names for Darwin (and NetBSD).<br>
<br>
<br>
<a href="http://reviews.llvm.org/D18513" rel="noreferrer" target="_blank">http://reviews.llvm.org/D18513</a><br>
<br>
Files:<br>
  include/llvm/Analysis/TargetLibraryInfo.def<br>
  include/llvm/Analysis/TargetLibraryInfo.h<br>
  include/llvm/Transforms/Utils/SimplifyLibCalls.h<br>
  lib/Analysis/TargetLibraryInfo.cpp<br>
  lib/Transforms/Utils/SimplifyLibCalls.cpp<br>
  test/Transforms/InstCombine/fp-classify-libcalls.ll<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>