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();
92 Intrinsic::type_checked_load);
96 HasNonCallUses =
true;
100 for (
const Use &U : CI->
uses()) {
101 auto CIU = U.getUser();
102 if (
auto EVI = dyn_cast<ExtractValueInst>(CIU)) {
103 if (EVI->getNumIndices() == 1 && EVI->getIndices()[0] == 0) {
107 if (EVI->getNumIndices() == 1 && EVI->getIndices()[0] == 1) {
112 HasNonCallUses =
true;
115 for (
Value *LoadedPtr : LoadedPtrs)
117 Offset->getZExtValue());
void push_back(const T &Elt)
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
iterator_range< use_iterator > uses()
Compute iterated dominance frontiers using a linear time algorithm.
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.
void findDevirtualizableCallsForTypeTest(SmallVectorImpl< DevirtCallSite > &DevirtCalls, SmallVectorImpl< CallInst *> &Assumes, const CallInst *CI)
Given a call to the intrinsic @llvm.type.test, find all devirtualizable call sites based on the call ...
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
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...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs, and aliases.
This is the shared class of boolean and integer constants.
void findDevirtualizableCallsForTypeCheckedLoad(SmallVectorImpl< DevirtCallSite > &DevirtCalls, SmallVectorImpl< Instruction *> &LoadedPtrs, SmallVectorImpl< Instruction *> &Preds, bool &HasNonCallUses, const CallInst *CI)
Given a call to the intrinsic @llvm.type.checked.load, find all devirtualizable call sites based on t...
Module.h This file contains the declarations for the Module class.
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
LLVM_NODISCARD bool empty() const
const Function * getParent() const
Return the enclosing method, or null if none.
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())
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th call argument.
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
int64_t getIndexedOffsetInType(Type *ElemTy, ArrayRef< Value *> Indices) const
Returns the offset from the beginning of the type for the specified indices.
const BasicBlock * getParent() const