Lines Matching defs:Repl
475 void makeGepsAvailable(Instruction *Repl, BasicBlock *HoistPt,
479 void updateAlignment(Instruction *I, Instruction *Repl);
482 // Repl. Returns the number of instructions removed.
483 unsigned rauw(const SmallVecInsn &Candidates, Instruction *Repl,
489 // Remove all other instructions and replace them with Repl.
490 unsigned removeAndReplace(const SmallVecInsn &Candidates, Instruction *Repl,
493 // In the case Repl is a load or a store, we make all their GEPs
496 bool makeGepOperandsAvailable(Instruction *Repl, BasicBlock *HoistPt,
906 void GVNHoist::makeGepsAvailable(Instruction *Repl, BasicBlock *HoistPt,
924 // Copy Gep and replace its uses in Repl with ClonedGep.
951 // Replace uses of Gep with ClonedGep in Repl.
952 Repl->replaceUsesOfWith(Gep, ClonedGep);
955 void GVNHoist::updateAlignment(Instruction *I, Instruction *Repl) {
956 if (auto *ReplacementLoad = dyn_cast<LoadInst>(Repl)) {
960 } else if (auto *ReplacementStore = dyn_cast<StoreInst>(Repl)) {
964 } else if (auto *ReplacementAlloca = dyn_cast<AllocaInst>(Repl)) {
967 } else if (isa<CallInst>(Repl)) {
972 unsigned GVNHoist::rauw(const SmallVecInsn &Candidates, Instruction *Repl,
976 if (I != Repl) {
978 updateAlignment(I, Repl);
986 combineMetadataForCSE(Repl, I, true);
987 Repl->andIRFlags(I);
988 I->replaceAllUsesWith(Repl);
1013 Instruction *Repl, BasicBlock *DestBB,
1015 MemoryUseOrDef *NewMemAcc = MSSA->getMemoryAccess(Repl);
1022 // Replace all other instructions with Repl with memory access NewMemAcc.
1023 unsigned NR = rauw(Candidates, Repl, NewMemAcc);
1032 Instruction *Repl, BasicBlock *HoistPt,
1037 if (auto *Ld = dyn_cast<LoadInst>(Repl)) {
1039 } else if (auto *St = dyn_cast<StoreInst>(Repl)) {
1057 makeGepsAvailable(Repl, HoistPt, InstructionsToHoist, Gep);
1060 makeGepsAvailable(Repl, HoistPt, InstructionsToHoist, Val);
1072 Instruction *Repl = nullptr;
1076 // update Repl to be the first one, such that we can rename the uses
1078 if (!Repl || firstInBB(I, Repl))
1079 Repl = I;
1084 if (Repl) {
1085 // Repl is already in HoistPt: it remains in place.
1086 assert(allOperandsAvailable(Repl, DestBB) &&
1090 // When we do not find Repl in HoistPt, select the first in the list
1092 Repl = InstructionsToHoist.front();
1094 // We can move Repl in HoistPt only when all operands are available.
1097 if (!allOperandsAvailable(Repl, DestBB)) {
1104 if (!makeGepOperandsAvailable(Repl, DestBB, InstructionsToHoist))
1110 MD->removeInstruction(Repl);
1111 Repl->moveBefore(Last->getIterator());
1113 DFSNumber[Repl] = DFSNumber[Last]++;
1117 Repl->dropLocation();
1118 NR += removeAndReplace(InstructionsToHoist, Repl, DestBB, MoveAccess);
1120 if (isa<LoadInst>(Repl))
1122 else if (isa<StoreInst>(Repl))
1124 else if (isa<CallInst>(Repl))