Lines Matching refs:SrcVal

306 static T *getStoreValueForLoadHelper(T *SrcVal, unsigned Offset, Type *LoadTy,  in getStoreValueForLoadHelper()  argument
309 LLVMContext &Ctx = SrcVal->getType()->getContext(); in getStoreValueForLoadHelper()
314 if (SrcVal->getType()->isPointerTy() && LoadTy->isPointerTy() && in getStoreValueForLoadHelper()
315 cast<PointerType>(SrcVal->getType())->getAddressSpace() == in getStoreValueForLoadHelper()
317 return SrcVal; in getStoreValueForLoadHelper()
320 uint64_t StoreSize = (DL.getTypeSizeInBits(SrcVal->getType()) + 7) / 8; in getStoreValueForLoadHelper()
324 if (SrcVal->getType()->isPtrOrPtrVectorTy()) in getStoreValueForLoadHelper()
325 SrcVal = Helper.CreatePtrToInt(SrcVal, DL.getIntPtrType(SrcVal->getType())); in getStoreValueForLoadHelper()
326 if (!SrcVal->getType()->isIntegerTy()) in getStoreValueForLoadHelper()
327 SrcVal = Helper.CreateBitCast(SrcVal, IntegerType::get(Ctx, StoreSize * 8)); in getStoreValueForLoadHelper()
336 SrcVal = Helper.CreateLShr(SrcVal, in getStoreValueForLoadHelper()
337 ConstantInt::get(SrcVal->getType(), ShiftAmt)); in getStoreValueForLoadHelper()
340 SrcVal = Helper.CreateTruncOrBitCast(SrcVal, in getStoreValueForLoadHelper()
342 return SrcVal; in getStoreValueForLoadHelper()
349 Value *getStoreValueForLoad(Value *SrcVal, unsigned Offset, Type *LoadTy, in getStoreValueForLoad() argument
353 SrcVal = getStoreValueForLoadHelper(SrcVal, Offset, LoadTy, Builder, DL); in getStoreValueForLoad()
354 return coerceAvailableValueToLoadTypeHelper(SrcVal, LoadTy, Builder, DL); in getStoreValueForLoad()
357 Constant *getConstantStoreValueForLoad(Constant *SrcVal, unsigned Offset, in getConstantStoreValueForLoad() argument
360 SrcVal = getStoreValueForLoadHelper(SrcVal, Offset, LoadTy, F, DL); in getConstantStoreValueForLoad()
361 return coerceAvailableValueToLoadTypeHelper(SrcVal, LoadTy, F, DL); in getConstantStoreValueForLoad()
369 Value *getLoadValueForLoad(LoadInst *SrcVal, unsigned Offset, Type *LoadTy, in getLoadValueForLoad() argument
373 unsigned SrcValStoreSize = DL.getTypeStoreSize(SrcVal->getType()); in getLoadValueForLoad()
376 assert(SrcVal->isSimple() && "Cannot widen volatile/atomic load!"); in getLoadValueForLoad()
377 assert(SrcVal->getType()->isIntegerTy() && "Can't widen non-integer load"); in getLoadValueForLoad()
384 Value *PtrVal = SrcVal->getPointerOperand(); in getLoadValueForLoad()
388 IRBuilder<> Builder(SrcVal->getParent(), ++BasicBlock::iterator(SrcVal)); in getLoadValueForLoad()
392 Builder.SetCurrentDebugLocation(SrcVal->getDebugLoc()); in getLoadValueForLoad()
395 NewLoad->takeName(SrcVal); in getLoadValueForLoad()
396 NewLoad->setAlignment(SrcVal->getAlignment()); in getLoadValueForLoad()
398 LLVM_DEBUG(dbgs() << "GVN WIDENED LOAD: " << *SrcVal << "\n"); in getLoadValueForLoad()
406 RV = Builder.CreateTrunc(RV, SrcVal->getType()); in getLoadValueForLoad()
407 SrcVal->replaceAllUsesWith(RV); in getLoadValueForLoad()
409 SrcVal = NewLoad; in getLoadValueForLoad()
412 return getStoreValueForLoad(SrcVal, Offset, LoadTy, InsertPt, DL); in getLoadValueForLoad()
415 Constant *getConstantLoadValueForLoad(Constant *SrcVal, unsigned Offset, in getConstantLoadValueForLoad() argument
417 unsigned SrcValStoreSize = DL.getTypeStoreSize(SrcVal->getType()); in getConstantLoadValueForLoad()
421 return getConstantStoreValueForLoad(SrcVal, Offset, LoadTy, DL); in getConstantLoadValueForLoad()