Lines Matching refs:IC
167 static Instruction *simplifyAllocaArraySize(InstCombinerImpl &IC, in simplifyAllocaArraySize() argument
176 return IC.replaceOperand(AI, 0, IC.Builder.getInt32(1)); in simplifyAllocaArraySize()
183 AllocaInst *New = IC.Builder.CreateAlloca(NewTy, AI.getAddressSpace(), in simplifyAllocaArraySize()
197 Type *IdxTy = IC.getDataLayout().getIntPtrType(AI.getType()); in simplifyAllocaArraySize()
202 IC.InsertNewInstBefore(GEP, *It); in simplifyAllocaArraySize()
206 return IC.replaceInstUsesWith(AI, GEP); in simplifyAllocaArraySize()
211 return IC.replaceInstUsesWith(AI, Constant::getNullValue(AI.getType())); in simplifyAllocaArraySize()
215 Type *IntPtrTy = IC.getDataLayout().getIntPtrType(AI.getType()); in simplifyAllocaArraySize()
217 Value *V = IC.Builder.CreateIntCast(AI.getArraySize(), IntPtrTy, false); in simplifyAllocaArraySize()
218 return IC.replaceOperand(AI, 0, V); in simplifyAllocaArraySize()
237 PointerReplacer(InstCombinerImpl &IC) : IC(IC) {} in PointerReplacer() argument
248 InstCombinerImpl ⁣ member in __anonf044969c0111::PointerReplacer
293 IC.InsertNewInstWith(NewI, *LT); in replace()
294 IC.replaceInstUsesWith(*LT, NewI); in replace()
303 IC.InsertNewInstWith(NewI, *GEP); in replace()
313 IC.InsertNewInstWith(NewI, *BC); in replace()
326 IC.Builder.SetInsertPoint(MemCpy); in replace()
327 auto *NewI = IC.Builder.CreateMemTransferInst( in replace()
335 IC.eraseInstFromFunction(*MemCpy); in replace()
483 static StoreInst *combineStoreToNewValue(InstCombinerImpl &IC, StoreInst &SI, in combineStoreToNewValue() argument
493 StoreInst *NewStore = IC.Builder.CreateAlignedStore( in combineStoreToNewValue()
494 V, IC.Builder.CreateBitCast(Ptr, V->getType()->getPointerTo(AS)), in combineStoreToNewValue()
577 static Instruction *combineLoadToOperationType(InstCombinerImpl &IC, in combineLoadToOperationType() argument
591 const DataLayout &DL = IC.getDataLayout(); in combineLoadToOperationType()
610 LoadInst *NewLoad = IC.combineLoadToNewType(LI, CI->getDestTy()); in combineLoadToOperationType()
612 IC.eraseInstFromFunction(*CI); in combineLoadToOperationType()
622 static Instruction *unpackLoadToAggregate(InstCombinerImpl &IC, LoadInst &LI) { in unpackLoadToAggregate() argument
638 LoadInst *NewLoad = IC.combineLoadToNewType(LI, ST->getTypeAtIndex(0U), in unpackLoadToAggregate()
641 return IC.replaceInstUsesWith(LI, IC.Builder.CreateInsertValue( in unpackLoadToAggregate()
647 const DataLayout &DL = IC.getDataLayout(); in unpackLoadToAggregate()
663 auto *Ptr = IC.Builder.CreateInBoundsGEP(ST, Addr, makeArrayRef(Indices), in unpackLoadToAggregate()
665 auto *L = IC.Builder.CreateAlignedLoad( in unpackLoadToAggregate()
670 V = IC.Builder.CreateInsertValue(V, L, i); in unpackLoadToAggregate()
674 return IC.replaceInstUsesWith(LI, V); in unpackLoadToAggregate()
681 LoadInst *NewLoad = IC.combineLoadToNewType(LI, ET, ".unpack"); in unpackLoadToAggregate()
683 return IC.replaceInstUsesWith(LI, IC.Builder.CreateInsertValue( in unpackLoadToAggregate()
691 if (NumElements > IC.MaxArraySizeForCombine) in unpackLoadToAggregate()
694 const DataLayout &DL = IC.getDataLayout(); in unpackLoadToAggregate()
709 auto *Ptr = IC.Builder.CreateInBoundsGEP(AT, Addr, makeArrayRef(Indices), in unpackLoadToAggregate()
711 auto *L = IC.Builder.CreateAlignedLoad(AT->getElementType(), Ptr, in unpackLoadToAggregate()
715 V = IC.Builder.CreateInsertValue(V, L, i); in unpackLoadToAggregate()
720 return IC.replaceInstUsesWith(LI, V); in unpackLoadToAggregate()
811 static bool canReplaceGEPIdxWithZero(InstCombinerImpl &IC, in canReplaceGEPIdxWithZero() argument
851 const DataLayout &DL = IC.getDataLayout(); in canReplaceGEPIdxWithZero()
860 KnownBits Known = IC.computeKnownBits(GEPI->getOperand(i), 0, MemI); in canReplaceGEPIdxWithZero()
887 static Instruction *replaceGEPIdxWithZero(InstCombinerImpl &IC, Value *Ptr, in replaceGEPIdxWithZero() argument
891 if (canReplaceGEPIdxWithZero(IC, GEPI, &MemI, Idx)) { in replaceGEPIdxWithZero()
1044 static Value *likeBitCastFromVector(InstCombinerImpl &IC, Value *V) { in likeBitCastFromVector() argument
1066 const auto &DL = IC.getDataLayout(); in likeBitCastFromVector()
1105 static bool combineStoreToValueType(InstCombinerImpl &IC, StoreInst &SI) { in combineStoreToValueType() argument
1127 combineStoreToNewValue(IC, SI, V); in combineStoreToValueType()
1132 if (Value *U = likeBitCastFromVector(IC, V)) in combineStoreToValueType()
1134 combineStoreToNewValue(IC, SI, U); in combineStoreToValueType()
1143 static bool unpackStoreToAggregate(InstCombinerImpl &IC, StoreInst &SI) { in unpackStoreToAggregate() argument
1159 V = IC.Builder.CreateExtractValue(V, 0); in unpackStoreToAggregate()
1160 combineStoreToNewValue(IC, SI, V); in unpackStoreToAggregate()
1166 const DataLayout &DL = IC.getDataLayout(); in unpackStoreToAggregate()
1186 auto *Ptr = IC.Builder.CreateInBoundsGEP(ST, Addr, makeArrayRef(Indices), in unpackStoreToAggregate()
1188 auto *Val = IC.Builder.CreateExtractValue(V, i, EltName); in unpackStoreToAggregate()
1190 llvm::Instruction *NS = IC.Builder.CreateAlignedStore(Val, Ptr, EltAlign); in unpackStoreToAggregate()
1201 V = IC.Builder.CreateExtractValue(V, 0); in unpackStoreToAggregate()
1202 combineStoreToNewValue(IC, SI, V); in unpackStoreToAggregate()
1210 if (NumElements > IC.MaxArraySizeForCombine) in unpackStoreToAggregate()
1213 const DataLayout &DL = IC.getDataLayout(); in unpackStoreToAggregate()
1232 auto *Ptr = IC.Builder.CreateInBoundsGEP(AT, Addr, makeArrayRef(Indices), in unpackStoreToAggregate()
1234 auto *Val = IC.Builder.CreateExtractValue(V, i, EltName); in unpackStoreToAggregate()
1236 Instruction *NS = IC.Builder.CreateAlignedStore(Val, Ptr, EltAlign); in unpackStoreToAggregate()
1279 static bool removeBitcastsFromLoadStoreOnMinMax(InstCombinerImpl &IC, in removeBitcastsFromLoadStoreOnMinMax() argument
1301 const auto &DL = IC.getDataLayout(); in removeBitcastsFromLoadStoreOnMinMax()
1315 IC.Builder.SetInsertPoint(LI); in removeBitcastsFromLoadStoreOnMinMax()
1316 LoadInst *NewLI = IC.combineLoadToNewType(*LI, CmpLoadTy); in removeBitcastsFromLoadStoreOnMinMax()
1320 IC.Builder.SetInsertPoint(USI); in removeBitcastsFromLoadStoreOnMinMax()
1321 combineStoreToNewValue(IC, *USI, NewLI); in removeBitcastsFromLoadStoreOnMinMax()
1323 IC.replaceInstUsesWith(*LI, PoisonValue::get(LI->getType())); in removeBitcastsFromLoadStoreOnMinMax()
1324 IC.eraseInstFromFunction(*LI); in removeBitcastsFromLoadStoreOnMinMax()