Lines Matching refs:Load
228 static AvailableValue getLoad(LoadInst *Load, unsigned Offset = 0) { in getLoad()
230 Res.Val = Load; in getLoad()
282 Value *MaterializeAdjustedValue(LoadInst *Load, Instruction *InsertPt,
318 Value *MaterializeAdjustedValue(LoadInst *Load, GVNPass &gvn) const { in MaterializeAdjustedValue()
319 return AV.MaterializeAdjustedValue(Load, BB->getTerminator(), gvn); in MaterializeAdjustedValue()
1027 ConstructSSAForLoadSet(LoadInst *Load, in ConstructSSAForLoadSet() argument
1034 Load->getParent())) { in ConstructSSAForLoadSet()
1037 return ValuesPerBlock[0].MaterializeAdjustedValue(Load, gvn); in ConstructSSAForLoadSet()
1043 SSAUpdate.Initialize(Load->getType(), Load->getName()); in ConstructSSAForLoadSet()
1058 if (BB == Load->getParent() && in ConstructSSAForLoadSet()
1059 ((AV.AV.isSimpleValue() && AV.AV.getSimpleValue() == Load) || in ConstructSSAForLoadSet()
1060 (AV.AV.isCoercedLoadValue() && AV.AV.getCoercedLoadValue() == Load))) in ConstructSSAForLoadSet()
1063 SSAUpdate.AddAvailableValue(BB, AV.MaterializeAdjustedValue(Load, gvn)); in ConstructSSAForLoadSet()
1067 return SSAUpdate.GetValueInMiddleOfBlock(Load->getParent()); in ConstructSSAForLoadSet()
1070 Value *AvailableValue::MaterializeAdjustedValue(LoadInst *Load, in MaterializeAdjustedValue() argument
1074 Type *LoadTy = Load->getType(); in MaterializeAdjustedValue()
1075 const DataLayout &DL = Load->getDataLayout(); in MaterializeAdjustedValue()
1090 combineMetadataForCSE(CoercedLoad, Load, false); in MaterializeAdjustedValue()
1151 static void reportMayClobberedLoad(LoadInst *Load, MemDepResult DepInfo, in reportMayClobberedLoad() argument
1158 OptimizationRemarkMissed R(DEBUG_TYPE, "LoadClobbered", Load); in reportMayClobberedLoad()
1159 R << "load of type " << NV("Type", Load->getType()) << " not eliminated" in reportMayClobberedLoad()
1162 for (auto *U : Load->getPointerOperand()->users()) { in reportMayClobberedLoad()
1163 if (U != Load && (isa<LoadInst>(U) || isa<StoreInst>(U))) { in reportMayClobberedLoad()
1165 if (I->getFunction() == Load->getFunction() && DT->dominates(I, Load)) { in reportMayClobberedLoad()
1181 for (auto *U : Load->getPointerOperand()->users()) { in reportMayClobberedLoad()
1182 if (U != Load && (isa<LoadInst>(U) || isa<StoreInst>(U))) { in reportMayClobberedLoad()
1184 if (I->getFunction() == Load->getFunction() && in reportMayClobberedLoad()
1185 isPotentiallyReachable(I, Load, nullptr, DT)) { in reportMayClobberedLoad()
1187 if (liesBetween(OtherAccess, I, Load, DT)) { in reportMayClobberedLoad()
1189 } else if (!liesBetween(I, OtherAccess, Load, DT)) { in reportMayClobberedLoad()
1234 GVNPass::AnalyzeLoadAvailability(LoadInst *Load, MemDepResult DepInfo, in AnalyzeLoadAvailability() argument
1236 assert(Load->isUnordered() && "rules below are incorrect for ordered access"); in AnalyzeLoadAvailability()
1241 const DataLayout &DL = Load->getDataLayout(); in AnalyzeLoadAvailability()
1248 if (Address && Load->isAtomic() <= DepSI->isAtomic()) { in AnalyzeLoadAvailability()
1250 analyzeLoadFromClobberingStore(Load->getType(), Address, DepSI, DL); in AnalyzeLoadAvailability()
1264 if (DepLoad != Load && Address && in AnalyzeLoadAvailability()
1265 Load->isAtomic() <= DepLoad->isAtomic()) { in AnalyzeLoadAvailability()
1266 Type *LoadType = Load->getType(); in AnalyzeLoadAvailability()
1289 if (Address && !Load->isAtomic()) { in AnalyzeLoadAvailability()
1290 int Offset = analyzeLoadFromClobberingMemInst(Load->getType(), Address, in AnalyzeLoadAvailability()
1300 dbgs() << "GVN: load "; Load->printAsOperand(dbgs()); in AnalyzeLoadAvailability()
1303 reportMayClobberedLoad(Load, DepInfo, DT, ORE); in AnalyzeLoadAvailability()
1312 return AvailableValue::get(UndefValue::get(Load->getType())); in AnalyzeLoadAvailability()
1315 getInitialValueOfAllocation(DepInst, TLI, Load->getType())) in AnalyzeLoadAvailability()
1322 if (!canCoerceMustAliasedValueToLoad(S->getValueOperand(), Load->getType(), in AnalyzeLoadAvailability()
1327 if (S->isAtomic() < Load->isAtomic()) in AnalyzeLoadAvailability()
1337 if (!canCoerceMustAliasedValueToLoad(LD, Load->getType(), DL)) in AnalyzeLoadAvailability()
1341 if (LD->isAtomic() < Load->isAtomic()) in AnalyzeLoadAvailability()
1351 assert(Sel->getType() == Load->getPointerOperandType()); in AnalyzeLoadAvailability()
1352 auto Loc = MemoryLocation::get(Load); in AnalyzeLoadAvailability()
1355 Load->getType(), DepInst, getAliasAnalysis()); in AnalyzeLoadAvailability()
1360 Load->getType(), DepInst, getAliasAnalysis()); in AnalyzeLoadAvailability()
1369 dbgs() << "GVN: load "; Load->printAsOperand(dbgs()); in AnalyzeLoadAvailability()
1374 void GVNPass::AnalyzeLoadAvailability(LoadInst *Load, LoadDepVect &Deps, in AnalyzeLoadAvailability() argument
1400 if (auto AV = AnalyzeLoadAvailability(Load, DepInfo, Dep.getAddress())) { in AnalyzeLoadAvailability()
1435 LoadInst *Load) { in findLoadToHoistIntoPred() argument
1453 if (!Inst.isIdenticalTo(Load)) in findLoadToHoistIntoPred()
1473 LoadInst *Load, AvailValInBlkVect &ValuesPerBlock, in eliminatePartiallyRedundantLoad() argument
1481 Load->getType(), LoadPtr, Load->getName() + ".pre", Load->isVolatile(), in eliminatePartiallyRedundantLoad()
1482 Load->getAlign(), Load->getOrdering(), Load->getSyncScopeID(), in eliminatePartiallyRedundantLoad()
1484 NewLoad->setDebugLoc(Load->getDebugLoc()); in eliminatePartiallyRedundantLoad()
1495 AAMDNodes Tags = Load->getAAMetadata(); in eliminatePartiallyRedundantLoad()
1499 if (auto *MD = Load->getMetadata(LLVMContext::MD_invariant_load)) in eliminatePartiallyRedundantLoad()
1501 if (auto *InvGroupMD = Load->getMetadata(LLVMContext::MD_invariant_group)) in eliminatePartiallyRedundantLoad()
1503 if (auto *RangeMD = Load->getMetadata(LLVMContext::MD_range)) in eliminatePartiallyRedundantLoad()
1505 if (auto *AccessMD = Load->getMetadata(LLVMContext::MD_access_group)) in eliminatePartiallyRedundantLoad()
1506 if (LI->getLoopFor(Load->getParent()) == LI->getLoopFor(UnavailableBlock)) in eliminatePartiallyRedundantLoad()
1541 Value *V = ConstructSSAForLoadSet(Load, ValuesPerBlock, *this); in eliminatePartiallyRedundantLoad()
1543 ICF->removeUsersOf(Load); in eliminatePartiallyRedundantLoad()
1544 Load->replaceAllUsesWith(V); in eliminatePartiallyRedundantLoad()
1546 V->takeName(Load); in eliminatePartiallyRedundantLoad()
1548 I->setDebugLoc(Load->getDebugLoc()); in eliminatePartiallyRedundantLoad()
1551 markInstructionForDeletion(Load); in eliminatePartiallyRedundantLoad()
1553 return OptimizationRemark(DEBUG_TYPE, "LoadPRE", Load) in eliminatePartiallyRedundantLoad()
1558 bool GVNPass::PerformLoadPRE(LoadInst *Load, AvailValInBlkVect &ValuesPerBlock, in PerformLoadPRE() argument
1573 BasicBlock *LoadBB = Load->getParent(); in PerformLoadPRE()
1592 ICF->isDominatedByICFIFromSameBlock(Load); in PerformLoadPRE()
1638 << Pred->getName() << "': " << *Load << '\n'); in PerformLoadPRE()
1650 << Pred->getName() << "': " << *Load << '\n'); in PerformLoadPRE()
1657 << Pred->getName() << "': " << *Load << '\n'); in PerformLoadPRE()
1667 << Pred->getName() << "': " << *Load << '\n'); in PerformLoadPRE()
1671 if (LoadInst *LI = findLoadToHoistIntoPred(Pred, LoadBB, Load)) in PerformLoadPRE()
1700 if (!isSafeToSpeculativelyExecute(Load, LoadBB->getFirstNonPHI(), AC, DT)) in PerformLoadPRE()
1703 if (!isSafeToSpeculativelyExecute(Load, PL.first->getTerminator(), AC, in PerformLoadPRE()
1707 if (!isSafeToSpeculativelyExecute(Load, CEP.first->getTerminator(), AC, in PerformLoadPRE()
1726 const DataLayout &DL = Load->getDataLayout(); in PerformLoadPRE()
1739 Value *LoadPtr = Load->getPointerOperand(); in PerformLoadPRE()
1740 BasicBlock *Cur = Load->getParent(); in PerformLoadPRE()
1761 << *Load->getPointerOperand() << "\n"); in PerformLoadPRE()
1786 LLVM_DEBUG(dbgs() << "GVN REMOVING PRE LOAD: " << *Load << '\n'); in PerformLoadPRE()
1805 eliminatePartiallyRedundantLoad(Load, ValuesPerBlock, PredLoads, in PerformLoadPRE()
1811 bool GVNPass::performLoopLoadPRE(LoadInst *Load, in performLoopLoadPRE() argument
1814 const Loop *L = LI->getLoopFor(Load->getParent()); in performLoopLoadPRE()
1816 if (!L || L->getHeader() != Load->getParent()) in performLoopLoadPRE()
1824 Value *LoadPtr = Load->getPointerOperand(); in performLoopLoadPRE()
1832 if (ICF->isDominatedByICFIFromSameBlock(Load)) in performLoopLoadPRE()
1881 LLVM_DEBUG(dbgs() << "GVN REMOVING PRE LOOP LOAD: " << *Load << '\n'); in performLoopLoadPRE()
1882 eliminatePartiallyRedundantLoad(Load, ValuesPerBlock, AvailableLoads, in performLoopLoadPRE()
1888 static void reportLoadElim(LoadInst *Load, Value *AvailableValue, in reportLoadElim() argument
1893 return OptimizationRemark(DEBUG_TYPE, "LoadElim", Load) in reportLoadElim()
1894 << "load of type " << NV("Type", Load->getType()) << " eliminated" in reportLoadElim()
1902 bool GVNPass::processNonLocalLoad(LoadInst *Load) { in processNonLocalLoad() argument
1904 if (Load->getParent()->getParent()->hasFnAttribute( in processNonLocalLoad()
1906 Load->getParent()->getParent()->hasFnAttribute( in processNonLocalLoad()
1912 MD->getNonLocalPointerDependency(Load, Deps); in processNonLocalLoad()
1925 LLVM_DEBUG(dbgs() << "GVN: non-local load "; Load->printAsOperand(dbgs()); in processNonLocalLoad()
1933 dyn_cast<GetElementPtrInst>(Load->getOperand(0))) { in processNonLocalLoad()
1942 AnalyzeLoadAvailability(Load, Deps, ValuesPerBlock, UnavailableBlocks); in processNonLocalLoad()
1955 LLVM_DEBUG(dbgs() << "GVN REMOVING NONLOCAL LOAD: " << *Load << '\n'); in processNonLocalLoad()
1958 Value *V = ConstructSSAForLoadSet(Load, ValuesPerBlock, *this); in processNonLocalLoad()
1960 ICF->removeUsersOf(Load); in processNonLocalLoad()
1961 Load->replaceAllUsesWith(V); in processNonLocalLoad()
1964 V->takeName(Load); in processNonLocalLoad()
1969 if (Load->getDebugLoc() && Load->getParent() == I->getParent()) in processNonLocalLoad()
1970 I->setDebugLoc(Load->getDebugLoc()); in processNonLocalLoad()
1973 markInstructionForDeletion(Load); in processNonLocalLoad()
1975 reportLoadElim(Load, V, ORE); in processNonLocalLoad()
1982 if (!isLoadInLoopPREEnabled() && LI->getLoopFor(Load->getParent())) in processNonLocalLoad()
1985 if (performLoopLoadPRE(Load, ValuesPerBlock, UnavailableBlocks) || in processNonLocalLoad()
1986 PerformLoadPRE(Load, ValuesPerBlock, UnavailableBlocks)) in processNonLocalLoad()
2649 if (LoadInst *Load = dyn_cast<LoadInst>(I)) { in processInstruction() local
2650 if (processLoad(Load)) in processInstruction()
2653 unsigned Num = VN.lookupOrAdd(Load); in processInstruction()
2654 LeaderTable.insert(Num, Load, Load->getParent()); in processInstruction()