LLVM 20.0.0git
Public Member Functions | List of all members
llvm::FortifiedLibCallSimplifier Class Reference

This class implements simplifications for calls to fortified library functions (__st*cpy_chk, __memcpy_chk, __memmove_chk, __memset_chk), to, when possible, replace them with their non-checking counterparts. More...

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

Public Member Functions

 FortifiedLibCallSimplifier (const TargetLibraryInfo *TLI, bool OnlyLowerUnknownSize=false)
 
ValueoptimizeCall (CallInst *CI, IRBuilderBase &B)
 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

This class implements simplifications for calls to fortified library functions (__st*cpy_chk, __memcpy_chk, __memmove_chk, __memset_chk), to, when possible, replace them with their non-checking counterparts.

Other optimizations can also be done, but it's possible to disable them and only simplify needless use of the checking versions (when the object size is unknown) by passing true for OnlyLowerUnknownSize.

Definition at line 39 of file SimplifyLibCalls.h.

Constructor & Destructor Documentation

◆ FortifiedLibCallSimplifier()

FortifiedLibCallSimplifier::FortifiedLibCallSimplifier ( const TargetLibraryInfo TLI,
bool  OnlyLowerUnknownSize = false 
)

Definition at line 4543 of file SimplifyLibCalls.cpp.

Member Function Documentation

◆ optimizeCall()

Value * FortifiedLibCallSimplifier::optimizeCall ( CallInst CI,
IRBuilderBase B 
)

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.

The call must not be an indirect call.

Definition at line 4468 of file SimplifyLibCalls.cpp.

References llvm::CallBase::getCalledFunction(), llvm::TargetLibraryInfo::getLibFunc(), llvm::CallBase::getOperandBundlesAsDefs(), ignoreCallingConv(), llvm::TargetLibraryInfoImpl::isCallingConvCCompatible(), and llvm::IRBuilderBase::setDefaultOperandBundles().

Referenced by llvm::LibCallSimplifier::optimizeCall().


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