[PATCH] D15937: [LibCallSimplifier] use instruction-level fast-math-flags to transform sqrt calls

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 13:44:17 PST 2016


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

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

The intent of the patch is to preserve the current behavior of the transform except that we use the sqrt instruction's 'fast' attribute as a trigger rather than the function-level attribute.

But this raises a possible bug noted by the new FIXME comment. 

I think that in order to do this transform:
sqrt((x * x) * y) ---> fabs(x) * sqrt(y)

...we need all of the sqrt, the first fmul, and the second fmul to be 'fast'. If any of those ops is strict, we should bail out. Thoughts?

http://reviews.llvm.org/D15937

Files:
  lib/Transforms/Utils/SimplifyLibCalls.cpp
  test/Transforms/InstCombine/fast-math.ll
  test/Transforms/InstCombine/inline-intrinsic-assert.ll
  test/Transforms/InstCombine/no_cgscc_assert.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15937.44153.patch
Type: text/x-patch
Size: 9340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160106/bfcff0f9/attachment.bin>


More information about the llvm-commits mailing list