25 bool *HasNonCallUses,
Value *FPtr, uint64_t
Offset) {
26 for (
const Use &U : FPtr->
uses()) {
28 if (isa<BitCastInst>(User)) {
30 }
else if (
auto CI = dyn_cast<CallInst>(User)) {
32 }
else if (
auto II = dyn_cast<InvokeInst>(User)) {
34 }
else if (HasNonCallUses) {
35 *HasNonCallUses =
true;
45 for (
const Use &U : VPtr->
uses()) {
47 if (isa<BitCastInst>(User)) {
49 }
else if (isa<LoadInst>(User)) {
51 }
else if (
auto GEP = dyn_cast<GetElementPtrInst>(User)) {
53 if (VPtr ==
GEP->getPointerOperand() &&
GEP->hasAllConstantIndices()) {
56 GEP->getSourceElementType(), Indices);
71 for (
const Use &CIU : CI->
uses()) {
72 if (
auto *AssumeCI = dyn_cast<CallInst>(CIU.getUser())) {
73 Function *
F = AssumeCI->getCalledFunction();
91 Intrinsic::type_checked_load);
95 HasNonCallUses =
true;
100 auto CIU = U.getUser();
101 if (
auto EVI = dyn_cast<ExtractValueInst>(CIU)) {
102 if (EVI->getNumIndices() == 1 && EVI->getIndices()[0] == 0) {
106 if (EVI->getNumIndices() == 1 && EVI->getIndices()[0] == 1) {
111 HasNonCallUses =
true;
114 for (
Value *LoadedPtr : LoadedPtrs)
116 Offset->getZExtValue());
void push_back(const T &Elt)
iterator_range< use_iterator > uses()
A Module instance is used to store all the information related to an LLVM module. ...
This class represents a function call, abstracting a target machine's calling convention.
const Function * getParent() const
Return the enclosing method, or null if none.
void findDevirtualizableCallsForTypeCheckedLoad(SmallVectorImpl< DevirtCallSite > &DevirtCalls, SmallVectorImpl< Instruction * > &LoadedPtrs, SmallVectorImpl< Instruction * > &Preds, bool &HasNonCallUses, CallInst *CI)
Given a call to the intrinsic .type.checked.load, find all devirtualizable call sites based on the ca...
A Use represents the edge between a Value definition and its users.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
LLVM_NODISCARD bool empty() const
This file contains the declarations for the subclasses of Constant, which represent the different fla...
void findDevirtualizableCallsForTypeTest(SmallVectorImpl< DevirtCallSite > &DevirtCalls, SmallVectorImpl< CallInst * > &Assumes, CallInst *CI)
Given a call to the intrinsic .type.test, find all devirtualizable call sites based on the call and r...
int64_t getIndexedOffsetInType(Type *ElemTy, ArrayRef< Value * > Indices) const
Returns the offset from the beginning of the type for the specified indices.
This is the shared class of boolean and integer constants.
Module.h This file contains the declarations for the Module class.
Value * stripPointerCasts()
Strip off pointer casts, all-zero GEPs, and aliases.
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th call argument.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
const BasicBlock * getParent() const