Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
llvm::LibCallSimplifier Class Reference

LibCallSimplifier - This class implements a collection of optimizations that replace well formed calls to library functions with a more optimal form. More...

#include "llvm/Transforms/Utils/SimplifyLibCalls.h"

Public Member Functions

 LibCallSimplifier (const DataLayout &DL, const TargetLibraryInfo *TLI, DominatorTree *DT, DomConditionCache *DC, AssumptionCache *AC, OptimizationRemarkEmitter &ORE, BlockFrequencyInfo *BFI, ProfileSummaryInfo *PSI, function_ref< void(Instruction *, Value *)> Replacer=&replaceAllUsesWithDefault, function_ref< void(Instruction *)> Eraser=&eraseFromParentDefault)
ValueoptimizeCall (CallInst *CI, IRBuilderBase &B)
 optimizeCall - Take the given call instruction and return a more optimal value to replace the instruction with or 0 if a more optimal form can't be found.

Detailed Description

LibCallSimplifier - This class implements a collection of optimizations that replace well formed calls to library functions with a more optimal form.

For example, replacing 'printf("Hello!")' with 'puts("Hello!")'.

Definition at line 103 of file SimplifyLibCalls.h.

Constructor & Destructor Documentation

◆ LibCallSimplifier()

LibCallSimplifier::LibCallSimplifier ( const DataLayout & DL,
const TargetLibraryInfo * TLI,
DominatorTree * DT,
DomConditionCache * DC,
AssumptionCache * AC,
OptimizationRemarkEmitter & ORE,
BlockFrequencyInfo * BFI,
ProfileSummaryInfo * PSI,
function_ref< void(Instruction *, Value *)> Replacer = &replaceAllUsesWithDefault,
function_ref< void(Instruction *)> Eraser = &eraseFromParentDefault )

Definition at line 4273 of file SimplifyLibCalls.cpp.

Member Function Documentation

◆ optimizeCall()

Value * LibCallSimplifier::optimizeCall ( CallInst * CI,
IRBuilderBase & B )

optimizeCall - Take the given call instruction and return a more optimal value to replace the instruction with or 0 if a more optimal form can't be found.

Note that the returned value may be equal to the instruction being optimized. In this case all other instructions that use the given instruction were modified and the given instruction is dead. The call must not be an indirect call.

Definition at line 4138 of file SimplifyLibCalls.cpp.

References assert(), llvm::dyn_cast(), EnableUnsafeFPShrink, llvm::CallBase::getCalledFunction(), llvm::Instruction::getModule(), llvm::CallBase::getOperandBundlesAsDefs(), ignoreCallingConv(), II, llvm::isa(), llvm::TargetLibraryInfoImpl::isCallingConvCCompatible(), llvm::Instruction::isFast(), llvm::isLibFuncEmittable(), llvm::CallInst::isMustTailCall(), llvm::CallBase::isNoBuiltin(), and optimizeUnaryDoubleFP().


The documentation for this class was generated from the following files: