51 return "convert address space of alloca'ed memory to local";
56char NVPTXLowerAlloca::ID = 1;
59 "Lower Alloca",
false,
false)
71 if (
auto allocaInst = dyn_cast<AllocaInst>(&
I)) {
73 auto ETy = allocaInst->getAllocatedType();
77 auto NewASCToGeneric =
79 NewASCToLocal->insertAfter(allocaInst);
80 NewASCToGeneric->insertAfter(NewASCToLocal);
87 auto LI = dyn_cast<LoadInst>(AllocaUse.getUser());
88 if (LI && LI->getPointerOperand() == allocaInst &&
90 LI->setOperand(LI->getPointerOperandIndex(), NewASCToGeneric);
93 auto SI = dyn_cast<StoreInst>(AllocaUse.getUser());
94 if (SI && SI->getPointerOperand() == allocaInst &&
96 SI->setOperand(SI->getPointerOperandIndex(), NewASCToGeneric);
99 auto GI = dyn_cast<GetElementPtrInst>(AllocaUse.getUser());
100 if (GI && GI->getPointerOperand() == allocaInst) {
101 GI->setOperand(GI->getPointerOperandIndex(), NewASCToGeneric);
104 auto BI = dyn_cast<BitCastInst>(AllocaUse.getUser());
105 if (BI && BI->getOperand(0) == allocaInst) {
106 BI->setOperand(0, NewASCToGeneric);
116 return new NVPTXLowerAlloca();
static bool runOnFunction(Function &F, bool PostInlining)
Module.h This file contains the declarations for the Module class.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This class represents a conversion between pointers from one address space to another.
FunctionPass class - This class is used to implement most global optimizations.
virtual bool runOnFunction(Function &F)=0
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
StringRef - Represent a constant reference to a string, i.e.
A Use represents the edge between a Value definition and its users.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
void initializeNVPTXLowerAllocaPass(PassRegistry &)
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
FunctionPass * createNVPTXLowerAllocaPass()