enum MemoryAccess::AccessType AccType =
isa<LoadInst>(Inst) ? MemoryAccess::READ : MemoryAccess::MUST_WRITE;
- if (auto *BitCast = dyn_cast<BitCastInst>(Address)) {
- auto *Src = BitCast->getOperand(0);
- auto *SrcTy = Src->getType();
- auto *DstTy = BitCast->getType();
- // Do not try to delinearize non-sized (opaque) pointers.
- if ((SrcTy->isPointerTy() && !SrcTy->getPointerElementType()->isSized()) ||
- (DstTy->isPointerTy() && !DstTy->getPointerElementType()->isSized())) {
- return false;
- }
- if (SrcTy->isPointerTy() && DstTy->isPointerTy() &&
- DL.getTypeAllocSize(SrcTy->getPointerElementType()) ==
- DL.getTypeAllocSize(DstTy->getPointerElementType()))
- Address = Src;
- }
+ if (auto *BitCast = dyn_cast<BitCastInst>(Address))
+ Address = BitCast->getOperand(0);
auto *GEP = dyn_cast<GetElementPtrInst>(Address);
- if (!GEP)
+ if (!GEP || DL.getTypeAllocSize(GEP->getResultElementType()) !=
+ DL.getTypeAllocSize(ElementType))
return false;
SmallVector<const SCEV *, 4> Subscripts;