llvm-6502/include/llvm/Transforms/Utils
Sanjay Patel d8214db086 fold: sqrt(x * x * y) -> fabs(x) * sqrt(y)
If a square root call has an FP multiplication argument that can be reassociated,
then we can hoist a repeated factor out of the square root call and into a fabs().

In the simplest case, this:

   y = sqrt(x * x);

becomes this:

   y = fabs(x);

This patch relies on an earlier optimization in instcombine or reassociate to put the
multiplication tree into a canonical form, so we don't have to search over
every permutation of the multiplication tree.

Because there are no IR-level FastMathFlags for intrinsics (PR21290), we have to
use function-level attributes to do this optimization. This needs to be fixed
for both the intrinsics and in the backend.

Differential Revision: http://reviews.llvm.org/D5787



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219944 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-16 18:48:17 +00:00
..
ASanStackFrameLayout.h
BasicBlockUtils.h Give SplitBlockAndInsertIfThen the ability to update a domtree. 2014-07-15 04:40:27 +00:00
BuildLibCalls.h
BypassSlowDivision.h
Cloning.h Add an Assumption-Tracking Pass 2014-09-07 12:44:26 +00:00
CmpInstAnalysis.h
CodeExtractor.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
CtorUtils.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
GlobalStatus.h
IntegerDivision.h
Local.h [SimplifyCFG] threshold for folding branches with common destination 2014-09-30 22:23:38 +00:00
LoopUtils.h Make use of @llvm.assume in ValueTracking (computeKnownBits, etc.) 2014-09-07 18:57:58 +00:00
ModuleUtils.h Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size. 2014-08-21 05:55:13 +00:00
PromoteMemToReg.h Make use of @llvm.assume in ValueTracking (computeKnownBits, etc.) 2014-09-07 18:57:58 +00:00
SimplifyIndVar.h
SimplifyLibCalls.h fold: sqrt(x * x * y) -> fabs(x) * sqrt(y) 2014-10-16 18:48:17 +00:00
SSAUpdater.h
SSAUpdaterImpl.h
UnifyFunctionExitNodes.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
UnrollLoop.h Add an Assumption-Tracking Pass 2014-09-07 12:44:26 +00:00
ValueMapper.h
VectorUtils.h [LoopVectorize] Ignore @llvm.assume for cost estimates and legality 2014-10-14 22:59:49 +00:00