Lines Matching refs:IRB

1276 static void speculatePHINodeLoads(IRBuilderTy &IRB, PHINode &PN) {  in speculatePHINodeLoads()  argument
1281 IRB.SetInsertPoint(&PN); in speculatePHINodeLoads()
1282 PHINode *NewPN = IRB.CreatePHI(LoadTy, PN.getNumIncomingValues(), in speculatePHINodeLoads()
1313 IRB.SetInsertPoint(TI); in speculatePHINodeLoads()
1315 LoadInst *Load = IRB.CreateAlignedLoad( in speculatePHINodeLoads()
1373 static void speculateSelectInstLoads(IRBuilderTy &IRB, SelectInst &SI) { in speculateSelectInstLoads() argument
1376 IRB.SetInsertPoint(&SI); in speculateSelectInstLoads()
1392 IRB.SetInsertPoint(LI); in speculateSelectInstLoads()
1394 BC ? IRB.CreateBitCast(TV, BC->getType(), TV->getName() + ".sroa.cast") in speculateSelectInstLoads()
1397 BC ? IRB.CreateBitCast(FV, BC->getType(), FV->getName() + ".sroa.cast") in speculateSelectInstLoads()
1399 LoadInst *TL = IRB.CreateLoad(LI->getType(), NewTV, in speculateSelectInstLoads()
1401 LoadInst *FL = IRB.CreateLoad(LI->getType(), NewFV, in speculateSelectInstLoads()
1415 Value *V = IRB.CreateSelect(SI.getCondition(), TL, FL, in speculateSelectInstLoads()
1431 static Value *buildGEP(IRBuilderTy &IRB, Value *BasePtr, in buildGEP() argument
1443 return IRB.CreateInBoundsGEP( in buildGEP()
1457 static Value *getNaturalGEPWithType(IRBuilderTy &IRB, const DataLayout &DL, in getNaturalGEPWithType() argument
1462 return buildGEP(IRB, BasePtr, Indices, NamePrefix); in getNaturalGEPWithType()
1477 Indices.push_back(IRB.getIntN(OffsetSize, 0)); in getNaturalGEPWithType()
1480 Indices.push_back(IRB.getInt32(0)); in getNaturalGEPWithType()
1485 Indices.push_back(IRB.getInt32(0)); in getNaturalGEPWithType()
1494 return buildGEP(IRB, BasePtr, Indices, NamePrefix); in getNaturalGEPWithType()
1507 static Value *getNaturalGEPWithOffset(IRBuilderTy &IRB, const DataLayout &DL, in getNaturalGEPWithOffset() argument
1515 if (Ty == IRB.getInt8PtrTy(Ty->getAddressSpace()) && TargetTy->isIntegerTy(8)) in getNaturalGEPWithOffset()
1527 Indices.push_back(IRB.getInt(Index)); in getNaturalGEPWithOffset()
1528 return getNaturalGEPWithType(IRB, DL, Ptr, ElementTy, TargetTy, Indices, in getNaturalGEPWithOffset()
1547 static Value *getAdjustedPtr(IRBuilderTy &IRB, const DataLayout &DL, Value *Ptr, in getAdjustedPtr() argument
1553 Ptr = IRB.CreateInBoundsGEP(IRB.getInt8Ty(), Ptr, IRB.getInt(Offset), in getAdjustedPtr()
1555 return IRB.CreatePointerBitCastOrAddrSpaceCast(Ptr, PointerTy, in getAdjustedPtr()
1599 if (Value *P = getNaturalGEPWithOffset(IRB, DL, Ptr, Offset, TargetTy, in getAdjustedPtr()
1637 Int8Ptr = IRB.CreateBitCast( in getAdjustedPtr()
1638 Ptr, IRB.getInt8PtrTy(PointerTy->getPointerAddressSpace()), in getAdjustedPtr()
1645 : IRB.CreateInBoundsGEP(IRB.getInt8Ty(), Int8Ptr, in getAdjustedPtr()
1646 IRB.getInt(Int8PtrOffset), in getAdjustedPtr()
1653 Ptr = IRB.CreatePointerBitCastOrAddrSpaceCast(Ptr, in getAdjustedPtr()
1731 static Value *convertValue(const DataLayout &DL, IRBuilderTy &IRB, Value *V, in convertValue() argument
1748 return IRB.CreateIntToPtr(IRB.CreateBitCast(V, DL.getIntPtrType(NewTy)), in convertValue()
1758 return IRB.CreateBitCast(IRB.CreatePtrToInt(V, DL.getIntPtrType(OldTy)), in convertValue()
1773 return IRB.CreateIntToPtr(IRB.CreatePtrToInt(V, DL.getIntPtrType(OldTy)), in convertValue()
1778 return IRB.CreateBitCast(V, NewTy); in convertValue()
2115 static Value *extractInteger(const DataLayout &DL, IRBuilderTy &IRB, Value *V, in extractInteger() argument
2128 V = IRB.CreateLShr(V, ShAmt, Name + ".shift"); in extractInteger()
2134 V = IRB.CreateTrunc(V, Ty, Name + ".trunc"); in extractInteger()
2140 static Value *insertInteger(const DataLayout &DL, IRBuilderTy &IRB, Value *Old, in insertInteger() argument
2148 V = IRB.CreateZExt(V, IntTy, Name + ".ext"); in insertInteger()
2159 V = IRB.CreateShl(V, ShAmt, Name + ".shift"); in insertInteger()
2165 Old = IRB.CreateAnd(Old, Mask, Name + ".mask"); in insertInteger()
2167 V = IRB.CreateOr(Old, V, Name + ".insert"); in insertInteger()
2173 static Value *extractVector(IRBuilderTy &IRB, Value *V, unsigned BeginIndex, in extractVector() argument
2183 V = IRB.CreateExtractElement(V, IRB.getInt32(BeginIndex), in extractVector()
2190 V = IRB.CreateShuffleVector(V, Mask, Name + ".extract"); in extractVector()
2195 static Value *insertVector(IRBuilderTy &IRB, Value *Old, Value *V, in insertVector() argument
2203 V = IRB.CreateInsertElement(Old, V, IRB.getInt32(BeginIndex), in insertVector()
2230 V = IRB.CreateShuffleVector(V, Mask, Name + ".expand"); in insertVector()
2236 Mask2.push_back(IRB.getInt1(i >= BeginIndex && i < EndIndex)); in insertVector()
2238 V = IRB.CreateSelect(ConstantVector::get(Mask2), V, Old, Name + "blend"); in insertVector()
2304 IRBuilderTy IRB; member in llvm::sroa::AllocaSliceRewriter
2329 IRB(NewAI.getContext(), ConstantFolder()) { in AllocaSliceRewriter()
2361 IRB.SetInsertPoint(OldUserI); in visit()
2362 IRB.SetCurrentDebugLocation(OldUserI->getDebugLoc()); in visit()
2363 IRB.getInserter().SetNamePrefix( in visit()
2382 Value *getNewAllocaSlicePtr(IRBuilderTy &IRB, Type *PointerTy) { in getNewAllocaSlicePtr() argument
2409 return getAdjustedPtr(IRB, DL, &NewAI, in getNewAllocaSlicePtr()
2450 LoadInst *Load = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI, in rewriteVectorizedLoadInst()
2455 return extractVector(IRB, Load, BeginIndex, EndIndex, "vec"); in rewriteVectorizedLoadInst()
2461 Value *V = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI, in rewriteIntegerLoad()
2463 V = convertValue(DL, IRB, V, IntTy); in rewriteIntegerLoad()
2468 V = extractInteger(DL, IRB, V, ExtractTy, Offset, "extract"); in rewriteIntegerLoad()
2478 V = IRB.CreateZExt(V, LI.getType()); in rewriteIntegerLoad()
2506 LoadInst *NewLI = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI, in visitLoadInst()
2538 V = IRB.CreateZExt(V, TITy, "load.ext"); in visitLoadInst()
2540 V = IRB.CreateShl(V, TITy->getBitWidth() - AITy->getBitWidth(), in visitLoadInst()
2546 IRB.CreateAlignedLoad(TargetTy, getNewAllocaSlicePtr(IRB, LTy), in visitLoadInst()
2558 V = convertValue(DL, IRB, V, TargetTy); in visitLoadInst()
2569 IRB.SetInsertPoint(&*std::next(BasicBlock::iterator(&LI))); in visitLoadInst()
2577 V = insertInteger(DL, IRB, Placeholder, V, NewBeginOffset - BeginOffset, in visitLoadInst()
2605 V = convertValue(DL, IRB, V, SliceTy); in rewriteVectorizedStoreInst()
2608 Value *Old = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI, in rewriteVectorizedStoreInst()
2610 V = insertVector(IRB, Old, V, BeginIndex, "vec"); in rewriteVectorizedStoreInst()
2612 StoreInst *Store = IRB.CreateAlignedStore(V, &NewAI, NewAI.getAlign()); in rewriteVectorizedStoreInst()
2628 Value *Old = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI, in rewriteIntegerStore()
2630 Old = convertValue(DL, IRB, Old, IntTy); in rewriteIntegerStore()
2633 V = insertInteger(DL, IRB, Old, SI.getValueOperand(), Offset, "insert"); in rewriteIntegerStore()
2635 V = convertValue(DL, IRB, V, NewAllocaTy); in rewriteIntegerStore()
2636 StoreInst *Store = IRB.CreateAlignedStore(V, &NewAI, NewAI.getAlign()); in rewriteIntegerStore()
2667 V = extractInteger(DL, IRB, V, NarrowTy, NewBeginOffset - BeginOffset, in visitStoreInst()
2691 V = IRB.CreateLShr(V, VITy->getBitWidth() - AITy->getBitWidth(), in visitStoreInst()
2693 V = IRB.CreateTrunc(V, AITy, "load.trunc"); in visitStoreInst()
2696 V = convertValue(DL, IRB, V, NewAllocaTy); in visitStoreInst()
2698 IRB.CreateAlignedStore(V, &NewAI, NewAI.getAlign(), SI.isVolatile()); in visitStoreInst()
2701 Value *NewPtr = getNewAllocaSlicePtr(IRB, V->getType()->getPointerTo(AS)); in visitStoreInst()
2703 IRB.CreateAlignedStore(V, NewPtr, getSliceAlign(), SI.isVolatile()); in visitStoreInst()
2739 V = IRB.CreateMul( in getIntegerSplat()
2740 IRB.CreateZExt(V, SplatIntTy, "zext"), in getIntegerSplat()
2741 IRB.CreateUDiv(Constant::getAllOnesValue(SplatIntTy), in getIntegerSplat()
2742 IRB.CreateZExt(Constant::getAllOnesValue(V->getType()), in getIntegerSplat()
2750 V = IRB.CreateVectorSplat(NumElements, V, "vsplat"); in getVectorSplat()
2766 II.setDest(getNewAllocaSlicePtr(IRB, OldPtr->getType())); in visitMemSetInst()
2801 CallInst *New = IRB.CreateMemSet( in visitMemSetInst()
2802 getNewAllocaSlicePtr(IRB, OldPtr->getType()), II.getValue(), Size, in visitMemSetInst()
2830 Splat = convertValue(DL, IRB, Splat, ElementTy); in visitMemSetInst()
2834 Value *Old = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI, in visitMemSetInst()
2836 V = insertVector(IRB, Old, Splat, BeginIndex, "vec"); in visitMemSetInst()
2847 Value *Old = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI, in visitMemSetInst()
2849 Old = convertValue(DL, IRB, Old, IntTy); in visitMemSetInst()
2851 V = insertInteger(DL, IRB, Old, V, Offset, "insert"); in visitMemSetInst()
2856 V = convertValue(DL, IRB, V, AllocaTy); in visitMemSetInst()
2868 V = convertValue(DL, IRB, V, AllocaTy); in visitMemSetInst()
2872 IRB.CreateAlignedStore(V, &NewAI, NewAI.getAlign(), II.isVolatile()); in visitMemSetInst()
2903 Value *AdjustedPtr = getNewAllocaSlicePtr(IRB, OldPtr->getType()); in visitMemTransferInst()
2972 OtherPtr = getAdjustedPtr(IRB, DL, OtherPtr, OtherOffset, OtherPtrTy, in visitMemTransferInst()
2975 Value *OurPtr = getNewAllocaSlicePtr(IRB, OldPtr->getType()); in visitMemTransferInst()
2993 CallInst *New = IRB.CreateMemCpy(DestPtr, DestAlign, SrcPtr, SrcAlign, in visitMemTransferInst()
3025 Value *SrcPtr = getAdjustedPtr(IRB, DL, OtherPtr, OtherOffset, OtherPtrTy, in visitMemTransferInst()
3037 Src = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI, in visitMemTransferInst()
3039 Src = extractVector(IRB, Src, BeginIndex, EndIndex, "vec"); in visitMemTransferInst()
3041 Src = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI, in visitMemTransferInst()
3043 Src = convertValue(DL, IRB, Src, IntTy); in visitMemTransferInst()
3045 Src = extractInteger(DL, IRB, Src, SubIntTy, Offset, "extract"); in visitMemTransferInst()
3047 LoadInst *Load = IRB.CreateAlignedLoad(OtherTy, SrcPtr, SrcAlign, in visitMemTransferInst()
3057 Value *Old = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI, in visitMemTransferInst()
3059 Src = insertVector(IRB, Old, Src, BeginIndex, "vec"); in visitMemTransferInst()
3061 Value *Old = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI, in visitMemTransferInst()
3063 Old = convertValue(DL, IRB, Old, IntTy); in visitMemTransferInst()
3065 Src = insertInteger(DL, IRB, Old, Src, Offset, "insert"); in visitMemTransferInst()
3066 Src = convertValue(DL, IRB, Src, NewAllocaTy); in visitMemTransferInst()
3070 IRB.CreateAlignedStore(Src, DstPtr, DstAlign, II.isVolatile())); in visitMemTransferInst()
3111 Type *PointerTy = IRB.getInt8PtrTy(OldPtr->getType()->getPointerAddressSpace()); in visitIntrinsicInst()
3112 Value *Ptr = getNewAllocaSlicePtr(IRB, PointerTy); in visitIntrinsicInst()
3115 New = IRB.CreateLifetimeStart(Ptr, Size); in visitIntrinsicInst()
3117 New = IRB.CreateLifetimeEnd(Ptr, Size); in visitIntrinsicInst()
3163 IRBuilderBase::InsertPointGuard Guard(IRB); in visitPHINode()
3165 IRB.SetInsertPoint(&*OldPtr->getParent()->getFirstInsertionPt()); in visitPHINode()
3167 IRB.SetInsertPoint(OldPtr); in visitPHINode()
3168 IRB.SetCurrentDebugLocation(OldPtr->getDebugLoc()); in visitPHINode()
3170 Value *NewPtr = getNewAllocaSlicePtr(IRB, OldPtr->getType()); in visitPHINode()
3194 Value *NewPtr = getNewAllocaSlicePtr(IRB, OldPtr->getType()); in visitSelectInst()
3239 IRBuilderTy &IRB; member in __anon3ad87db80b11::AggLoadStoreRewriter
3242 AggLoadStoreRewriter(const DataLayout &DL, IRBuilderTy &IRB) in AggLoadStoreRewriter() argument
3243 : DL(DL), IRB(IRB) {} in AggLoadStoreRewriter()
3274 IRBuilderTy &IRB; member in __anon3ad87db80b11::AggLoadStoreRewriter::OpSplitter
3301 Align BaseAlign, const DataLayout &DL, IRBuilderTy &IRB) in OpSplitter() argument
3302 : IRB(IRB), GEPIndices(1, IRB.getInt32(0)), Ptr(Ptr), BaseTy(BaseTy), in OpSplitter()
3304 IRB.SetInsertPoint(InsertionPoint); in OpSplitter()
3335 GEPIndices.push_back(IRB.getInt32(Idx)); in emitSplitOps()
3350 GEPIndices.push_back(IRB.getInt32(Idx)); in emitSplitOps()
3367 IRBuilderTy &IRB) in LoadOpSplitter()
3369 IRB), in LoadOpSplitter()
3378 IRB.CreateInBoundsGEP(BaseTy, Ptr, GEPIndices, Name + ".gep"); in emitFunc()
3380 IRB.CreateAlignedLoad(Ty, GEP, Alignment, Name + ".load"); in emitFunc()
3388 Agg = IRB.CreateInsertValue(Agg, Load, Indices, Name + ".insert"); in emitFunc()
3401 getAdjustedAlignment(&LI, 0), DL, IRB); in visitLoadInst()
3413 IRBuilderTy &IRB) in StoreOpSplitter()
3415 DL, IRB), in StoreOpSplitter()
3427 IRB.CreateExtractValue(Agg, Indices, Name + ".extract"); in emitFunc()
3429 IRB.CreateInBoundsGEP(BaseTy, Ptr, GEPIndices, Name + ".gep"); in emitFunc()
3431 IRB.CreateAlignedStore(ExtractValue, InBoundsGEP, Alignment); in emitFunc()
3453 getAdjustedAlignment(&SI, 0), DL, IRB); in visitStoreInst()
3481 IRB.SetInsertPoint(&GEPI); in foldGEPSelect()
3487 Value *NTrue = IRB.CreateGEP(Ty, True, Index, True->getName() + ".sroa.gep", in foldGEPSelect()
3492 Value *NFalse = IRB.CreateGEP(Ty, False, Index, in foldGEPSelect()
3495 Value *NSel = IRB.CreateSelect(Sel->getCondition(), NTrue, NFalse, in foldGEPSelect()
3533 IRB.SetInsertPoint(GEPI.getParent()->getFirstNonPHI()); in foldGEPPhi()
3534 PHINode *NewPN = IRB.CreatePHI(GEPI.getType(), PHI->getNumIncomingValues(), in foldGEPPhi()
3545 IRB.SetInsertPoint(In->getParent(), std::next(In->getIterator())); in foldGEPPhi()
3547 NewVal = IRB.CreateGEP(Ty, In, Index, In->getName() + ".sroa.gep", in foldGEPPhi()
3947 IRBuilderTy IRB(&AI); in presplitLoadsAndStores() local
3982 IRB.SetInsertPoint(LI); in presplitLoadsAndStores()
3992 LoadInst *PLoad = IRB.CreateAlignedLoad( in presplitLoadsAndStores()
3994 getAdjustedPtr(IRB, DL, BasePtr, in presplitLoadsAndStores()
4039 IRB.SetInsertPoint(SI); in presplitLoadsAndStores()
4050 StoreInst *PStore = IRB.CreateAlignedStore( in presplitLoadsAndStores()
4052 getAdjustedPtr(IRB, DL, StoreBasePtr, in presplitLoadsAndStores()
4134 IRB.SetInsertPoint(LI); in presplitLoadsAndStores()
4136 PLoad = IRB.CreateAlignedLoad( in presplitLoadsAndStores()
4138 getAdjustedPtr(IRB, DL, LoadBasePtr, in presplitLoadsAndStores()
4148 IRB.SetInsertPoint(SI); in presplitLoadsAndStores()
4150 StoreInst *PStore = IRB.CreateAlignedStore( in presplitLoadsAndStores()
4152 getAdjustedPtr(IRB, DL, StoreBasePtr, in presplitLoadsAndStores()
4611 IRBuilderTy IRB(&AI); in runOnAlloca() local
4612 AggLoadStoreRewriter AggRewriter(DL, IRB); in runOnAlloca()
4647 speculatePHINodeLoads(IRB, *SpeculatablePHIs.pop_back_val()); in runOnAlloca()
4651 speculateSelectInstLoads(IRB, *SpeculatableSelects.pop_back_val()); in runOnAlloca()