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