12#define DEBUG_TYPE "bpf-aspace-simplify"
40 return CastGEPCast{OuterCast};
44 return Ty->get(Ty->getContext(), AS);
56 NewGEP->setName(
GEP->getName());
58 NewGEP->setOperand(0, InnerCast->getPointerOperand());
60 NewGEP->mutateType(changeAddressSpace(GEPTy, AS));
64 GEP->eraseFromParent();
65 if (InnerCast->use_empty())
66 InnerCast->eraseFromParent();
79 if (
auto It = CastGEPCast::match(&
I))
83 while (!WorkList.
empty()) {
87 if (
auto It = CastGEPCast::match(U))
This class represents a conversion between pointers from one address space to another.
Value * getPointerOperand()
Gets the pointer operand.
unsigned getSrcAddressSpace() const
Returns the address space of the pointer operand.
unsigned getDestAddressSpace() const
Returns the address space of the result.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
LLVM Basic Block Representation.
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
LLVM_ABI InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
LLVM Value Representation.
LLVM_ABI void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
iterator_range< user_iterator > users()
self_iterator getIterator()
bool match(Val *V, const Pattern &P)
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.