[InstSimplify] Add SimplifyFPBinOp function.
authorMichael Zolotukhin <mzolotukhin@apple.com>
Fri, 6 Feb 2015 20:02:51 +0000 (20:02 +0000)
committerMichael Zolotukhin <mzolotukhin@apple.com>
Fri, 6 Feb 2015 20:02:51 +0000 (20:02 +0000)
commit3da8e456754a3c79ce19bccc24361fea62391978
tree6adad42c0b88345379e5ca29d6f63dc27770e703
parent9c505a5d38720d3e37626574bb04318d954856a3
[InstSimplify] Add SimplifyFPBinOp function.

It is a variation of SimplifyBinOp, but it takes into account
FastMathFlags.

It is needed in inliner and loop-unroller to accurately predict the
transformation's outcome (previously we dropped the flags and were too
conservative in some cases).

Example:
float foo(float *a, float b) {
 float r;
 if (a[1] * b)
   r = /* a lot of expensive computations */;
 else
   r = 1;
 return r;
}
float boo(float *a) {
 return foo(a, 0.0);
}

Without this patch, we don't inline 'foo' into 'boo'.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228432 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/InstructionSimplify.h
lib/Analysis/IPA/InlineCost.cpp
lib/Analysis/InstructionSimplify.cpp
lib/Transforms/Scalar/LoopUnrollPass.cpp