Lines Matching refs:IC

197 static Instruction *simplifyAllocaArraySize(InstCombinerImpl &IC,  in simplifyAllocaArraySize()  argument
206 return IC.replaceOperand(AI, 0, IC.Builder.getInt32(1)); in simplifyAllocaArraySize()
213 AllocaInst *New = IC.Builder.CreateAlloca(NewTy, AI.getAddressSpace(), in simplifyAllocaArraySize()
219 return IC.replaceInstUsesWith(AI, New); in simplifyAllocaArraySize()
224 return IC.replaceInstUsesWith(AI, Constant::getNullValue(AI.getType())); in simplifyAllocaArraySize()
229 Type *PtrIdxTy = IC.getDataLayout().getIndexType(AI.getType()); in simplifyAllocaArraySize()
231 Value *V = IC.Builder.CreateIntCast(AI.getArraySize(), PtrIdxTy, false); in simplifyAllocaArraySize()
232 return IC.replaceOperand(AI, 0, V); in simplifyAllocaArraySize()
251 PointerReplacer(InstCombinerImpl &IC, Instruction &Root, unsigned SrcAS) in PointerReplacer() argument
252 : IC(IC), Root(Root), FromAS(SrcAS) {} in PointerReplacer()
271 return (FromAS == ToAS) || IC.isValidAddrSpaceCast(FromAS, ToAS); in isEqualOrValidAddrSpaceCast()
277 InstCombinerImpl ⁣ member in __anon6b54b2e20111::PointerReplacer
371 IC.InsertNewInstWith(NewI, LT->getIterator()); in replace()
372 IC.replaceInstUsesWith(*LT, NewI); in replace()
389 IC.InsertNewInstWith(NewI, GEP->getIterator()); in replace()
398 IC.InsertNewInstWith(NewI, BC->getIterator()); in replace()
405 IC.InsertNewInstWith(NewSI, SI->getIterator()); in replace()
418 IC.Builder.SetInsertPoint(MemCpy); in replace()
419 auto *NewI = IC.Builder.CreateMemTransferInst( in replace()
427 IC.eraseInstFromFunction(*MemCpy); in replace()
440 IC.InsertNewInstWith(NewI, ASC->getIterator()); in replace()
443 IC.replaceInstUsesWith(*ASC, NewV); in replace()
444 IC.eraseInstFromFunction(*ASC); in replace()
579 static StoreInst *combineStoreToNewValue(InstCombinerImpl &IC, StoreInst &SI, in combineStoreToNewValue() argument
589 IC.Builder.CreateAlignedStore(V, Ptr, SI.getAlign(), SI.isVolatile()); in combineStoreToNewValue()
649 static Instruction *combineLoadToOperationType(InstCombinerImpl &IC, in combineLoadToOperationType() argument
678 if (CastUser->isNoopCast(IC.getDataLayout()) && in combineLoadToOperationType()
681 LoadInst *NewLoad = IC.combineLoadToNewType(Load, DestTy); in combineLoadToOperationType()
683 IC.eraseInstFromFunction(*CastUser); in combineLoadToOperationType()
694 static Instruction *unpackLoadToAggregate(InstCombinerImpl &IC, LoadInst &LI) { in unpackLoadToAggregate() argument
710 LoadInst *NewLoad = IC.combineLoadToNewType(LI, ST->getTypeAtIndex(0U), in unpackLoadToAggregate()
713 return IC.replaceInstUsesWith(LI, IC.Builder.CreateInsertValue( in unpackLoadToAggregate()
719 const DataLayout &DL = IC.getDataLayout(); in unpackLoadToAggregate()
740 auto *Ptr = IC.Builder.CreateInBoundsGEP(ST, Addr, ArrayRef(Indices), in unpackLoadToAggregate()
742 auto *L = IC.Builder.CreateAlignedLoad( in unpackLoadToAggregate()
747 V = IC.Builder.CreateInsertValue(V, L, i); in unpackLoadToAggregate()
751 return IC.replaceInstUsesWith(LI, V); in unpackLoadToAggregate()
758 LoadInst *NewLoad = IC.combineLoadToNewType(LI, ET, ".unpack"); in unpackLoadToAggregate()
760 return IC.replaceInstUsesWith(LI, IC.Builder.CreateInsertValue( in unpackLoadToAggregate()
768 if (NumElements > IC.MaxArraySizeForCombine) in unpackLoadToAggregate()
771 const DataLayout &DL = IC.getDataLayout(); in unpackLoadToAggregate()
786 auto *Ptr = IC.Builder.CreateInBoundsGEP(AT, Addr, ArrayRef(Indices), in unpackLoadToAggregate()
789 auto *L = IC.Builder.CreateAlignedLoad(AT->getElementType(), Ptr, in unpackLoadToAggregate()
792 V = IC.Builder.CreateInsertValue(V, L, i); in unpackLoadToAggregate()
797 return IC.replaceInstUsesWith(LI, V); in unpackLoadToAggregate()
891 static bool canReplaceGEPIdxWithZero(InstCombinerImpl &IC, in canReplaceGEPIdxWithZero() argument
931 const DataLayout &DL = IC.getDataLayout(); in canReplaceGEPIdxWithZero()
940 KnownBits Known = IC.computeKnownBits(GEPI->getOperand(i), 0, MemI); in canReplaceGEPIdxWithZero()
966 static Instruction *replaceGEPIdxWithZero(InstCombinerImpl &IC, Value *Ptr, in replaceGEPIdxWithZero() argument
970 if (canReplaceGEPIdxWithZero(IC, GEPI, &MemI, Idx)) { in replaceGEPIdxWithZero()
974 IC.InsertNewInstBefore(NewGEPI, GEPI->getIterator()); in replaceGEPIdxWithZero()
1119 static Value *likeBitCastFromVector(InstCombinerImpl &IC, Value *V) { in likeBitCastFromVector() argument
1141 const auto &DL = IC.getDataLayout(); in likeBitCastFromVector()
1180 static bool combineStoreToValueType(InstCombinerImpl &IC, StoreInst &SI) { in combineStoreToValueType() argument
1202 combineStoreToNewValue(IC, SI, V); in combineStoreToValueType()
1207 if (Value *U = likeBitCastFromVector(IC, V)) in combineStoreToValueType()
1209 combineStoreToNewValue(IC, SI, U); in combineStoreToValueType()
1218 static bool unpackStoreToAggregate(InstCombinerImpl &IC, StoreInst &SI) { in unpackStoreToAggregate() argument
1234 V = IC.Builder.CreateExtractValue(V, 0); in unpackStoreToAggregate()
1235 combineStoreToNewValue(IC, SI, V); in unpackStoreToAggregate()
1241 const DataLayout &DL = IC.getDataLayout(); in unpackStoreToAggregate()
1267 IC.Builder.CreateInBoundsGEP(ST, Addr, ArrayRef(Indices), AddrName); in unpackStoreToAggregate()
1268 auto *Val = IC.Builder.CreateExtractValue(V, i, EltName); in unpackStoreToAggregate()
1270 llvm::Instruction *NS = IC.Builder.CreateAlignedStore(Val, Ptr, EltAlign); in unpackStoreToAggregate()
1281 V = IC.Builder.CreateExtractValue(V, 0); in unpackStoreToAggregate()
1282 combineStoreToNewValue(IC, SI, V); in unpackStoreToAggregate()
1290 if (NumElements > IC.MaxArraySizeForCombine) in unpackStoreToAggregate()
1293 const DataLayout &DL = IC.getDataLayout(); in unpackStoreToAggregate()
1313 IC.Builder.CreateInBoundsGEP(AT, Addr, ArrayRef(Indices), AddrName); in unpackStoreToAggregate()
1314 auto *Val = IC.Builder.CreateExtractValue(V, i, EltName); in unpackStoreToAggregate()
1316 Instruction *NS = IC.Builder.CreateAlignedStore(Val, Ptr, EltAlign); in unpackStoreToAggregate()