#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Target/TargetData.h"
#include "llvm/ADT/STLExtras.h"
-#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Config/config.h"
using namespace llvm;
namespace {
/// This pass optimizes well half_powr function calls.
///
- class VISIBILITY_HIDDEN SimplifyHalfPowrLibCalls : public FunctionPass {
+ class SimplifyHalfPowrLibCalls : public FunctionPass {
const TargetData *TD;
public:
static char ID; // Pass identification
bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
- AU.addRequired<TargetData>();
}
Instruction *
/// InlineHalfPowrs - Inline a sequence of adjacent half_powr calls, rearranging
/// their control flow to better facilitate subsequent optimization.
Instruction *
-SimplifyHalfPowrLibCalls::InlineHalfPowrs(const std::vector<Instruction *> &HalfPowrs,
- Instruction *InsertPt) {
+SimplifyHalfPowrLibCalls::
+InlineHalfPowrs(const std::vector<Instruction *> &HalfPowrs,
+ Instruction *InsertPt) {
std::vector<BasicBlock *> Bodies;
BasicBlock *NewBlock = 0;
if (!isa<ReturnInst>(Body->getTerminator()))
break;
- Instruction *NextInst = next(BasicBlock::iterator(Call));
+ Instruction *NextInst = llvm::next(BasicBlock::iterator(Call));
// Inline the call, taking care of what code ends up where.
NewBlock = SplitBlock(NextInst->getParent(), NextInst, this);
/// runOnFunction - Top level algorithm.
///
bool SimplifyHalfPowrLibCalls::runOnFunction(Function &F) {
- TD = &getAnalysis<TargetData>();
+ TD = getAnalysisIfAvailable<TargetData>();
bool Changed = false;
std::vector<Instruction *> HalfPowrs;
Function *Callee = CI->getCalledFunction();
if (Callee && Callee->hasExternalLinkage()) {
// Look for calls with well-known names.
- const char *CalleeName = Callee->getNameStart();
- if (strcmp(CalleeName, "__half_powrf4") == 0)
+ if (Callee->getName() == "__half_powrf4")
IsHalfPowr = true;
}
}