Lines Matching refs:Inst

37 static bool AllUsesDominatedByBlock(Instruction *Inst, BasicBlock *BB,
43 for (Use &U : Inst->uses()) {
60 static bool isSafeToMove(Instruction *Inst, AliasAnalysis &AA,
63 if (Inst->mayWriteToMemory()) {
64 Stores.insert(Inst);
68 if (LoadInst *L = dyn_cast<LoadInst>(Inst)) {
75 if (isa<TerminatorInst>(Inst) || isa<PHINode>(Inst) || Inst->isEHPad() ||
76 Inst->mayThrow())
79 if (auto CS = CallSite(Inst)) {
95 static bool IsAcceptableTarget(Instruction *Inst, BasicBlock *SuccToSinkTo,
97 assert(Inst && "Instruction to be sunk is null");
102 if (Inst->getParent() == SuccToSinkTo)
114 if (SuccToSinkTo->getUniquePredecessor() != Inst->getParent()) {
117 if (!isSafeToSpeculativelyExecute(Inst))
122 if (!DT.dominates(Inst->getParent(), SuccToSinkTo))
127 Loop *cur = LI.getLoopFor(Inst->getParent());
134 return AllUsesDominatedByBlock(Inst, SuccToSinkTo, DT);
139 static bool SinkInstruction(Instruction *Inst,
145 if (AllocaInst *AI = dyn_cast<AllocaInst>(Inst))
150 if (!isSafeToMove(Inst, AA, Stores))
168 DomTreeNode *DTN = DT.getNode(Inst->getParent());
172 if ((*I)->getIDom()->getBlock() == Inst->getParent() &&
173 IsAcceptableTarget(Inst, Candidate, DT, LI))
179 for (succ_iterator I = succ_begin(Inst->getParent()),
180 E = succ_end(Inst->getParent()); I != E && !SuccToSinkTo; ++I) {
181 if (IsAcceptableTarget(Inst, *I, DT, LI))
189 DEBUG(dbgs() << "Sink" << *Inst << " (";
190 Inst->getParent()->printAsOperand(dbgs(), false);
196 Inst->moveBefore(&*SuccToSinkTo->getFirstInsertionPt());
218 Instruction *Inst = &*I; // The instruction to sink.
226 if (isa<DbgInfoIntrinsic>(Inst))
229 if (SinkInstruction(Inst, Stores, DT, LI, AA)) {