35 AT->getNumElements() == 0 &&
47 V, AT->getElementType()));
56 if (DynSharedDecls.
size() < 2)
73 GV->removeDeadConstantUsers();
76 MaxAlign = std::max(MaxAlign,
DL.getValueOrABITypeAlignment(
77 GV->getAlign(), GV->getValueType()));
84 if (!GV->isConstant())
89 GV->getDebugInfo(GVEs);
92 GV->eraseMetadata(LLVMContext::MD_dbg);
94 GV->replaceAllUsesWith(Canonical);
96 GV->eraseFromParent();
108class NVPTXCanonicalizeDynamicSharedLegacyPass :
public ModulePass {
111 NVPTXCanonicalizeDynamicSharedLegacyPass() : ModulePass(ID) {}
117char NVPTXCanonicalizeDynamicSharedLegacyPass::ID = 0;
120 "nvptx-canonicalize-dynamic-shared",
121 "Merge NVPTX dynamic shared memory declarations",
false,
false)
124 return new NVPTXCanonicalizeDynamicSharedLegacyPass();
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Module.h This file contains the declarations for the Module class.
static void restoreUsedList(GlobalVariable *List, ArrayRef< GlobalValue * > Values)
static bool canonicalizeDynamicShared(Module &M)
static bool isDynamicSharedDecl(const GlobalVariable &GV)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file defines the SmallPtrSet class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Represents analyses that only rely on functions' control flow.
static LLVM_ABI Constant * get(ArrayType *T, ArrayRef< Constant * > V)
static LLVM_ABI Constant * getPointerBitCastOrAddrSpaceCast(Constant *C, Type *Ty)
Create a BitCast or AddrSpaceCast for a pointer type depending on the address space.
A pair of DIGlobalVariable and DIExpression.
A parsed version of the target data layout string in and methods for querying it.
bool hasExternalLinkage() const
LLVM_ABI bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
unsigned getAddressSpace() const
Type * getValueType() const
void setConstant(bool Val)
LLVM_ABI void addDebugInfo(DIGlobalVariableExpression *GV)
Attach a DIGlobalVariableExpression.
void setAlignment(Align Align)
Sets the alignment attribute of the GlobalVariable.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
A Module instance is used to store all the information related to an LLVM module.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM)
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.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
void insert_range(Range &&R)
bool contains(ConstPtrType Ptr) const
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.
RelativeUniformCounterPtr Values
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
constexpr from_range_t from_range
ModulePass * createNVPTXCanonicalizeDynamicSharedLegacyPass()
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
LLVM_ABI GlobalVariable * collectUsedGlobalVariables(const Module &M, SmallVectorImpl< GlobalValue * > &Vec, bool CompilerUsed)
Given "llvm.used" or "llvm.compiler.used" as a global name, collect the initializer elements of that ...
This struct is a compact representation of a valid (non-zero power of two) alignment.