-uint64_t DSE::getPointerSize(Value *V, AliasAnalysis &AA) const {
- const TargetData *TD = AA.getTargetData();
- if (TD == 0)
- return AliasAnalysis::UnknownSize;
-
- if (AllocaInst *A = dyn_cast<AllocaInst>(V)) {
- // Get size information for the alloca
- if (ConstantInt *C = dyn_cast<ConstantInt>(A->getArraySize()))
- return C->getZExtValue() * TD->getTypeAllocSize(A->getAllocatedType());
- return AliasAnalysis::UnknownSize;
- }
-
- assert(isa<Argument>(V) && "Expected AllocaInst or Argument!");
- const PointerType *PT = cast<PointerType>(V->getType());
- return TD->getTypeAllocSize(PT->getElementType());
-}