Lines Matching refs:Inst

60     bool AllUsesDominatedByBlock(Instruction *Inst, BasicBlock *BB) const;
61 bool IsAcceptableTarget(Instruction *Inst, BasicBlock *SuccToSinkTo) const;
76 bool Sinking::AllUsesDominatedByBlock(Instruction *Inst,
82 for (Use &U : Inst->uses()) {
137 Instruction *Inst = &*I; // The instruction to sink.
145 if (isa<DbgInfoIntrinsic>(Inst))
148 if (SinkInstruction(Inst, Stores))
157 static bool isSafeToMove(Instruction *Inst, AliasAnalysis *AA,
160 if (Inst->mayWriteToMemory()) {
161 Stores.insert(Inst);
165 if (LoadInst *L = dyn_cast<LoadInst>(Inst)) {
172 if (isa<TerminatorInst>(Inst) || isa<PHINode>(Inst) || Inst->isEHPad() ||
173 Inst->mayThrow())
178 if (auto CS = CallSite(Inst)) {
188 bool Sinking::IsAcceptableTarget(Instruction *Inst,
190 assert(Inst && "Instruction to be sunk is null");
195 if (Inst->getParent() == SuccToSinkTo)
207 if (SuccToSinkTo->getUniquePredecessor() != Inst->getParent()) {
210 if (!isSafeToSpeculativelyExecute(Inst))
215 if (!DT->dominates(Inst->getParent(), SuccToSinkTo))
220 Loop *cur = LI->getLoopFor(Inst->getParent());
227 return AllUsesDominatedByBlock(Inst, SuccToSinkTo);
232 bool Sinking::SinkInstruction(Instruction *Inst,
237 if (AllocaInst *AI = dyn_cast<AllocaInst>(Inst))
242 if (!isSafeToMove(Inst, AA, Stores))
260 DomTreeNode *DTN = DT->getNode(Inst->getParent());
264 if ((*I)->getIDom()->getBlock() == Inst->getParent() &&
265 IsAcceptableTarget(Inst, Candidate))
271 for (succ_iterator I = succ_begin(Inst->getParent()),
272 E = succ_end(Inst->getParent()); I != E && !SuccToSinkTo; ++I) {
273 if (IsAcceptableTarget(Inst, *I))
281 DEBUG(dbgs() << "Sink" << *Inst << " (";
282 Inst->getParent()->printAsOperand(dbgs(), false);
288 Inst->moveBefore(&*SuccToSinkTo->getFirstInsertionPt());