Lines Matching refs:Load
212 static AvailableValue getLoad(LoadInst *Load, unsigned Offset = 0) { in getLoad()
214 Res.Val = Load; in getLoad()
264 Value *MaterializeAdjustedValue(LoadInst *Load, Instruction *InsertPt,
299 Value *MaterializeAdjustedValue(LoadInst *Load, GVNPass &gvn) const { in MaterializeAdjustedValue()
300 return AV.MaterializeAdjustedValue(Load, BB->getTerminator(), gvn); in MaterializeAdjustedValue()
911 ConstructSSAForLoadSet(LoadInst *Load, in ConstructSSAForLoadSet() argument
918 Load->getParent())) { in ConstructSSAForLoadSet()
921 return ValuesPerBlock[0].MaterializeAdjustedValue(Load, gvn); in ConstructSSAForLoadSet()
927 SSAUpdate.Initialize(Load->getType(), Load->getName()); in ConstructSSAForLoadSet()
942 if (BB == Load->getParent() && in ConstructSSAForLoadSet()
943 ((AV.AV.isSimpleValue() && AV.AV.getSimpleValue() == Load) || in ConstructSSAForLoadSet()
944 (AV.AV.isCoercedLoadValue() && AV.AV.getCoercedLoadValue() == Load))) in ConstructSSAForLoadSet()
947 SSAUpdate.AddAvailableValue(BB, AV.MaterializeAdjustedValue(Load, gvn)); in ConstructSSAForLoadSet()
951 return SSAUpdate.GetValueInMiddleOfBlock(Load->getParent()); in ConstructSSAForLoadSet()
965 Value *AvailableValue::MaterializeAdjustedValue(LoadInst *Load, in MaterializeAdjustedValue() argument
969 Type *LoadTy = Load->getType(); in MaterializeAdjustedValue()
970 const DataLayout &DL = Load->getModule()->getDataLayout(); in MaterializeAdjustedValue()
1042 static void reportMayClobberedLoad(LoadInst *Load, MemDepResult DepInfo, in reportMayClobberedLoad() argument
1049 OptimizationRemarkMissed R(DEBUG_TYPE, "LoadClobbered", Load); in reportMayClobberedLoad()
1050 R << "load of type " << NV("Type", Load->getType()) << " not eliminated" in reportMayClobberedLoad()
1053 for (auto *U : Load->getPointerOperand()->users()) { in reportMayClobberedLoad()
1054 if (U != Load && (isa<LoadInst>(U) || isa<StoreInst>(U)) && in reportMayClobberedLoad()
1055 cast<Instruction>(U)->getFunction() == Load->getFunction() && in reportMayClobberedLoad()
1056 DT->dominates(cast<Instruction>(U), Load)) { in reportMayClobberedLoad()
1072 for (auto *U : Load->getPointerOperand()->users()) { in reportMayClobberedLoad()
1073 if (U != Load && (isa<LoadInst>(U) || isa<StoreInst>(U)) && in reportMayClobberedLoad()
1074 cast<Instruction>(U)->getFunction() == Load->getFunction() && in reportMayClobberedLoad()
1075 isPotentiallyReachable(cast<Instruction>(U), Load, nullptr, DT)) { in reportMayClobberedLoad()
1078 Load, DT)) { in reportMayClobberedLoad()
1081 cast<Instruction>(OtherAccess), Load, DT)) { in reportMayClobberedLoad()
1137 bool GVNPass::AnalyzeLoadAvailability(LoadInst *Load, MemDepResult DepInfo, in AnalyzeLoadAvailability() argument
1142 Load->getParent(), Load->getIterator(), Address, Load->getType(), in AnalyzeLoadAvailability()
1152 assert(Load->isUnordered() && "rules below are incorrect for ordered access"); in AnalyzeLoadAvailability()
1154 const DataLayout &DL = Load->getModule()->getDataLayout(); in AnalyzeLoadAvailability()
1163 if (Address && Load->isAtomic() <= DepSI->isAtomic()) { in AnalyzeLoadAvailability()
1165 analyzeLoadFromClobberingStore(Load->getType(), Address, DepSI, DL); in AnalyzeLoadAvailability()
1181 if (DepLoad != Load && Address && in AnalyzeLoadAvailability()
1182 Load->isAtomic() <= DepLoad->isAtomic()) { in AnalyzeLoadAvailability()
1183 Type *LoadType = Load->getType(); in AnalyzeLoadAvailability()
1206 if (Address && !Load->isAtomic()) { in AnalyzeLoadAvailability()
1207 int Offset = analyzeLoadFromClobberingMemInst(Load->getType(), Address, in AnalyzeLoadAvailability()
1219 dbgs() << "GVN: load "; Load->printAsOperand(dbgs()); in AnalyzeLoadAvailability()
1222 reportMayClobberedLoad(Load, DepInfo, DT, ORE); in AnalyzeLoadAvailability()
1231 Res = AvailableValue::get(UndefValue::get(Load->getType())); in AnalyzeLoadAvailability()
1236 getInitialValueOfAllocation(DepInst, TLI, Load->getType())) { in AnalyzeLoadAvailability()
1245 if (!canCoerceMustAliasedValueToLoad(S->getValueOperand(), Load->getType(), in AnalyzeLoadAvailability()
1250 if (S->isAtomic() < Load->isAtomic()) in AnalyzeLoadAvailability()
1261 if (!canCoerceMustAliasedValueToLoad(LD, Load->getType(), DL)) in AnalyzeLoadAvailability()
1265 if (LD->isAtomic() < Load->isAtomic()) in AnalyzeLoadAvailability()
1275 dbgs() << "GVN: load "; Load->printAsOperand(dbgs()); in AnalyzeLoadAvailability()
1280 void GVNPass::AnalyzeLoadAvailability(LoadInst *Load, LoadDepVect &Deps, in AnalyzeLoadAvailability() argument
1306 DepBB, DepBB->end(), Address, Load->getType(), getDominatorTree(), in AnalyzeLoadAvailability()
1317 if (AnalyzeLoadAvailability(Load, DepInfo, Address, AV)) { in AnalyzeLoadAvailability()
1333 LoadInst *Load, AvailValInBlkVect &ValuesPerBlock, in eliminatePartiallyRedundantLoad() argument
1340 new LoadInst(Load->getType(), LoadPtr, Load->getName() + ".pre", in eliminatePartiallyRedundantLoad()
1341 Load->isVolatile(), Load->getAlign(), Load->getOrdering(), in eliminatePartiallyRedundantLoad()
1342 Load->getSyncScopeID(), UnavailableBlock->getTerminator()); in eliminatePartiallyRedundantLoad()
1343 NewLoad->setDebugLoc(Load->getDebugLoc()); in eliminatePartiallyRedundantLoad()
1349 auto *LoadAcc = MSSA->getMemoryAccess(Load); in eliminatePartiallyRedundantLoad()
1362 AAMDNodes Tags = Load->getAAMetadata(); in eliminatePartiallyRedundantLoad()
1366 if (auto *MD = Load->getMetadata(LLVMContext::MD_invariant_load)) in eliminatePartiallyRedundantLoad()
1368 if (auto *InvGroupMD = Load->getMetadata(LLVMContext::MD_invariant_group)) in eliminatePartiallyRedundantLoad()
1370 if (auto *RangeMD = Load->getMetadata(LLVMContext::MD_range)) in eliminatePartiallyRedundantLoad()
1372 if (auto *AccessMD = Load->getMetadata(LLVMContext::MD_access_group)) in eliminatePartiallyRedundantLoad()
1374 LI->getLoopFor(Load->getParent()) == LI->getLoopFor(UnavailableBlock)) in eliminatePartiallyRedundantLoad()
1391 Value *V = ConstructSSAForLoadSet(Load, ValuesPerBlock, *this); in eliminatePartiallyRedundantLoad()
1392 Load->replaceAllUsesWith(V); in eliminatePartiallyRedundantLoad()
1394 V->takeName(Load); in eliminatePartiallyRedundantLoad()
1396 I->setDebugLoc(Load->getDebugLoc()); in eliminatePartiallyRedundantLoad()
1399 markInstructionForDeletion(Load); in eliminatePartiallyRedundantLoad()
1401 return OptimizationRemark(DEBUG_TYPE, "LoadPRE", Load) in eliminatePartiallyRedundantLoad()
1406 bool GVNPass::PerformLoadPRE(LoadInst *Load, AvailValInBlkVect &ValuesPerBlock, in PerformLoadPRE() argument
1421 BasicBlock *LoadBB = Load->getParent(); in PerformLoadPRE()
1440 ICF->isDominatedByICFIFromSameBlock(Load); in PerformLoadPRE()
1481 << Pred->getName() << "': " << *Load << '\n'); in PerformLoadPRE()
1493 << Pred->getName() << "': " << *Load << '\n'); in PerformLoadPRE()
1500 << Pred->getName() << "': " << *Load << '\n'); in PerformLoadPRE()
1510 << Pred->getName() << "': " << *Load << '\n'); in PerformLoadPRE()
1537 if (!isSafeToSpeculativelyExecute(Load, LoadBB->getFirstNonPHI(), DT)) in PerformLoadPRE()
1540 if (!isSafeToSpeculativelyExecute(Load, PL.first->getTerminator(), DT)) in PerformLoadPRE()
1555 const DataLayout &DL = Load->getModule()->getDataLayout(); in PerformLoadPRE()
1568 Value *LoadPtr = Load->getPointerOperand(); in PerformLoadPRE()
1569 BasicBlock *Cur = Load->getParent(); in PerformLoadPRE()
1590 << *Load->getPointerOperand() << "\n"); in PerformLoadPRE()
1615 LLVM_DEBUG(dbgs() << "GVN REMOVING PRE LOAD: " << *Load << '\n'); in PerformLoadPRE()
1634 eliminatePartiallyRedundantLoad(Load, ValuesPerBlock, PredLoads); in PerformLoadPRE()
1639 bool GVNPass::performLoopLoadPRE(LoadInst *Load, in performLoopLoadPRE() argument
1645 const Loop *L = LI->getLoopFor(Load->getParent()); in performLoopLoadPRE()
1647 if (!L || L->getHeader() != Load->getParent()) in performLoopLoadPRE()
1655 Value *LoadPtr = Load->getPointerOperand(); in performLoopLoadPRE()
1663 if (ICF->isDominatedByICFIFromSameBlock(Load)) in performLoopLoadPRE()
1712 LLVM_DEBUG(dbgs() << "GVN REMOVING PRE LOOP LOAD: " << *Load << '\n'); in performLoopLoadPRE()
1713 eliminatePartiallyRedundantLoad(Load, ValuesPerBlock, AvailableLoads); in performLoopLoadPRE()
1718 static void reportLoadElim(LoadInst *Load, Value *AvailableValue, in reportLoadElim() argument
1723 return OptimizationRemark(DEBUG_TYPE, "LoadElim", Load) in reportLoadElim()
1724 << "load of type " << NV("Type", Load->getType()) << " eliminated" in reportLoadElim()
1732 bool GVNPass::processNonLocalLoad(LoadInst *Load) { in processNonLocalLoad() argument
1734 if (Load->getParent()->getParent()->hasFnAttribute( in processNonLocalLoad()
1736 Load->getParent()->getParent()->hasFnAttribute( in processNonLocalLoad()
1742 MD->getNonLocalPointerDependency(Load, Deps); in processNonLocalLoad()
1755 LLVM_DEBUG(dbgs() << "GVN: non-local load "; Load->printAsOperand(dbgs()); in processNonLocalLoad()
1763 dyn_cast<GetElementPtrInst>(Load->getOperand(0))) { in processNonLocalLoad()
1772 AnalyzeLoadAvailability(Load, Deps, ValuesPerBlock, UnavailableBlocks); in processNonLocalLoad()
1785 LLVM_DEBUG(dbgs() << "GVN REMOVING NONLOCAL LOAD: " << *Load << '\n'); in processNonLocalLoad()
1788 Value *V = ConstructSSAForLoadSet(Load, ValuesPerBlock, *this); in processNonLocalLoad()
1789 Load->replaceAllUsesWith(V); in processNonLocalLoad()
1792 V->takeName(Load); in processNonLocalLoad()
1797 if (Load->getDebugLoc() && Load->getParent() == I->getParent()) in processNonLocalLoad()
1798 I->setDebugLoc(Load->getDebugLoc()); in processNonLocalLoad()
1801 markInstructionForDeletion(Load); in processNonLocalLoad()
1803 reportLoadElim(Load, V, ORE); in processNonLocalLoad()
1810 if (!isLoadInLoopPREEnabled() && LI && LI->getLoopFor(Load->getParent())) in processNonLocalLoad()
1813 if (performLoopLoadPRE(Load, ValuesPerBlock, UnavailableBlocks) || in processNonLocalLoad()
1814 PerformLoadPRE(Load, ValuesPerBlock, UnavailableBlocks)) in processNonLocalLoad()
2471 if (LoadInst *Load = dyn_cast<LoadInst>(I)) { in processInstruction() local
2472 if (processLoad(Load)) in processInstruction()
2475 unsigned Num = VN.lookupOrAdd(Load); in processInstruction()
2476 addToLeaderTable(Num, Load, Load->getParent()); in processInstruction()