aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMichael Ilseman <milseman@apple.com>2012-11-27 00:46:26 +0000
committerMichael Ilseman <milseman@apple.com>2012-11-27 00:46:26 +0000
commiteb61c920f12cacee38815bf10821d2f294b66f3a (patch)
tree2e983dec27c11ee07708c46fa7f23af9285f19bb /include
parenta52f3ae45ce28198bb402ddea8db5a8cb8d8ced7 (diff)
downloadexternal_llvm-eb61c920f12cacee38815bf10821d2f294b66f3a.zip
external_llvm-eb61c920f12cacee38815bf10821d2f294b66f3a.tar.gz
external_llvm-eb61c920f12cacee38815bf10821d2f294b66f3a.tar.bz2
Fast-math optimization: fold multiply by zero
Added in first optimization using fast-math flags to serve as an example for following optimizations. SimplifyInstruction will now try to optimize an fmul observing its FastMathFlags to see if it can fold multiply by zero when 'nnan' and 'nsz' flags are set. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168648 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/InstructionSimplify.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/Analysis/InstructionSimplify.h b/include/llvm/Analysis/InstructionSimplify.h
index 6db400c..ce78181 100644
--- a/include/llvm/Analysis/InstructionSimplify.h
+++ b/include/llvm/Analysis/InstructionSimplify.h
@@ -25,6 +25,7 @@ namespace llvm {
class DominatorTree;
class Instruction;
class DataLayout;
+ struct FastMathFlags;
class TargetLibraryInfo;
class Type;
class Value;
@@ -43,6 +44,14 @@ namespace llvm {
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
+ /// Given operands for an FMul, see if we can fold the result. If not, this
+ /// returns null.
+ Value *SimplifyFMulInst(Value *LHS, Value *RHS,
+ FastMathFlags FMF,
+ const DataLayout *TD = 0,
+ const TargetLibraryInfo *TLI = 0,
+ const DominatorTree *DT = 0);
+
/// SimplifyMulInst - Given operands for a Mul, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyMulInst(Value *LHS, Value *RHS, const DataLayout *TD = 0,