[PATCH] optimize away fabs calls when input is known positive

Sanjay Patel spatel at rotateright.com
Tue Oct 14 10:03:06 PDT 2014


Hi hfinkel, beanz, resistor,

This patch eliminates library calls and intrinsic calls to fabs when the input is a squared value. 
This pattern will occur when a subsequent patch that I am working on to optimize sqrt calls is introduced, so I thought it'd be better to send this one out for review first because it's smaller.
Note that no unsafe-math / fast-math assumptions are needed for this optimization.

http://reviews.llvm.org/D5777

Files:
  include/llvm/Transforms/Utils/SimplifyLibCalls.h
  lib/Transforms/Utils/SimplifyLibCalls.cpp
  test/Transforms/InstCombine/fabs.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5777.14875.patch
Type: text/x-patch
Size: 5683 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141014/f70e3026/attachment.bin>


More information about the llvm-commits mailing list