Home | History | Annotate | Download | only in Scalar

Lines Matching refs:Offset

127     void isSafeForScalarRepl(Instruction *I, uint64_t Offset, AllocaInfo &Info);
128 void isSafePHISelectUseForScalarRepl(Instruction *User, uint64_t Offset,
130 void isSafeGEP(GetElementPtrInst *GEPI, uint64_t &Offset, AllocaInfo &Info);
131 void isSafeMemAccess(uint64_t Offset, uint64_t MemSize,
134 bool TypeHasComponent(Type *T, uint64_t Offset, uint64_t Size);
135 uint64_t FindElementAndOffset(Type *&T, uint64_t &Offset,
142 void RewriteForScalarRepl(Instruction *I, AllocaInst *AI, uint64_t Offset,
144 void RewriteBitCast(BitCastInst *BC, AllocaInst *AI, uint64_t Offset,
146 void RewriteGEP(GetElementPtrInst *GEPI, AllocaInst *AI, uint64_t Offset,
149 uint64_t Offset,
274 bool CanConvertToScalar(Value *V, uint64_t Offset);
275 void MergeInTypeForLoadOrStore(Type *In, uint64_t Offset);
276 bool MergeInVectorType(VectorType *VInTy, uint64_t Offset);
277 void ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, uint64_t Offset);
280 uint64_t Offset, IRBuilder<> &Builder);
282 uint64_t Offset, IRBuilder<> &Builder);
332 /// (VectorTy) so far at the offset specified by Offset (which is specified in
345 uint64_t Offset) {
356 if (MergeInVectorType(VInTy, Offset))
368 // if the implied vector agrees with what we already have and if Offset is
370 if (Offset % EltSize == 0 && AllocaSize % EltSize == 0 &&
389 uint64_t Offset) {
390 if (VInTy->getBitWidth()/8 == AllocaSize && Offset == 0) {
409 /// completely trivial use that mem2reg could promote, set IsNotTrivial. Offset
410 /// is the current offset from the base of the alloca being analyzed.
414 bool ConvertToScalarInfo::CanConvertToScalar(Value *V, uint64_t Offset) {
426 MergeInTypeForLoadOrStore(LI->getType(), Offset);
437 MergeInTypeForLoadOrStore(SI->getOperand(0)->getType(), Offset);
444 if (!CanConvertToScalar(BCI, Offset))
454 // Compute the offset that this GEP adds to the pointer.
459 if (!CanConvertToScalar(GEP, Offset+GEPOffset))
482 if (Len->getZExtValue() != AllocaSize || Offset != 0)
494 if (Len == 0 || Len->getZExtValue() != AllocaSize || Offset != 0)
521 /// Offset is an offset from the original alloca, in bits that need to be
524 uint64_t Offset) {
529 ConvertUsesToScalar(CI, NewAI, Offset);
535 // Compute the offset that this GEP adds to the pointer.
539 ConvertUsesToScalar(GEP, NewAI, Offset+GEPOffset*8);
547 // The load is a bit extract from NewAI shifted right by Offset bits.
550 = ConvertScalar_ExtractValue(LoadedVal, LI->getType(), Offset, Builder);
559 Value *New = ConvertScalar_InsertValue(SI->getOperand(0), Old, Offset,
590 Old, Offset, Builder);
605 assert(Offset == 0 && "must be store to start of alloca");
667 /// or vector value FromVal, extracting the bits from the offset specified by
668 /// Offset. This returns the value, which is of type ToType.
674 /// Offset is an offset from the original alloca, in bits that need to be
678 uint64_t Offset, IRBuilder<> &Builder) {
681 if (FromType == ToType && Offset == 0)
694 if (Offset) {
696 Elt = Offset/EltSize;
697 assert(EltSize*Elt == Offset && "Invalid modulus in validity checking");
713 Offset+Layout.getElementOffsetInBits(i),
725 Offset+i*EltSize, Builder);
738 // On big-endian machines, the lowest bit is stored at the bit offset
742 TD.getTypeStoreSizeInBits(ToType) - Offset;
744 ShAmt = Offset;
783 /// or vector value "Old" at the offset specified by Offset.
789 /// Offset is an offset from the original alloca, in bits that need to be
793 uint64_t Offset, IRBuilder<> &Builder) {
811 unsigned Elt = Offset/EltSize;
821 Offset+Layout.getElementOffsetInBits(i),
831 Old = ConvertScalar_InsertValue(Elt, Old, Offset+i*EltSize, Builder);
865 // On big-endian machines, the lowest bit is stored at the bit offset
868 ShAmt = DestStoreWidth - SrcStoreWidth - Offset;
870 ShAmt = Offset;
1502 /// the Info parameter. Offset indicates the position within AI that is
1504 void SROA::isSafeForScalarRepl(Instruction *I, uint64_t Offset,
1510 isSafeForScalarRepl(BC, Offset, Info);
1512 uint64_t GEPOffset = Offset;
1520 isSafeMemAccess(Offset, Length->getZExtValue(), 0,
1527 isSafeMemAccess(Offset, TD->getTypeAllocSize(LIType),
1537 isSafeMemAccess(Offset, TD->getTypeAllocSize(SIType),
1545 isSafePHISelectUseForScalarRepl(User, Offset, Info);
1563 void SROA::isSafePHISelectUseForScalarRepl(Instruction *I, uint64_t Offset,
1574 isSafePHISelectUseForScalarRepl(BC, Offset, Info);
1581 isSafePHISelectUseForScalarRepl(GEPI, Offset, Info);
1586 isSafeMemAccess(Offset, TD->getTypeAllocSize(LIType),
1596 isSafeMemAccess(Offset, TD->getTypeAllocSize(SIType),
1600 isSafePHISelectUseForScalarRepl(User, Offset, Info);
1610 /// references, and when the resulting offset corresponds to an element within
1612 /// return, Offset is adjusted as specified by the GEP indices.
1614 uint64_t &Offset, AllocaInfo &Info) {
1631 // Compute the offset due to this GEP and check if the alloca has a
1632 // component element at that offset.
1634 Offset += TD->getIndexedOffset(GEPI->getPointerOperandType(), Indices);
1635 if (!TypeHasComponent(Info.AI->getAllocatedType(), Offset, 0))
1680 /// alloca or has an offset and size that corresponds to a component element
1681 /// within it. The offset checked here may have been formed from a GEP with a
1686 void SROA::isSafeMemAccess(uint64_t Offset, uint64_t MemSize,
1691 if (Offset == 0 && AllowWholeAccess &&
1713 // Check if the offset/size correspond to a component within the alloca type.
1715 if (TypeHasComponent(T, Offset, MemSize)) {
1724 /// specified offset and size. If Size is zero, do not check the size.
1725 bool SROA::TypeHasComponent(Type *T, uint64_t Offset, uint64_t Size) {
1730 unsigned EltIdx = Layout->getElementContainingOffset(Offset);
1733 Offset -= Layout->getElementOffset(EltIdx);
1737 if (Offset >= AT->getNumElements() * EltSize)
1739 Offset %= EltSize;
1743 if (Offset == 0 && (Size == 0 || EltSize == Size))
1746 if (Offset + Size > EltSize)
1748 return TypeHasComponent(EltTy, Offset, Size);
1753 /// Offset indicates the position within AI that is referenced by this
1755 void SROA::RewriteForScalarRepl(Instruction *I, AllocaInst *AI, uint64_t Offset,
1762 RewriteBitCast(BC, AI, Offset, NewElts);
1767 RewriteGEP(GEPI, AI, Offset, NewElts);
1774 if (Offset == 0 &&
1785 RewriteLifetimeIntrinsic(II, AI, Offset, NewElts);
1852 assert(Offset == 0 && NewElts[0] &&
1853 "Direct alloca use should have a zero offset");
1869 void SROA::RewriteBitCast(BitCastInst *BC, AllocaInst *AI, uint64_t Offset,
1871 RewriteForScalarRepl(BC, AI, Offset, NewElts);
1886 /// FindElementAndOffset - Return the index of the element containing Offset
1888 /// Sets T to the type of the element and Offset to the offset within that
1891 uint64_t SROA::FindElementAndOffset(Type *&T, uint64_t &Offset,
1896 Idx = Layout->getElementContainingOffset(Offset);
1898 Offset -= Layout->getElementOffset(Idx);
1905 Idx = Offset / EltSize;
1906 Offset -= Idx * EltSize;
1914 void SROA::RewriteGEP(GetElementPtrInst *GEPI, AllocaInst *AI, uint64_t Offset,
1916 uint64_t OldOffset = Offset;
1918 Offset += TD->getIndexedOffset(GEPI->getPointerOperandType(), Indices);
1920 RewriteForScalarRepl(GEPI, AI, Offset, NewElts);
1929 uint64_t EltOffset = Offset;
1958 uint64_t Offset,
1961 // Put matching lifetime markers on everything from Offset up to
1962 // Offset+OldSize.
1964 uint64_t NewOffset = Offset;
2094 // the memcpy (f.e.) is 32 but the element is at a 4-byte offset, then the
2187 // Extract each element out of the integer according to its structure offset
2204 // have different ways to compute the element offset.
2301 // Extract each element out of the NewElts according to its structure offset
2310 // have different ways to compute the element offset.
2507 // If the GEP has all zero indices, it doesn't offset the pointer. If it
2563 // If the pointer has been offset from the start of the alloca, we can't