26 #define DEBUG_TYPE "partially-inline-libcalls" 28 DEBUG_COUNTER(PILCounter,
"partially-inline-libcalls-transform",
29 "Controls transformations in partially-inline-libcalls");
36 if (Call->onlyReadsMemory())
58 Type *Ty = Call->getType();
60 Call->replaceAllUsesWith(Phi);
65 Builder.SetInsertPoint(LibCallBB);
75 Builder.SetInsertPoint(&CurrBB);
77 ?
Builder.CreateFCmpORD(Call, Call)
78 :
Builder.CreateFCmpOGE(Call->getOperand(0),
80 Builder.CreateCondBr(FCmp, JoinBB, LibCallBB);
100 CallInst *Call = dyn_cast<CallInst>(&*II);
103 if (!Call || !(CalledFunc = Call->getCalledFunction()))
106 if (Call->isNoBuiltin())
145 class PartiallyInlineLibCallsLegacyPass :
public FunctionPass {
165 &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(
F);
167 &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(
F);
175 "partially-inline-libcalls",
176 "Partially inline calls to library functions",
false,
185 return new PartiallyInlineLibCallsLegacyPass();
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
bool hasLocalLinkage() const
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
This class represents lattice values for constants.
This class represents a function call, abstracting a target machine's calling convention.
Analysis pass providing the TargetTransformInfo.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
LLVMContext & getContext() const
Get the context in which this basic block lives.
iterator begin()
Instruction iterator methods.
partially inline Partially calls to library functions
AnalysisUsage & addRequired()
INITIALIZE_PASS_BEGIN(PartiallyInlineLibCallsLegacyPass, "partially-inline-libcalls", "Partially inline calls to library functions", false, false) INITIALIZE_PASS_END(PartiallyInlineLibCallsLegacyPass
This file provides an implementation of debug counters.
DEBUG_COUNTER(PILCounter, "partially-inline-libcalls-transform", "Controls transformations in partially-inline-libcalls")
FunctionPass * createPartiallyInlineLibCallsPass()
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
bool has(LibFunc F) const
Tests whether a library function is available.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static bool runOnFunction(Function &F, bool PostInlining)
A set of analyses that are preserved following a run of a transformation pass.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed.
static bool runPartiallyInlineLibCalls(Function &F, TargetLibraryInfo *TLI, const TargetTransformInfo *TTI)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Represent the analysis usage information of a pass.
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 bool shouldExecute(unsigned CounterName)
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
Iterator for intrusive lists based on ilist_node.
Provides information about what library functions are available for the current target.
static Constant * get(Type *Ty, double V)
This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in...
bool getLibFunc(StringRef funcName, LibFunc &F) const
Searches for a particular function name.
const Function * getParent() const
Return the enclosing method, or null if none.
BasicBlock * SplitBlock(BasicBlock *Old, Instruction *SplitPt, DominatorTree *DT, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr, const Twine &BBName="", bool Before=false)
Split the specified block at the specified instruction.
Analysis pass providing the TargetLibraryInfo.
partially inline libcalls
LLVM Value Representation.
amdgpu Simplify well known AMD library calls
static bool optimizeSQRT(CallInst *Call, Function *CalledFunc, BasicBlock &CurrBB, Function::iterator &BB, const TargetTransformInfo *TTI)
A container for analyses that lazily runs them and caches their results.
void initializePartiallyInlineLibCallsLegacyPassPass(PassRegistry &)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)