Lines Matching refs:SrcVal

396 static Value *getStoreValueForLoadHelper(Value *SrcVal, unsigned Offset,  in getStoreValueForLoadHelper()  argument
399 LLVMContext &Ctx = SrcVal->getType()->getContext(); in getStoreValueForLoadHelper()
404 if (SrcVal->getType()->isPointerTy() && LoadTy->isPointerTy() && in getStoreValueForLoadHelper()
405 cast<PointerType>(SrcVal->getType())->getAddressSpace() == in getStoreValueForLoadHelper()
407 return SrcVal; in getStoreValueForLoadHelper()
411 (DL.getTypeSizeInBits(SrcVal->getType()).getFixedSize() + 7) / 8; in getStoreValueForLoadHelper()
415 if (SrcVal->getType()->isPtrOrPtrVectorTy()) in getStoreValueForLoadHelper()
416 SrcVal = in getStoreValueForLoadHelper()
417 Builder.CreatePtrToInt(SrcVal, DL.getIntPtrType(SrcVal->getType())); in getStoreValueForLoadHelper()
418 if (!SrcVal->getType()->isIntegerTy()) in getStoreValueForLoadHelper()
419 SrcVal = in getStoreValueForLoadHelper()
420 Builder.CreateBitCast(SrcVal, IntegerType::get(Ctx, StoreSize * 8)); in getStoreValueForLoadHelper()
429 SrcVal = Builder.CreateLShr(SrcVal, in getStoreValueForLoadHelper()
430 ConstantInt::get(SrcVal->getType(), ShiftAmt)); in getStoreValueForLoadHelper()
433 SrcVal = Builder.CreateTruncOrBitCast(SrcVal, in getStoreValueForLoadHelper()
435 return SrcVal; in getStoreValueForLoadHelper()
442 Value *getStoreValueForLoad(Value *SrcVal, unsigned Offset, Type *LoadTy, in getStoreValueForLoad() argument
446 SrcVal = getStoreValueForLoadHelper(SrcVal, Offset, LoadTy, Builder, DL); in getStoreValueForLoad()
447 return coerceAvailableValueToLoadType(SrcVal, LoadTy, Builder, DL); in getStoreValueForLoad()
450 Constant *getConstantStoreValueForLoad(Constant *SrcVal, unsigned Offset, in getConstantStoreValueForLoad() argument
452 return ConstantFoldLoadFromConst(SrcVal, LoadTy, APInt(32, Offset), DL); in getConstantStoreValueForLoad()
460 Value *getLoadValueForLoad(LoadInst *SrcVal, unsigned Offset, Type *LoadTy, in getLoadValueForLoad() argument
465 DL.getTypeStoreSize(SrcVal->getType()).getFixedSize(); in getLoadValueForLoad()
468 assert(SrcVal->isSimple() && "Cannot widen volatile/atomic load!"); in getLoadValueForLoad()
469 assert(SrcVal->getType()->isIntegerTy() && "Can't widen non-integer load"); in getLoadValueForLoad()
476 Value *PtrVal = SrcVal->getPointerOperand(); in getLoadValueForLoad()
480 IRBuilder<> Builder(SrcVal->getParent(), ++BasicBlock::iterator(SrcVal)); in getLoadValueForLoad()
484 Builder.SetCurrentDebugLocation(SrcVal->getDebugLoc()); in getLoadValueForLoad()
487 NewLoad->takeName(SrcVal); in getLoadValueForLoad()
488 NewLoad->setAlignment(SrcVal->getAlign()); in getLoadValueForLoad()
490 LLVM_DEBUG(dbgs() << "GVN WIDENED LOAD: " << *SrcVal << "\n"); in getLoadValueForLoad()
498 RV = Builder.CreateTrunc(RV, SrcVal->getType()); in getLoadValueForLoad()
499 SrcVal->replaceAllUsesWith(RV); in getLoadValueForLoad()
501 SrcVal = NewLoad; in getLoadValueForLoad()
504 return getStoreValueForLoad(SrcVal, Offset, LoadTy, InsertPt, DL); in getLoadValueForLoad()
507 Constant *getConstantLoadValueForLoad(Constant *SrcVal, unsigned Offset, in getConstantLoadValueForLoad() argument
510 DL.getTypeStoreSize(SrcVal->getType()).getFixedSize(); in getConstantLoadValueForLoad()
514 return getConstantStoreValueForLoad(SrcVal, Offset, LoadTy, DL); in getConstantLoadValueForLoad()