Lines Matching refs:SrcVal
943 static Value *GetStoreValueForLoad(Value *SrcVal, unsigned Offset,
946 LLVMContext &Ctx = SrcVal->getType()->getContext();
948 uint64_t StoreSize = (TD.getTypeSizeInBits(SrcVal->getType()) + 7) / 8;
955 if (SrcVal->getType()->isPointerTy())
956 SrcVal = Builder.CreatePtrToInt(SrcVal, TD.getIntPtrType(Ctx));
957 if (!SrcVal->getType()->isIntegerTy())
958 SrcVal = Builder.CreateBitCast(SrcVal, IntegerType::get(Ctx, StoreSize*8));
968 SrcVal = Builder.CreateLShr(SrcVal, ShiftAmt);
971 SrcVal = Builder.CreateTrunc(SrcVal, IntegerType::get(Ctx, LoadSize*8));
973 return CoerceAvailableValueToLoadType(SrcVal, LoadTy, InsertPt, TD);
981 static Value *GetLoadValueForLoad(LoadInst *SrcVal, unsigned Offset,
985 // If Offset+LoadTy exceeds the size of SrcVal, then we must be wanting to
986 // widen SrcVal out to a larger load.
987 unsigned SrcValSize = TD.getTypeStoreSize(SrcVal->getType());
990 assert(SrcVal->isSimple() && "Cannot widen volatile/atomic load!");
991 assert(SrcVal->getType()->isIntegerTy() && "Can't widen non-integer load");
998 Value *PtrVal = SrcVal->getPointerOperand();
1003 IRBuilder<> Builder(SrcVal->getParent(), ++BasicBlock::iterator(SrcVal));
1008 Builder.SetCurrentDebugLocation(SrcVal->getDebugLoc());
1011 NewLoad->takeName(SrcVal);
1012 NewLoad->setAlignment(SrcVal->getAlignment());
1014 DEBUG(dbgs() << "GVN WIDENED LOAD: " << *SrcVal << "\n");
1022 NewLoadSize*8-SrcVal->getType()->getPrimitiveSizeInBits());
1023 RV = Builder.CreateTrunc(RV, SrcVal->getType());
1024 SrcVal->replaceAllUsesWith(RV);
1031 gvn.getMemDep().removeInstruction(SrcVal);
1032 SrcVal = NewLoad;
1035 return GetStoreValueForLoad(SrcVal, Offset, LoadTy, InsertPt, TD);