[PATCH] D16122: [LibCallSimplifier] use instruction-level fast-math-flags to transform pow(x, [small integer]) calls

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 12 12:08:47 PST 2016


spatel created this revision.
spatel added reviewers: scanon, davide, hfinkel, mgrang.
spatel added a subscriber: llvm-commits.

This is a continuation of adding FMF to call instructions:
http://reviews.llvm.org/rL255555

As with D15937, the intent of the patch is to preserve the current behavior of the transform except that we use the pow call's 'fast' attribute as a trigger rather than a function-level attribute.

But this raises a possible improvement noted by the TODO comment:
Should all of the new instructions be marked 'fast' since they were derived from a fast pow()? I think a user of -ffast-math would expect that despite the potentially increased risk of numerical disaster. In particular, the possible 'fdiv' would benefit from being turned into a reciprocal estimate on a target that supports that. There's probably less risk/opportunity to do anything with the chain of dependent multiplies, but if we're going 'fast', we might as well flag them all?

http://reviews.llvm.org/D16122

Files:
  lib/Transforms/Utils/SimplifyLibCalls.cpp
  test/Transforms/InstCombine/pow-4.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16122.44658.patch
Type: text/x-patch
Size: 6486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160112/463c26d5/attachment.bin>


More information about the llvm-commits mailing list