Lines Matching full:srcval
1093 static Value *GetStoreValueForLoad(Value *SrcVal, unsigned Offset,
1096 LLVMContext &Ctx = SrcVal->getType()->getContext();
1098 uint64_t StoreSize = (TD.getTypeSizeInBits(SrcVal->getType()) + 7) / 8;
1105 if (SrcVal->getType()->getScalarType()->isPointerTy())
1106 SrcVal = Builder.CreatePtrToInt(SrcVal,
1107 TD.getIntPtrType(SrcVal->getType()));
1108 if (!SrcVal->getType()->isIntegerTy())
1109 SrcVal = Builder.CreateBitCast(SrcVal, IntegerType::get(Ctx, StoreSize*8));
1119 SrcVal = Builder.CreateLShr(SrcVal, ShiftAmt);
1122 SrcVal = Builder.CreateTrunc(SrcVal, IntegerType::get(Ctx, LoadSize*8));
1124 return CoerceAvailableValueToLoadType(SrcVal, LoadTy, InsertPt, TD);
1132 static Value *GetLoadValueForLoad(LoadInst *SrcVal, unsigned Offset,
1136 // If Offset+LoadTy exceeds the size of SrcVal, then we must be wanting to
1137 // widen SrcVal out to a larger load.
1138 unsigned SrcValSize = TD.getTypeStoreSize(SrcVal->getType());
1141 assert(SrcVal->isSimple() && "Cannot widen volatile/atomic load!");
1142 assert(SrcVal->getType()->isIntegerTy() && "Can't widen non-integer load");
1149 Value *PtrVal = SrcVal->getPointerOperand();
1154 IRBuilder<> Builder(SrcVal->getParent(), ++BasicBlock::iterator(SrcVal));
1159 Builder.SetCurrentDebugLocation(SrcVal->getDebugLoc());
1162 NewLoad->takeName(SrcVal);
1163 NewLoad->setAlignment(SrcVal->getAlignment());
1165 DEBUG(dbgs() << "GVN WIDENED LOAD: " << *SrcVal << "\n");
1173 NewLoadSize*8-SrcVal->getType()->getPrimitiveSizeInBits());
1174 RV = Builder.CreateTrunc(RV, SrcVal->getType());
1175 SrcVal->replaceAllUsesWith(RV);
1182 gvn.getMemDep().removeInstruction(SrcVal);
1183 SrcVal = NewLoad;
1186 return GetStoreValueForLoad(SrcVal, Offset, LoadTy, InsertPt, TD);