Lines Matching refs:IC
170 static Instruction *simplifyAllocaArraySize(InstCombiner &IC, AllocaInst &AI) { in simplifyAllocaArraySize() argument
178 Value *V = IC.Builder->getInt32(1); in simplifyAllocaArraySize()
186 AllocaInst *New = IC.Builder->CreateAlloca(NewTy, nullptr, AI.getName()); in simplifyAllocaArraySize()
199 Type *IdxTy = IC.getDataLayout().getIntPtrType(AI.getType()); in simplifyAllocaArraySize()
204 IC.InsertNewInstBefore(GEP, *It); in simplifyAllocaArraySize()
208 return IC.replaceInstUsesWith(AI, GEP); in simplifyAllocaArraySize()
212 return IC.replaceInstUsesWith(AI, Constant::getNullValue(AI.getType())); in simplifyAllocaArraySize()
216 Type *IntPtrTy = IC.getDataLayout().getIntPtrType(AI.getType()); in simplifyAllocaArraySize()
218 Value *V = IC.Builder->CreateIntCast(AI.getArraySize(), IntPtrTy, false); in simplifyAllocaArraySize()
320 static LoadInst *combineLoadToNewType(InstCombiner &IC, LoadInst &LI, Type *NewTy, in combineLoadToNewType() argument
327 LoadInst *NewLoad = IC.Builder->CreateAlignedLoad( in combineLoadToNewType()
328 IC.Builder->CreateBitCast(Ptr, NewTy->getPointerTo(AS)), in combineLoadToNewType()
394 static StoreInst *combineStoreToNewValue(InstCombiner &IC, StoreInst &SI, Value *V) { in combineStoreToNewValue() argument
400 StoreInst *NewStore = IC.Builder->CreateAlignedStore( in combineStoreToNewValue()
401 V, IC.Builder->CreateBitCast(Ptr, V->getType()->getPointerTo(AS)), in combineStoreToNewValue()
460 static Instruction *combineLoadToOperationType(InstCombiner &IC, LoadInst &LI) { in combineLoadToOperationType() argument
470 const DataLayout &DL = IC.getDataLayout(); in combineLoadToOperationType()
484 IC, LI, in combineLoadToOperationType()
489 IC.Builder->SetInsertPoint(SI); in combineLoadToOperationType()
490 combineStoreToNewValue(IC, *SI, NewLoad); in combineLoadToOperationType()
491 IC.eraseInstFromFunction(*SI); in combineLoadToOperationType()
506 LoadInst *NewLoad = combineLoadToNewType(IC, LI, CI->getDestTy()); in combineLoadToOperationType()
508 IC.eraseInstFromFunction(*CI); in combineLoadToOperationType()
518 static Instruction *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) { in unpackLoadToAggregate() argument
535 LoadInst *NewLoad = combineLoadToNewType(IC, LI, ST->getTypeAtIndex(0U), in unpackLoadToAggregate()
537 return IC.replaceInstUsesWith(LI, IC.Builder->CreateInsertValue( in unpackLoadToAggregate()
543 const DataLayout &DL = IC.getDataLayout(); in unpackLoadToAggregate()
562 auto *Ptr = IC.Builder->CreateInBoundsGEP(ST, Addr, makeArrayRef(Indices), in unpackLoadToAggregate()
565 auto *L = IC.Builder->CreateAlignedLoad(Ptr, EltAlign, Name + ".unpack"); in unpackLoadToAggregate()
566 V = IC.Builder->CreateInsertValue(V, L, i); in unpackLoadToAggregate()
570 return IC.replaceInstUsesWith(LI, V); in unpackLoadToAggregate()
577 LoadInst *NewLoad = combineLoadToNewType(IC, LI, ET, ".unpack"); in unpackLoadToAggregate()
578 return IC.replaceInstUsesWith(LI, IC.Builder->CreateInsertValue( in unpackLoadToAggregate()
582 const DataLayout &DL = IC.getDataLayout(); in unpackLoadToAggregate()
599 auto *Ptr = IC.Builder->CreateInBoundsGEP(AT, Addr, makeArrayRef(Indices), in unpackLoadToAggregate()
601 auto *L = IC.Builder->CreateAlignedLoad(Ptr, MinAlign(Align, Offset), in unpackLoadToAggregate()
603 V = IC.Builder->CreateInsertValue(V, L, i); in unpackLoadToAggregate()
608 return IC.replaceInstUsesWith(LI, V); in unpackLoadToAggregate()
700 static bool canReplaceGEPIdxWithZero(InstCombiner &IC, GetElementPtrInst *GEPI, in canReplaceGEPIdxWithZero() argument
734 const DataLayout &DL = IC.getDataLayout(); in canReplaceGEPIdxWithZero()
744 IC.ComputeSignBit(GEPI->getOperand(i), KnownNonNegative, in canReplaceGEPIdxWithZero()
772 static Instruction *replaceGEPIdxWithZero(InstCombiner &IC, Value *Ptr, in replaceGEPIdxWithZero() argument
776 if (canReplaceGEPIdxWithZero(IC, GEPI, &MemI, Idx)) { in replaceGEPIdxWithZero()
934 static Value *likeBitCastFromVector(InstCombiner &IC, Value *V) { in likeBitCastFromVector() argument
956 const auto &DL = IC.getDataLayout(); in likeBitCastFromVector()
995 static bool combineStoreToValueType(InstCombiner &IC, StoreInst &SI) { in combineStoreToValueType() argument
1006 combineStoreToNewValue(IC, SI, V); in combineStoreToValueType()
1010 if (Value *U = likeBitCastFromVector(IC, V)) { in combineStoreToValueType()
1011 combineStoreToNewValue(IC, SI, U); in combineStoreToValueType()
1020 static bool unpackStoreToAggregate(InstCombiner &IC, StoreInst &SI) { in unpackStoreToAggregate() argument
1036 V = IC.Builder->CreateExtractValue(V, 0); in unpackStoreToAggregate()
1037 combineStoreToNewValue(IC, SI, V); in unpackStoreToAggregate()
1043 const DataLayout &DL = IC.getDataLayout(); in unpackStoreToAggregate()
1065 auto *Ptr = IC.Builder->CreateInBoundsGEP(ST, Addr, makeArrayRef(Indices), in unpackStoreToAggregate()
1067 auto *Val = IC.Builder->CreateExtractValue(V, i, EltName); in unpackStoreToAggregate()
1069 IC.Builder->CreateAlignedStore(Val, Ptr, EltAlign); in unpackStoreToAggregate()
1079 V = IC.Builder->CreateExtractValue(V, 0); in unpackStoreToAggregate()
1080 combineStoreToNewValue(IC, SI, V); in unpackStoreToAggregate()
1084 const DataLayout &DL = IC.getDataLayout(); in unpackStoreToAggregate()
1105 auto *Ptr = IC.Builder->CreateInBoundsGEP(AT, Addr, makeArrayRef(Indices), in unpackStoreToAggregate()
1107 auto *Val = IC.Builder->CreateExtractValue(V, i, EltName); in unpackStoreToAggregate()
1109 IC.Builder->CreateAlignedStore(Val, Ptr, EltAlign); in unpackStoreToAggregate()