Lines Matching refs:SrcVal
986 static Value *GetStoreValueForLoad(Value *SrcVal, unsigned Offset,
989 LLVMContext &Ctx = SrcVal->getType()->getContext();
991 uint64_t StoreSize = (DL.getTypeSizeInBits(SrcVal->getType()) + 7) / 8;
998 if (SrcVal->getType()->getScalarType()->isPointerTy())
999 SrcVal = Builder.CreatePtrToInt(SrcVal,
1000 DL.getIntPtrType(SrcVal->getType()));
1001 if (!SrcVal->getType()->isIntegerTy())
1002 SrcVal = Builder.CreateBitCast(SrcVal, IntegerType::get(Ctx, StoreSize*8));
1012 SrcVal = Builder.CreateLShr(SrcVal, ShiftAmt);
1015 SrcVal = Builder.CreateTrunc(SrcVal, IntegerType::get(Ctx, LoadSize*8));
1017 return CoerceAvailableValueToLoadType(SrcVal, LoadTy, Builder, DL);
1025 static Value *GetLoadValueForLoad(LoadInst *SrcVal, unsigned Offset,
1028 const DataLayout &DL = SrcVal->getModule()->getDataLayout();
1029 // If Offset+LoadTy exceeds the size of SrcVal, then we must be wanting to
1030 // widen SrcVal out to a larger load.
1031 unsigned SrcValStoreSize = DL.getTypeStoreSize(SrcVal->getType());
1034 assert(SrcVal->isSimple() && "Cannot widen volatile/atomic load!");
1035 assert(SrcVal->getType()->isIntegerTy() && "Can't widen non-integer load");
1042 Value *PtrVal = SrcVal->getPointerOperand();
1047 IRBuilder<> Builder(SrcVal->getParent(), ++BasicBlock::iterator(SrcVal));
1052 Builder.SetCurrentDebugLocation(SrcVal->getDebugLoc());
1055 NewLoad->takeName(SrcVal);
1056 NewLoad->setAlignment(SrcVal->getAlignment());
1058 DEBUG(dbgs() << "GVN WIDENED LOAD: " << *SrcVal << "\n");
1066 RV = Builder.CreateTrunc(RV, SrcVal->getType());
1067 SrcVal->replaceAllUsesWith(RV);
1074 gvn.getMemDep().removeInstruction(SrcVal);
1075 SrcVal = NewLoad;
1078 return GetStoreValueForLoad(SrcVal, Offset, LoadTy, InsertPt, DL);