Lines Matching defs:IC
197 static Instruction *simplifyAllocaArraySize(InstCombinerImpl &IC,
206 return IC.replaceOperand(AI, 0, IC.Builder.getInt32(1));
213 AllocaInst *New = IC.Builder.CreateAlloca(NewTy, AI.getAddressSpace(),
219 return IC.replaceInstUsesWith(AI, New);
224 return IC.replaceInstUsesWith(AI, Constant::getNullValue(AI.getType()));
229 Type *PtrIdxTy = IC.getDataLayout().getIndexType(AI.getType());
231 Value *V = IC.Builder.CreateIntCast(AI.getArraySize(), PtrIdxTy, false);
232 return IC.replaceOperand(AI, 0, V);
251 PointerReplacer(InstCombinerImpl &IC, Instruction &Root, unsigned SrcAS)
252 : IC(IC), Root(Root), FromAS(SrcAS) {}
271 return (FromAS == ToAS) || IC.isValidAddrSpaceCast(FromAS, ToAS);
277 InstCombinerImpl ⁣
375 IC.InsertNewInstWith(NewI, LT->getIterator());
376 IC.replaceInstUsesWith(*LT, NewI);
392 IC.InsertNewInstWith(NewI, GEP->getIterator());
405 IC.InsertNewInstWith(NewSI, SI->getIterator());
417 IC.Builder.SetInsertPoint(MemCpy);
418 auto *NewI = IC.Builder.CreateMemTransferInst(
425 IC.eraseInstFromFunction(*MemCpy);
438 IC.InsertNewInstWith(NewI, ASC->getIterator());
578 static StoreInst *combineStoreToNewValue(InstCombinerImpl &IC, StoreInst &SI,
588 IC.Builder.CreateAlignedStore(V, Ptr, SI.getAlign(), SI.isVolatile());
648 static Instruction *combineLoadToOperationType(InstCombinerImpl &IC,
677 if (CastUser->isNoopCast(IC.getDataLayout()) &&
680 LoadInst *NewLoad = IC.combineLoadToNewType(Load, DestTy);
682 IC.eraseInstFromFunction(*CastUser);
693 static Instruction *unpackLoadToAggregate(InstCombinerImpl &IC, LoadInst &LI) {
709 LoadInst *NewLoad = IC.combineLoadToNewType(LI, ST->getTypeAtIndex(0U),
712 return IC.replaceInstUsesWith(LI, IC.Builder.CreateInsertValue(
718 const DataLayout &DL = IC.getDataLayout();
739 auto *Ptr = IC.Builder.CreateInBoundsGEP(ST, Addr, ArrayRef(Indices),
741 auto *L = IC.Builder.CreateAlignedLoad(
746 V = IC.Builder.CreateInsertValue(V, L, i);
750 return IC.replaceInstUsesWith(LI, V);
757 LoadInst *NewLoad = IC.combineLoadToNewType(LI, ET, ".unpack");
759 return IC.replaceInstUsesWith(LI, IC.Builder.CreateInsertValue(
767 if (NumElements > IC.MaxArraySizeForCombine)
770 const DataLayout &DL = IC.getDataLayout();
785 auto *Ptr = IC.Builder.CreateInBoundsGEP(AT, Addr, ArrayRef(Indices),
788 auto *L = IC.Builder.CreateAlignedLoad(AT->getElementType(), Ptr,
791 V = IC.Builder.CreateInsertValue(V, L, i);
796 return IC.replaceInstUsesWith(LI, V);
890 static bool canReplaceGEPIdxWithZero(InstCombinerImpl &IC,
930 const DataLayout &DL = IC.getDataLayout();
939 KnownBits Known = IC.computeKnownBits(GEPI->getOperand(i), 0, MemI);
965 static Instruction *replaceGEPIdxWithZero(InstCombinerImpl &IC, Value *Ptr,
969 if (canReplaceGEPIdxWithZero(IC, GEPI, &MemI, Idx)) {
973 IC.InsertNewInstBefore(NewGEPI, GEPI->getIterator());
1118 static Value *likeBitCastFromVector(InstCombinerImpl &IC, Value *V) {
1140 const auto &DL = IC.getDataLayout();
1178 /// combined or not: IC.EraseInstFromFunction returns a null pointer.
1179 static bool combineStoreToValueType(InstCombinerImpl &IC, StoreInst &SI) {
1201 combineStoreToNewValue(IC, SI, V);
1206 if (Value *U = likeBitCastFromVector(IC, V))
1208 combineStoreToNewValue(IC, SI, U);
1217 static bool unpackStoreToAggregate(InstCombinerImpl &IC, StoreInst &SI) {
1233 V = IC.Builder.CreateExtractValue(V, 0);
1234 combineStoreToNewValue(IC, SI, V);
1240 const DataLayout &DL = IC.getDataLayout();
1266 IC.Builder.CreateInBoundsGEP(ST, Addr, ArrayRef(Indices), AddrName);
1267 auto *Val = IC.Builder.CreateExtractValue(V, i, EltName);
1269 llvm::Instruction *NS = IC.Builder.CreateAlignedStore(Val, Ptr, EltAlign);
1280 V = IC.Builder.CreateExtractValue(V, 0);
1281 combineStoreToNewValue(IC, SI, V);
1289 if (NumElements > IC.MaxArraySizeForCombine)
1292 const DataLayout &DL = IC.getDataLayout();
1312 IC.Builder.CreateInBoundsGEP(AT, Addr, ArrayRef(Indices), AddrName);
1313 auto *Val = IC.Builder.CreateExtractValue(V, i, EltName);
1315 Instruction *NS = IC.Builder.CreateAlignedStore(Val, Ptr, EltAlign);