Lines Matching refs:Load
210 static AvailableValue getLoad(LoadInst *Load, unsigned Offset = 0) { in getLoad()
212 Res.Val.setPointer(Load); in getLoad()
248 Value *MaterializeAdjustedValue(LoadInst *Load, Instruction *InsertPt,
279 Value *MaterializeAdjustedValue(LoadInst *Load, GVN &gvn) const { in MaterializeAdjustedValue()
280 return AV.MaterializeAdjustedValue(Load, BB->getTerminator(), gvn); in MaterializeAdjustedValue()
836 ConstructSSAForLoadSet(LoadInst *Load, in ConstructSSAForLoadSet() argument
843 Load->getParent())) { in ConstructSSAForLoadSet()
846 return ValuesPerBlock[0].MaterializeAdjustedValue(Load, gvn); in ConstructSSAForLoadSet()
852 SSAUpdate.Initialize(Load->getType(), Load->getName()); in ConstructSSAForLoadSet()
867 if (BB == Load->getParent() && in ConstructSSAForLoadSet()
868 ((AV.AV.isSimpleValue() && AV.AV.getSimpleValue() == Load) || in ConstructSSAForLoadSet()
869 (AV.AV.isCoercedLoadValue() && AV.AV.getCoercedLoadValue() == Load))) in ConstructSSAForLoadSet()
872 SSAUpdate.AddAvailableValue(BB, AV.MaterializeAdjustedValue(Load, gvn)); in ConstructSSAForLoadSet()
876 return SSAUpdate.GetValueInMiddleOfBlock(Load->getParent()); in ConstructSSAForLoadSet()
879 Value *AvailableValue::MaterializeAdjustedValue(LoadInst *Load, in MaterializeAdjustedValue() argument
883 Type *LoadTy = Load->getType(); in MaterializeAdjustedValue()
884 const DataLayout &DL = Load->getModule()->getDataLayout(); in MaterializeAdjustedValue()
945 static void reportMayClobberedLoad(LoadInst *Load, MemDepResult DepInfo, in reportMayClobberedLoad() argument
952 OptimizationRemarkMissed R(DEBUG_TYPE, "LoadClobbered", Load); in reportMayClobberedLoad()
953 R << "load of type " << NV("Type", Load->getType()) << " not eliminated" in reportMayClobberedLoad()
956 for (auto *U : Load->getPointerOperand()->users()) { in reportMayClobberedLoad()
957 if (U != Load && (isa<LoadInst>(U) || isa<StoreInst>(U)) && in reportMayClobberedLoad()
958 cast<Instruction>(U)->getFunction() == Load->getFunction() && in reportMayClobberedLoad()
959 DT->dominates(cast<Instruction>(U), Load)) { in reportMayClobberedLoad()
975 for (auto *U : Load->getPointerOperand()->users()) { in reportMayClobberedLoad()
976 if (U != Load && (isa<LoadInst>(U) || isa<StoreInst>(U)) && in reportMayClobberedLoad()
977 cast<Instruction>(U)->getFunction() == Load->getFunction() && in reportMayClobberedLoad()
978 isPotentiallyReachable(cast<Instruction>(U), Load, nullptr, DT)) { in reportMayClobberedLoad()
981 Load, DT)) { in reportMayClobberedLoad()
984 cast<Instruction>(OtherAccess), Load, DT)) { in reportMayClobberedLoad()
1005 bool GVN::AnalyzeLoadAvailability(LoadInst *Load, MemDepResult DepInfo, in AnalyzeLoadAvailability() argument
1009 assert(Load->isUnordered() && "rules below are incorrect for ordered access"); in AnalyzeLoadAvailability()
1011 const DataLayout &DL = Load->getModule()->getDataLayout(); in AnalyzeLoadAvailability()
1020 if (Address && Load->isAtomic() <= DepSI->isAtomic()) { in AnalyzeLoadAvailability()
1022 analyzeLoadFromClobberingStore(Load->getType(), Address, DepSI, DL); in AnalyzeLoadAvailability()
1038 if (DepLoad != Load && Address && in AnalyzeLoadAvailability()
1039 Load->isAtomic() <= DepLoad->isAtomic()) { in AnalyzeLoadAvailability()
1040 Type *LoadType = Load->getType(); in AnalyzeLoadAvailability()
1065 if (Address && !Load->isAtomic()) { in AnalyzeLoadAvailability()
1066 int Offset = analyzeLoadFromClobberingMemInst(Load->getType(), Address, in AnalyzeLoadAvailability()
1077 dbgs() << "GVN: load "; Load->printAsOperand(dbgs()); in AnalyzeLoadAvailability()
1080 reportMayClobberedLoad(Load, DepInfo, DT, ORE); in AnalyzeLoadAvailability()
1091 Res = AvailableValue::get(UndefValue::get(Load->getType())); in AnalyzeLoadAvailability()
1097 Res = AvailableValue::get(Constant::getNullValue(Load->getType())); in AnalyzeLoadAvailability()
1105 if (!canCoerceMustAliasedValueToLoad(S->getValueOperand(), Load->getType(), in AnalyzeLoadAvailability()
1110 if (S->isAtomic() < Load->isAtomic()) in AnalyzeLoadAvailability()
1121 if (!canCoerceMustAliasedValueToLoad(LD, Load->getType(), DL)) in AnalyzeLoadAvailability()
1125 if (LD->isAtomic() < Load->isAtomic()) in AnalyzeLoadAvailability()
1135 dbgs() << "GVN: load "; Load->printAsOperand(dbgs()); in AnalyzeLoadAvailability()
1140 void GVN::AnalyzeLoadAvailability(LoadInst *Load, LoadDepVect &Deps, in AnalyzeLoadAvailability() argument
1170 if (AnalyzeLoadAvailability(Load, DepInfo, Address, AV)) { in AnalyzeLoadAvailability()
1186 LoadInst *Load, AvailValInBlkVect &ValuesPerBlock, in eliminatePartiallyRedundantLoad() argument
1193 new LoadInst(Load->getType(), LoadPtr, Load->getName() + ".pre", in eliminatePartiallyRedundantLoad()
1194 Load->isVolatile(), Load->getAlign(), Load->getOrdering(), in eliminatePartiallyRedundantLoad()
1195 Load->getSyncScopeID(), UnavailableBlock->getTerminator()); in eliminatePartiallyRedundantLoad()
1196 NewLoad->setDebugLoc(Load->getDebugLoc()); in eliminatePartiallyRedundantLoad()
1202 auto *LoadAcc = MSSA->getMemoryAccess(Load); in eliminatePartiallyRedundantLoad()
1216 Load->getAAMetadata(Tags); in eliminatePartiallyRedundantLoad()
1220 if (auto *MD = Load->getMetadata(LLVMContext::MD_invariant_load)) in eliminatePartiallyRedundantLoad()
1222 if (auto *InvGroupMD = Load->getMetadata(LLVMContext::MD_invariant_group)) in eliminatePartiallyRedundantLoad()
1224 if (auto *RangeMD = Load->getMetadata(LLVMContext::MD_range)) in eliminatePartiallyRedundantLoad()
1226 if (auto *AccessMD = Load->getMetadata(LLVMContext::MD_access_group)) in eliminatePartiallyRedundantLoad()
1228 LI->getLoopFor(Load->getParent()) == LI->getLoopFor(UnavailableBlock)) in eliminatePartiallyRedundantLoad()
1245 Value *V = ConstructSSAForLoadSet(Load, ValuesPerBlock, *this); in eliminatePartiallyRedundantLoad()
1246 Load->replaceAllUsesWith(V); in eliminatePartiallyRedundantLoad()
1248 V->takeName(Load); in eliminatePartiallyRedundantLoad()
1250 I->setDebugLoc(Load->getDebugLoc()); in eliminatePartiallyRedundantLoad()
1253 markInstructionForDeletion(Load); in eliminatePartiallyRedundantLoad()
1255 return OptimizationRemark(DEBUG_TYPE, "LoadPRE", Load) in eliminatePartiallyRedundantLoad()
1260 bool GVN::PerformLoadPRE(LoadInst *Load, AvailValInBlkVect &ValuesPerBlock, in PerformLoadPRE() argument
1275 BasicBlock *LoadBB = Load->getParent(); in PerformLoadPRE()
1294 ICF->isDominatedByICFIFromSameBlock(Load); in PerformLoadPRE()
1335 << Pred->getName() << "': " << *Load << '\n'); in PerformLoadPRE()
1347 << Pred->getName() << "': " << *Load << '\n'); in PerformLoadPRE()
1355 << Pred->getName() << "': " << *Load << '\n'); in PerformLoadPRE()
1362 << Pred->getName() << "': " << *Load << '\n'); in PerformLoadPRE()
1372 << Pred->getName() << "': " << *Load << '\n'); in PerformLoadPRE()
1399 if (!isSafeToSpeculativelyExecute(Load, LoadBB->getFirstNonPHI(), DT)) in PerformLoadPRE()
1402 if (!isSafeToSpeculativelyExecute(Load, PL.first->getTerminator(), DT)) in PerformLoadPRE()
1417 const DataLayout &DL = Load->getModule()->getDataLayout(); in PerformLoadPRE()
1430 Value *LoadPtr = Load->getPointerOperand(); in PerformLoadPRE()
1431 BasicBlock *Cur = Load->getParent(); in PerformLoadPRE()
1452 << *Load->getPointerOperand() << "\n"); in PerformLoadPRE()
1477 LLVM_DEBUG(dbgs() << "GVN REMOVING PRE LOAD: " << *Load << '\n'); in PerformLoadPRE()
1496 eliminatePartiallyRedundantLoad(Load, ValuesPerBlock, PredLoads); in PerformLoadPRE()
1501 bool GVN::performLoopLoadPRE(LoadInst *Load, AvailValInBlkVect &ValuesPerBlock, in performLoopLoadPRE() argument
1506 const Loop *L = LI->getLoopFor(Load->getParent()); in performLoopLoadPRE()
1508 if (!L || L->getHeader() != Load->getParent()) in performLoopLoadPRE()
1516 Value *LoadPtr = Load->getPointerOperand(); in performLoopLoadPRE()
1524 if (ICF->isDominatedByICFIFromSameBlock(Load)) in performLoopLoadPRE()
1573 LLVM_DEBUG(dbgs() << "GVN REMOVING PRE LOOP LOAD: " << *Load << '\n'); in performLoopLoadPRE()
1574 eliminatePartiallyRedundantLoad(Load, ValuesPerBlock, AvailableLoads); in performLoopLoadPRE()
1579 static void reportLoadElim(LoadInst *Load, Value *AvailableValue, in reportLoadElim() argument
1584 return OptimizationRemark(DEBUG_TYPE, "LoadElim", Load) in reportLoadElim()
1585 << "load of type " << NV("Type", Load->getType()) << " eliminated" in reportLoadElim()
1593 bool GVN::processNonLocalLoad(LoadInst *Load) { in processNonLocalLoad() argument
1595 if (Load->getParent()->getParent()->hasFnAttribute( in processNonLocalLoad()
1597 Load->getParent()->getParent()->hasFnAttribute( in processNonLocalLoad()
1603 MD->getNonLocalPointerDependency(Load, Deps); in processNonLocalLoad()
1616 LLVM_DEBUG(dbgs() << "GVN: non-local load "; Load->printAsOperand(dbgs()); in processNonLocalLoad()
1624 dyn_cast<GetElementPtrInst>(Load->getOperand(0))) { in processNonLocalLoad()
1635 AnalyzeLoadAvailability(Load, Deps, ValuesPerBlock, UnavailableBlocks); in processNonLocalLoad()
1648 LLVM_DEBUG(dbgs() << "GVN REMOVING NONLOCAL LOAD: " << *Load << '\n'); in processNonLocalLoad()
1651 Value *V = ConstructSSAForLoadSet(Load, ValuesPerBlock, *this); in processNonLocalLoad()
1652 Load->replaceAllUsesWith(V); in processNonLocalLoad()
1655 V->takeName(Load); in processNonLocalLoad()
1660 if (Load->getDebugLoc() && Load->getParent() == I->getParent()) in processNonLocalLoad()
1661 I->setDebugLoc(Load->getDebugLoc()); in processNonLocalLoad()
1664 markInstructionForDeletion(Load); in processNonLocalLoad()
1666 reportLoadElim(Load, V, ORE); in processNonLocalLoad()
1673 if (!isLoadInLoopPREEnabled() && LI && LI->getLoopFor(Load->getParent())) in processNonLocalLoad()
1676 return Changed || PerformLoadPRE(Load, ValuesPerBlock, UnavailableBlocks) || in processNonLocalLoad()
1677 performLoopLoadPRE(Load, ValuesPerBlock, UnavailableBlocks); in processNonLocalLoad()
2328 if (LoadInst *Load = dyn_cast<LoadInst>(I)) { in processInstruction() local
2329 if (processLoad(Load)) in processInstruction()
2332 unsigned Num = VN.lookupOrAdd(Load); in processInstruction()
2333 addToLeaderTable(Num, Load, Load->getParent()); in processInstruction()