Lines Matching refs:LI
69 if (LoadInst *LI = dyn_cast<LoadInst>(I)) { in isOnlyCopiedFromConstantGlobal() local
71 if (!LI->isSimple()) return false; in isOnlyCopiedFromConstantGlobal()
320 static LoadInst *combineLoadToNewType(InstCombiner &IC, LoadInst &LI, Type *NewTy, in combineLoadToNewType() argument
322 Value *Ptr = LI.getPointerOperand(); in combineLoadToNewType()
323 unsigned AS = LI.getPointerAddressSpace(); in combineLoadToNewType()
325 LI.getAllMetadata(MD); in combineLoadToNewType()
329 LI.getAlignment(), LI.isVolatile(), LI.getName() + Suffix); in combineLoadToNewType()
330 NewLoad->setAtomic(LI.getOrdering(), LI.getSynchScope()); in combineLoadToNewType()
460 static Instruction *combineLoadToOperationType(InstCombiner &IC, LoadInst &LI) { in combineLoadToOperationType() argument
463 if (!LI.isUnordered()) in combineLoadToOperationType()
466 if (LI.use_empty()) in combineLoadToOperationType()
469 Type *Ty = LI.getType(); in combineLoadToOperationType()
479 if (std::all_of(LI.user_begin(), LI.user_end(), [&LI](User *U) { in combineLoadToOperationType()
481 return SI && SI->getPointerOperand() != &LI; in combineLoadToOperationType()
484 IC, LI, in combineLoadToOperationType()
485 Type::getIntNTy(LI.getContext(), DL.getTypeStoreSizeInBits(Ty))); in combineLoadToOperationType()
487 for (auto UI = LI.user_begin(), UE = LI.user_end(); UI != UE;) { in combineLoadToOperationType()
493 assert(LI.use_empty() && "Failed to remove all users of the load!"); in combineLoadToOperationType()
495 return &LI; in combineLoadToOperationType()
503 if (LI.hasOneUse()) in combineLoadToOperationType()
504 if (auto* CI = dyn_cast<CastInst>(LI.user_back())) { in combineLoadToOperationType()
506 LoadInst *NewLoad = combineLoadToNewType(IC, LI, CI->getDestTy()); in combineLoadToOperationType()
509 return &LI; in combineLoadToOperationType()
518 static Instruction *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) { in unpackLoadToAggregate() argument
521 if (!LI.isSimple()) in unpackLoadToAggregate()
524 Type *T = LI.getType(); in unpackLoadToAggregate()
528 StringRef Name = LI.getName(); in unpackLoadToAggregate()
529 assert(LI.getAlignment() && "Alignment must be set at this point"); in unpackLoadToAggregate()
535 LoadInst *NewLoad = combineLoadToNewType(IC, LI, ST->getTypeAtIndex(0U), in unpackLoadToAggregate()
537 return IC.replaceInstUsesWith(LI, IC.Builder->CreateInsertValue( in unpackLoadToAggregate()
548 auto Align = LI.getAlignment(); in unpackLoadToAggregate()
552 auto *Addr = LI.getPointerOperand(); 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()
584 auto Align = LI.getAlignment(); in unpackLoadToAggregate()
588 auto *Addr = LI.getPointerOperand(); in unpackLoadToAggregate()
608 return IC.replaceInstUsesWith(LI, V); in unpackLoadToAggregate()
789 Instruction *InstCombiner::visitLoadInst(LoadInst &LI) { in visitLoadInst() argument
790 Value *Op = LI.getOperand(0); in visitLoadInst()
793 if (Instruction *Res = combineLoadToOperationType(*this, LI)) in visitLoadInst()
798 Op, DL.getPrefTypeAlignment(LI.getType()), DL, &LI, AC, DT); in visitLoadInst()
799 unsigned LoadAlign = LI.getAlignment(); in visitLoadInst()
801 LoadAlign != 0 ? LoadAlign : DL.getABITypeAlignment(LI.getType()); in visitLoadInst()
804 LI.setAlignment(KnownAlign); in visitLoadInst()
806 LI.setAlignment(EffectiveLoadAlign); in visitLoadInst()
809 if (Instruction *NewGEPI = replaceGEPIdxWithZero(*this, Op, LI)) { in visitLoadInst()
811 return &LI; in visitLoadInst()
814 if (Instruction *Res = unpackLoadToAggregate(*this, LI)) in visitLoadInst()
820 BasicBlock::iterator BBI(LI); in visitLoadInst()
824 FindAvailableLoadedValue(&LI, LI.getParent(), BBI, in visitLoadInst()
835 combineMetadata(NLI, &LI, KnownIDs); in visitLoadInst()
839 LI, Builder->CreateBitOrPointerCast(AvailableVal, LI.getType(), in visitLoadInst()
840 LI.getName() + ".cast")); in visitLoadInst()
845 if (!LI.isUnordered()) return nullptr; in visitLoadInst()
856 new StoreInst(UndefValue::get(LI.getType()), in visitLoadInst()
857 Constant::getNullValue(Op->getType()), &LI); in visitLoadInst()
858 return replaceInstUsesWith(LI, UndefValue::get(LI.getType())); in visitLoadInst()
865 (isa<ConstantPointerNull>(Op) && LI.getPointerAddressSpace() == 0)) { in visitLoadInst()
869 new StoreInst(UndefValue::get(LI.getType()), in visitLoadInst()
870 Constant::getNullValue(Op->getType()), &LI); in visitLoadInst()
871 return replaceInstUsesWith(LI, UndefValue::get(LI.getType())); in visitLoadInst()
887 unsigned Align = LI.getAlignment(); in visitLoadInst()
894 assert(LI.isUnordered() && "implied by above"); in visitLoadInst()
896 V1->setAtomic(LI.getOrdering(), LI.getSynchScope()); in visitLoadInst()
898 V2->setAtomic(LI.getOrdering(), LI.getSynchScope()); in visitLoadInst()
904 LI.getPointerAddressSpace() == 0) { in visitLoadInst()
905 LI.setOperand(0, SI->getOperand(2)); in visitLoadInst()
906 return &LI; in visitLoadInst()
911 LI.getPointerAddressSpace() == 0) { in visitLoadInst()
912 LI.setOperand(0, SI->getOperand(1)); in visitLoadInst()
913 return &LI; in visitLoadInst()
1225 if (LoadInst *LI = dyn_cast<LoadInst>(BBI)) { in visitStoreInst() local
1226 if (LI == Val && equivalentAddressValues(LI->getOperand(0), Ptr)) { in visitStoreInst()