diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-02-28 19:09:33 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-02-28 19:09:33 +0000 |
commit | f7cfac7a1422f723f9288d3a0bcff72798d450c3 (patch) | |
tree | 0f3a82ed7d4c9f34bcc400ecf74e6ff2a2c9fd8d /llvm/lib/Analysis/CostModel.cpp | |
parent | 882987f30c919b6bac33588b5de2bd2f29e26a28 (diff) | |
download | bcm5719-llvm-f7cfac7a1422f723f9288d3a0bcff72798d450c3.tar.gz bcm5719-llvm-f7cfac7a1422f723f9288d3a0bcff72798d450c3.zip |
Cost model support for lowered math builtins.
We make the cost for calling libm functions extremely high as emitting the
calls is expensive and causes spills (on x86) so performance suffers. We still
vectorize important calls like ceilf and friends on SSE4.1. and fabs.
Differential Revision: http://llvm-reviews.chandlerc.com/D466
llvm-svn: 176287
Diffstat (limited to 'llvm/lib/Analysis/CostModel.cpp')
-rw-r--r-- | llvm/lib/Analysis/CostModel.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/CostModel.cpp b/llvm/lib/Analysis/CostModel.cpp index 44684a9685b..df70d157b41 100644 --- a/llvm/lib/Analysis/CostModel.cpp +++ b/llvm/lib/Analysis/CostModel.cpp @@ -23,6 +23,7 @@ #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/IR/Function.h" #include "llvm/IR/Instructions.h" +#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Value.h" #include "llvm/Pass.h" #include "llvm/Support/Debug.h" @@ -189,6 +190,16 @@ unsigned CostModelAnalysis::getInstructionCost(const Instruction *I) const { 0); return -1; } + case Instruction::Call: + if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) { + SmallVector<Type*, 4> Tys; + for (unsigned J = 0, JE = II->getNumArgOperands(); J != JE; ++J) + Tys.push_back(II->getArgOperand(J)->getType()); + + return TTI->getIntrinsicInstrCost(II->getIntrinsicID(), II->getType(), + Tys); + } + return -1; default: // We don't have any information on this instruction. return -1; |