27 for (
const Use &U : FPtr->
uses()) {
37 if (isa<BitCastInst>(User)) {
40 }
else if (
auto CI = dyn_cast<CallInst>(User)) {
42 }
else if (
auto II = dyn_cast<InvokeInst>(User)) {
44 }
else if (HasNonCallUses) {
45 *HasNonCallUses =
true;
54 for (
const Use &U : VPtr->
uses()) {
56 if (isa<BitCastInst>(User)) {
58 }
else if (isa<LoadInst>(User)) {
60 }
else if (
auto GEP = dyn_cast<GetElementPtrInst>(User)) {
62 if (VPtr ==
GEP->getPointerOperand() &&
GEP->hasAllConstantIndices()) {
65 GEP->getSourceElementType(), Indices);
82 for (
const Use &CIU : CI->
uses()) {
83 if (
auto *AssumeCI = dyn_cast<CallInst>(CIU.getUser())) {
84 Function *
F = AssumeCI->getCalledFunction();
103 Intrinsic::type_checked_load);
107 HasNonCallUses =
true;
111 for (
const Use &U : CI->
uses()) {
112 auto CIU = U.getUser();
113 if (
auto EVI = dyn_cast<ExtractValueInst>(CIU)) {
114 if (EVI->getNumIndices() == 1 && EVI->getIndices()[0] == 0) {
118 if (EVI->getNumIndices() == 1 && EVI->getIndices()[0] == 1) {
123 HasNonCallUses =
true;
126 for (
Value *LoadedPtr : LoadedPtrs)
128 Offset->getZExtValue(), CI, DT);
140 if (
auto *
C = dyn_cast<ConstantStruct>(I)) {
149 if (
auto *
C = dyn_cast<ConstantArray>(I)) {
153 unsigned Op = Offset / ElemSize;
158 Offset % ElemSize, M);
A parsed version of the target data layout string in and methods for querying it. ...
iterator_range< use_iterator > uses()
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
void findDevirtualizableCallsForTypeTest(SmallVectorImpl< DevirtCallSite > &DevirtCalls, SmallVectorImpl< CallInst *> &Assumes, const CallInst *CI, DominatorTree &DT)
Given a call to the intrinsic @llvm.type.test, find all devirtualizable call sites based on the call ...
const StructLayout * getStructLayout(StructType *Ty) const
Returns a StructLayout object, indicating the alignment of the struct, its size, and the offsets of i...
void push_back(const T &Elt)
This class represents a function call, abstracting a target machine's calling convention.
unsigned getElementContainingOffset(uint64_t Offset) const
Given a valid byte offset into the structure, returns the structure index that contains it...
Value * getArgOperand(unsigned i) const
void findDevirtualizableCallsForTypeCheckedLoad(SmallVectorImpl< DevirtCallSite > &DevirtCalls, SmallVectorImpl< Instruction *> &LoadedPtrs, SmallVectorImpl< Instruction *> &Preds, bool &HasNonCallUses, const CallInst *CI, DominatorTree &DT)
Given a call to the intrinsic @llvm.type.checked.load, find all devirtualizable call sites based on t...
Used to lazily calculate structure layout information for a target machine, based on the DataLayout s...
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...
Type * getType() const
All values are typed, get the type of this value.
Class to represent array types.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Value * getOperand(unsigned i) const
This is an important base class in LLVM.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool isPointerTy() const
True if this is an instance of PointerType.
TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs and address space casts.
unsigned getNumOperands() const
This is the shared class of boolean and integer constants.
bool dominates(const Instruction *Def, const Use &U) const
Return true if Def dominates a use in User.
Module.h This file contains the declarations for the Module class.
uint64_t getSizeInBytes() const
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
uint64_t getElementOffset(unsigned Idx) const
LLVM_NODISCARD bool empty() const
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation.
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())
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
Type * getElementType() const
Constant * getPointerAtOffset(Constant *I, uint64_t Offset, Module &M)
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