Lines Matching refs:DL

219   AllocaSlices(const DataLayout &DL, AllocaInst &AI);
640 SliceBuilder(const DataLayout &DL, AllocaInst &AI, AllocaSlices &AS) in SliceBuilder() argument
641 : PtrUseVisitor<SliceBuilder>(DL), in SliceBuilder()
642 AllocSize(DL.getTypeAllocSize(AI.getAllocatedType())), AS(AS) {} in SliceBuilder()
704 const DataLayout &DL = GEPI.getModule()->getDataLayout(); in visitGetElementPtrInst() local
715 const StructLayout *SL = DL.getStructLayout(STy); in visitGetElementPtrInst()
723 DL.getTypeAllocSize(GTI.getIndexedType())); in visitGetElementPtrInst()
754 const DataLayout &DL = LI.getModule()->getDataLayout(); in visitLoadInst() local
755 uint64_t Size = DL.getTypeStoreSize(LI.getType()); in visitLoadInst()
766 const DataLayout &DL = SI.getModule()->getDataLayout(); in visitStoreInst() local
767 uint64_t Size = DL.getTypeStoreSize(ValOp->getType()); in visitStoreInst()
904 const DataLayout &DL = Root->getModule()->getDataLayout(); in hasUnsafePHIOrSelectUse() local
913 Size = std::max(Size, DL.getTypeStoreSize(LI->getType())); in hasUnsafePHIOrSelectUse()
920 Size = std::max(Size, DL.getTypeStoreSize(Op->getType())); in hasUnsafePHIOrSelectUse()
999 AllocaSlices::AllocaSlices(const DataLayout &DL, AllocaInst &AI) in AllocaSlices() argument
1005 SliceBuilder PB(DL, AI, *this); in AllocaSlices()
1386 const DataLayout &DL = PN.getModule()->getDataLayout(); in isSafePHIToSpeculate() local
1409 if (InVal->isDereferenceablePointer(DL) || in isSafePHIToSpeculate()
1478 const DataLayout &DL = SI.getModule()->getDataLayout(); in isSafeSelectToSpeculate() local
1479 bool TDerefable = TValue->isDereferenceablePointer(DL); in isSafeSelectToSpeculate()
1480 bool FDerefable = FValue->isDereferenceablePointer(DL); in isSafeSelectToSpeculate()
1567 static Value *getNaturalGEPWithType(IRBuilderTy &IRB, const DataLayout &DL, in getNaturalGEPWithType() argument
1575 unsigned PtrSize = DL.getPointerTypeSizeInBits(BasePtr->getType()); in getNaturalGEPWithType()
1611 static Value *getNaturalGEPRecursively(IRBuilderTy &IRB, const DataLayout &DL, in getNaturalGEPRecursively() argument
1617 return getNaturalGEPWithType(IRB, DL, Ptr, Ty, TargetTy, Indices, in getNaturalGEPRecursively()
1628 unsigned ElementSizeInBits = DL.getTypeSizeInBits(VecTy->getScalarType()); in getNaturalGEPRecursively()
1639 return getNaturalGEPRecursively(IRB, DL, Ptr, VecTy->getElementType(), in getNaturalGEPRecursively()
1645 APInt ElementSize(Offset.getBitWidth(), DL.getTypeAllocSize(ElementTy)); in getNaturalGEPRecursively()
1652 return getNaturalGEPRecursively(IRB, DL, Ptr, ElementTy, Offset, TargetTy, in getNaturalGEPRecursively()
1660 const StructLayout *SL = DL.getStructLayout(STy); in getNaturalGEPRecursively()
1667 if (Offset.uge(DL.getTypeAllocSize(ElementTy))) in getNaturalGEPRecursively()
1671 return getNaturalGEPRecursively(IRB, DL, Ptr, ElementTy, Offset, TargetTy, in getNaturalGEPRecursively()
1685 static Value *getNaturalGEPWithOffset(IRBuilderTy &IRB, const DataLayout &DL, in getNaturalGEPWithOffset() argument
1699 APInt ElementSize(Offset.getBitWidth(), DL.getTypeAllocSize(ElementTy)); in getNaturalGEPWithOffset()
1706 return getNaturalGEPRecursively(IRB, DL, Ptr, ElementTy, Offset, TargetTy, in getNaturalGEPWithOffset()
1725 static Value *getAdjustedPtr(IRBuilderTy &IRB, const DataLayout &DL, Value *Ptr, in getAdjustedPtr() argument
1750 if (!GEP->accumulateConstantOffset(DL, GEPOffset)) in getAdjustedPtr()
1760 if (Value *P = getNaturalGEPWithOffset(IRB, DL, Ptr, Offset, TargetTy, in getAdjustedPtr()
1821 const DataLayout &DL) { in getAdjustedAlignment() argument
1835 Alignment = DL.getABITypeAlignment(Ty); in getAdjustedAlignment()
1846 static bool canConvertValue(const DataLayout &DL, Type *OldTy, Type *NewTy) { in canConvertValue() argument
1853 if (DL.getTypeSizeInBits(NewTy) != DL.getTypeSizeInBits(OldTy)) in canConvertValue()
1879 static Value *convertValue(const DataLayout &DL, IRBuilderTy &IRB, Value *V, in convertValue() argument
1882 assert(canConvertValue(DL, OldTy, NewTy) && "Value not convertable to type"); in convertValue()
1898 return IRB.CreateIntToPtr(IRB.CreateBitCast(V, DL.getIntPtrType(NewTy)), in convertValue()
1903 return IRB.CreateIntToPtr(IRB.CreateBitCast(V, DL.getIntPtrType(NewTy)), in convertValue()
1915 return IRB.CreateBitCast(IRB.CreatePtrToInt(V, DL.getIntPtrType(OldTy)), in convertValue()
1920 return IRB.CreateBitCast(IRB.CreatePtrToInt(V, DL.getIntPtrType(OldTy)), in convertValue()
1936 const DataLayout &DL) { in isVectorPromotionViableForSlice() argument
1981 if (!canConvertValue(DL, SliceTy, LTy)) in isVectorPromotionViableForSlice()
1991 if (!canConvertValue(DL, STy, SliceTy)) in isVectorPromotionViableForSlice()
2010 const DataLayout &DL) { in isVectorPromotionViable() argument
2056 auto RankVectorTypes = [&DL](VectorType *RHSTy, VectorType *LHSTy) { in isVectorPromotionViable()
2057 assert(DL.getTypeSizeInBits(RHSTy) == DL.getTypeSizeInBits(LHSTy) && in isVectorPromotionViable()
2085 uint64_t ElementSize = DL.getTypeSizeInBits(VTy->getElementType()); in isVectorPromotionViable()
2091 assert((DL.getTypeSizeInBits(VTy) % 8) == 0 && in isVectorPromotionViable()
2096 if (!isVectorPromotionViableForSlice(P, S, VTy, ElementSize, DL)) in isVectorPromotionViable()
2100 if (!isVectorPromotionViableForSlice(P, *S, VTy, ElementSize, DL)) in isVectorPromotionViable()
2119 const DataLayout &DL, in isIntegerWideningViableForSlice() argument
2121 uint64_t Size = DL.getTypeStoreSize(AllocaTy); in isIntegerWideningViableForSlice()
2142 if (ITy->getBitWidth() < DL.getTypeStoreSizeInBits(ITy)) in isIntegerWideningViableForSlice()
2145 !canConvertValue(DL, AllocaTy, LI->getType())) { in isIntegerWideningViableForSlice()
2160 if (ITy->getBitWidth() < DL.getTypeStoreSizeInBits(ITy)) in isIntegerWideningViableForSlice()
2163 !canConvertValue(DL, ValueTy, AllocaTy)) { in isIntegerWideningViableForSlice()
2191 const DataLayout &DL) { in isIntegerWideningViable() argument
2192 uint64_t SizeInBits = DL.getTypeSizeInBits(AllocaTy); in isIntegerWideningViable()
2198 if (SizeInBits != DL.getTypeStoreSizeInBits(AllocaTy)) in isIntegerWideningViable()
2205 if (!canConvertValue(DL, AllocaTy, IntTy) || in isIntegerWideningViable()
2206 !canConvertValue(DL, IntTy, AllocaTy)) in isIntegerWideningViable()
2217 P.begin() != P.end() ? false : DL.isLegalInteger(SizeInBits); in isIntegerWideningViable()
2220 if (!isIntegerWideningViableForSlice(S, P.beginOffset(), AllocaTy, DL, in isIntegerWideningViable()
2225 if (!isIntegerWideningViableForSlice(*S, P.beginOffset(), AllocaTy, DL, in isIntegerWideningViable()
2232 static Value *extractInteger(const DataLayout &DL, IRBuilderTy &IRB, Value *V, in extractInteger() argument
2237 assert(DL.getTypeStoreSize(Ty) + Offset <= DL.getTypeStoreSize(IntTy) && in extractInteger()
2240 if (DL.isBigEndian()) in extractInteger()
2241 ShAmt = 8 * (DL.getTypeStoreSize(IntTy) - DL.getTypeStoreSize(Ty) - Offset); in extractInteger()
2255 static Value *insertInteger(const DataLayout &DL, IRBuilderTy &IRB, Value *Old, in insertInteger() argument
2266 assert(DL.getTypeStoreSize(Ty) + Offset <= DL.getTypeStoreSize(IntTy) && in insertInteger()
2269 if (DL.isBigEndian()) in insertInteger()
2270 ShAmt = 8 * (DL.getTypeStoreSize(IntTy) - DL.getTypeStoreSize(Ty) - Offset); in insertInteger()
2371 const DataLayout &DL; member in __anonadce12ea0e11::AllocaSliceRewriter
2419 AllocaSliceRewriter(const DataLayout &DL, AllocaSlices &AS, SROA &Pass, in AllocaSliceRewriter() argument
2426 : DL(DL), AS(AS), Pass(Pass), OldAI(OldAI), NewAI(NewAI), in AllocaSliceRewriter()
2433 DL.getTypeSizeInBits(NewAI.getAllocatedType())) in AllocaSliceRewriter()
2437 ElementSize(VecTy ? DL.getTypeSizeInBits(ElementTy) / 8 : 0), in AllocaSliceRewriter()
2442 assert((DL.getTypeSizeInBits(ElementTy) % 8) == 0 && in AllocaSliceRewriter()
2519 return getAdjustedPtr(IRB, DL, &NewAI, in getNewAllocaSlicePtr()
2520 APInt(DL.getPointerSizeInBits(), Offset), PointerTy, in getNewAllocaSlicePtr()
2537 NewAIAlign = DL.getABITypeAlignment(NewAI.getAllocatedType()); in getSliceAlign()
2540 return (Ty && Align == DL.getABITypeAlignment(Ty)) ? 0 : Align; in getSliceAlign()
2571 V = convertValue(DL, IRB, V, IntTy); in rewriteIntegerLoad()
2575 V = extractInteger(DL, IRB, V, cast<IntegerType>(LI.getType()), Offset, in rewriteIntegerLoad()
2594 canConvertValue(DL, NewAllocaTy, LI.getType())) { in visitLoadInst()
2604 V = convertValue(DL, IRB, V, TargetTy); in visitLoadInst()
2610 assert(SliceSize < DL.getTypeStoreSize(LI.getType()) && in visitLoadInst()
2613 DL.getTypeStoreSizeInBits(LI.getType()) && in visitLoadInst()
2623 V = insertInteger(DL, IRB, Placeholder, V, NewBeginOffset - BeginOffset, in visitLoadInst()
2649 V = convertValue(DL, IRB, V, SliceTy); in rewriteVectorizedStoreInst()
2666 if (DL.getTypeSizeInBits(V->getType()) != IntTy->getBitWidth()) { in rewriteIntegerStore()
2669 Old = convertValue(DL, IRB, Old, IntTy); in rewriteIntegerStore()
2672 V = insertInteger(DL, IRB, Old, SI.getValueOperand(), Offset, "insert"); in rewriteIntegerStore()
2674 V = convertValue(DL, IRB, V, NewAllocaTy); in rewriteIntegerStore()
2695 if (SliceSize < DL.getTypeStoreSize(V->getType())) { in visitStoreInst()
2700 DL.getTypeStoreSizeInBits(V->getType()) && in visitStoreInst()
2703 V = extractInteger(DL, IRB, V, NarrowTy, NewBeginOffset - BeginOffset, in visitStoreInst()
2715 canConvertValue(DL, V->getType(), NewAllocaTy)) { in visitStoreInst()
2716 V = convertValue(DL, IRB, V, NewAllocaTy); in visitStoreInst()
2793 SliceSize != DL.getTypeStoreSize(AllocaTy) || in visitMemSetInst()
2795 !DL.isLegalInteger(DL.getTypeSizeInBits(ScalarTy)) || in visitMemSetInst()
2796 DL.getTypeSizeInBits(ScalarTy) % 8 != 0)) { in visitMemSetInst()
2825 getIntegerSplat(II.getValue(), DL.getTypeSizeInBits(ElementTy) / 8); in visitMemSetInst()
2826 Splat = convertValue(DL, IRB, Splat, ElementTy); in visitMemSetInst()
2845 Old = convertValue(DL, IRB, Old, IntTy); in visitMemSetInst()
2847 V = insertInteger(DL, IRB, Old, V, Offset, "insert"); in visitMemSetInst()
2852 V = convertValue(DL, IRB, V, AllocaTy); in visitMemSetInst()
2858 V = getIntegerSplat(II.getValue(), DL.getTypeSizeInBits(ScalarTy) / 8); in visitMemSetInst()
2862 V = convertValue(DL, IRB, V, AllocaTy); in visitMemSetInst()
2919 SliceSize != DL.getTypeStoreSize(NewAI.getAllocatedType()) || in visitMemTransferInst()
2952 unsigned IntPtrWidth = DL.getPointerSizeInBits(OtherAS); in visitMemTransferInst()
2960 OtherPtr = getAdjustedPtr(IRB, DL, OtherPtr, OtherOffset, OtherPtrTy, in visitMemTransferInst()
2999 Value *SrcPtr = getAdjustedPtr(IRB, DL, OtherPtr, OtherOffset, OtherPtrTy, in visitMemTransferInst()
3015 Src = convertValue(DL, IRB, Src, IntTy); in visitMemTransferInst()
3017 Src = extractInteger(DL, IRB, Src, SubIntTy, Offset, "extract"); in visitMemTransferInst()
3030 Old = convertValue(DL, IRB, Old, IntTy); in visitMemTransferInst()
3032 Src = insertInteger(DL, IRB, Old, Src, Offset, "insert"); in visitMemTransferInst()
3033 Src = convertValue(DL, IRB, Src, NewAllocaTy); in visitMemTransferInst()
3133 const DataLayout &DL; member in __anonadce12ea0f11::AggLoadStoreRewriter
3146 AggLoadStoreRewriter(const DataLayout &DL) : DL(DL) {} in AggLoadStoreRewriter() argument
3336 static Type *stripAggregateTypeWrapping(const DataLayout &DL, Type *Ty) { in stripAggregateTypeWrapping() argument
3340 uint64_t AllocSize = DL.getTypeAllocSize(Ty); in stripAggregateTypeWrapping()
3341 uint64_t TypeSize = DL.getTypeSizeInBits(Ty); in stripAggregateTypeWrapping()
3347 const StructLayout *SL = DL.getStructLayout(STy); in stripAggregateTypeWrapping()
3354 if (AllocSize > DL.getTypeAllocSize(InnerTy) || in stripAggregateTypeWrapping()
3355 TypeSize > DL.getTypeSizeInBits(InnerTy)) in stripAggregateTypeWrapping()
3358 return stripAggregateTypeWrapping(DL, InnerTy); in stripAggregateTypeWrapping()
3374 static Type *getTypePartition(const DataLayout &DL, Type *Ty, uint64_t Offset, in getTypePartition() argument
3376 if (Offset == 0 && DL.getTypeAllocSize(Ty) == Size) in getTypePartition()
3377 return stripAggregateTypeWrapping(DL, Ty); in getTypePartition()
3378 if (Offset > DL.getTypeAllocSize(Ty) || in getTypePartition()
3379 (DL.getTypeAllocSize(Ty) - Offset) < Size) in getTypePartition()
3388 uint64_t ElementSize = DL.getTypeAllocSize(ElementTy); in getTypePartition()
3405 return getTypePartition(DL, ElementTy, Offset, Size); in getTypePartition()
3410 return stripAggregateTypeWrapping(DL, ElementTy); in getTypePartition()
3422 const StructLayout *SL = DL.getStructLayout(STy); in getTypePartition()
3433 uint64_t ElementSize = DL.getTypeAllocSize(ElementTy); in getTypePartition()
3441 return getTypePartition(DL, ElementTy, Offset, Size); in getTypePartition()
3446 return stripAggregateTypeWrapping(DL, ElementTy); in getTypePartition()
3469 const StructLayout *SubSL = DL.getStructLayout(SubTy); in getTypePartition()
3709 const DataLayout &DL = AI.getModule()->getDataLayout(); in presplitLoadsAndStores() local
3735 getAdjustedPtr(IRB, DL, BasePtr, in presplitLoadsAndStores()
3736 APInt(DL.getPointerSizeInBits(), PartOffset), in presplitLoadsAndStores()
3738 getAdjustedAlignment(LI, PartOffset, DL), /*IsVolatile*/ false, in presplitLoadsAndStores()
3788 PLoad, getAdjustedPtr(IRB, DL, StoreBasePtr, in presplitLoadsAndStores()
3789 APInt(DL.getPointerSizeInBits(), PartOffset), in presplitLoadsAndStores()
3791 getAdjustedAlignment(SI, PartOffset, DL), /*IsVolatile*/ false); in presplitLoadsAndStores()
3868 getAdjustedPtr(IRB, DL, LoadBasePtr, in presplitLoadsAndStores()
3869 APInt(DL.getPointerSizeInBits(), PartOffset), in presplitLoadsAndStores()
3871 getAdjustedAlignment(LI, PartOffset, DL), /*IsVolatile*/ false, in presplitLoadsAndStores()
3878 PLoad, getAdjustedPtr(IRB, DL, StoreBasePtr, in presplitLoadsAndStores()
3879 APInt(DL.getPointerSizeInBits(), PartOffset), in presplitLoadsAndStores()
3881 getAdjustedAlignment(SI, PartOffset, DL), /*IsVolatile*/ false); in presplitLoadsAndStores()
3981 const DataLayout &DL = AI.getModule()->getDataLayout(); in rewritePartition() local
3983 if (DL.getTypeAllocSize(CommonUseTy) >= P.size()) in rewritePartition()
3986 if (Type *TypePartitionTy = getTypePartition(DL, AI.getAllocatedType(), in rewritePartition()
3991 DL.isLegalInteger(P.size() * 8)) in rewritePartition()
3995 assert(DL.getTypeAllocSize(SliceTy) >= P.size()); in rewritePartition()
3997 bool IsIntegerPromotable = isIntegerWideningViable(P, SliceTy, DL); in rewritePartition()
4000 IsIntegerPromotable ? nullptr : isVectorPromotionViable(P, DL); in rewritePartition()
4022 Alignment = DL.getABITypeAlignment(AI.getAllocatedType()); in rewritePartition()
4027 if (Alignment <= DL.getABITypeAlignment(SliceTy)) in rewritePartition()
4047 AllocaSliceRewriter Rewriter(DL, AS, *this, AI, *NewAI, P.beginOffset(), in rewritePartition()
4122 const DataLayout &DL = AI.getModule()->getDataLayout(); in splitAlloca() local
4140 S.endOffset() >= DL.getTypeAllocSize(AI.getAllocatedType())) in splitAlloca()
4168 uint64_t AllocaSize = DL.getTypeSizeInBits(NewAI->getAllocatedType()); in splitAlloca()
4249 const DataLayout &DL = AI.getModule()->getDataLayout(); in runOnAlloca() local
4253 DL.getTypeAllocSize(AI.getAllocatedType()) == 0) in runOnAlloca()
4260 AggLoadStoreRewriter AggRewriter(DL); in runOnAlloca()
4264 AllocaSlices AS(DL, AI); in runOnAlloca()