25 #define DEBUG_TYPE "partially-inline-libcalls"
61 Builder.SetInsertPoint(LibCallBB);
63 Builder.Insert(LibCall);
64 Builder.CreateBr(JoinBB);
71 Builder.SetInsertPoint(&CurrBB);
72 Value *FCmp = Builder.CreateFCmpOEQ(Call, Call);
73 Builder.CreateCondBr(FCmp, JoinBB, LibCallBB);
76 Phi->addIncoming(Call, &CurrBB);
77 Phi->addIncoming(LibCall, LibCallBB);
102 if (CalledFunc->hasLocalLinkage() || !CalledFunc->hasName() ||
135 class PartiallyInlineLibCallsLegacyPass :
public FunctionPass {
150 bool runOnFunction(
Function &
F)
override {
155 &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
157 &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
165 "partially-inline-libcalls",
166 "Partially inline calls to library functions",
false,
175 return new PartiallyInlineLibCallsLegacyPass();
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
NodeTy * getNextNode()
Get the next node, or nullptr for the list tail.
BasicBlock * SplitBlock(BasicBlock *Old, Instruction *SplitPt, DominatorTree *DT=nullptr, LoopInfo *LI=nullptr)
Split the specified block at the specified instruction - everything before SplitPt stays in Old and e...
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
This class represents a function call, abstracting a target machine's calling convention.
libcalls Conditionally eliminate dead library calls
Analysis pass providing the TargetTransformInfo.
const Function * getParent() const
Return the enclosing method, or null if none.
bool getLibFunc(StringRef funcName, LibFunc &F) const
Searches for a particular function name.
iterator begin()
Instruction iterator methods.
partially inline Partially calls to library functions
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs...ExtraArgs)
Get the result of an analysis pass for a given IR unit.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Instruction * clone() const
Create a copy of 'this' instruction that is identical in all ways except the following: ...
FunctionPass * createPartiallyInlineLibCallsPass()
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
A set of analyses that are preserved following a run of a transformation pass.
LLVM Basic Block Representation.
static bool runPartiallyInlineLibCalls(Function &F, TargetLibraryInfo *TLI, const TargetTransformInfo *TTI)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Represent the analysis usage information of a pass.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
FunctionPass class - This class is used to implement most global optimizations.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
self_iterator getIterator()
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
static bool optimizeSQRT(CallInst *Call, Function *CalledFunc, BasicBlock &CurrBB, Function::iterator &BB)
INITIALIZE_PASS_BEGIN(PartiallyInlineLibCallsLegacyPass,"partially-inline-libcalls","Partially inline calls to library functions", false, false) INITIALIZE_PASS_END(PartiallyInlineLibCallsLegacyPass
Iterator for intrusive lists based on ilist_node.
Type * getType() const
All values are typed, get the type of this value.
Provides information about what library functions are available for the current target.
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Analysis pass providing the TargetLibraryInfo.
partially inline Partially calls to library false
partially inline libcalls
LLVMContext & getContext() const
Get the context in which this basic block lives.
LLVM Value Representation.
A container for analyses that lazily runs them and caches their results.
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
void initializePartiallyInlineLibCallsLegacyPassPass(PassRegistry &)
const TerminatorInst * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...