Lines Matching full:instruction
20 // we can hoist it or sink it like any other instruction.
21 // 2. Scalar Promotion of Memory - If there is a store instruction inside of
75 static bool isNotUsedInLoop(Instruction &I, Loop *CurLoop);
76 static bool hoist(Instruction &I, BasicBlock *Preheader);
77 static bool sink(Instruction &I, LoopInfo *LI, DominatorTree *DT,
79 static bool isGuaranteedToExecute(Instruction &Inst, DominatorTree *DT,
81 static bool isSafeToExecuteUnconditionally(Instruction &Inst, DominatorTree *DT,
87 static Instruction *CloneInstructionInExitBlock(Instruction &I,
90 static bool canSinkOrHoistInst(Instruction &I, AliasAnalysis *AA,
245 SmallVector<Instruction *, 8> InsertPts;
317 Instruction &I = *--II;
319 // If the instruction is dead, we would try to sink it because it isn't used
330 // Check to see if we can sink this instruction to the exit blocks
331 // of the loop. We can do this if the all users of the instruction are
333 // operands of the instruction are loop invariant.
366 Instruction &I = *II++;
367 // Try constant folding this instruction. If all the operands are
380 // Try hoisting the instruction out to the preheader. We can only do this
381 instruction are loop invariant and if it
382 // is safe to hoist the instruction.
421 /// instruction.
423 bool canSinkOrHoistInst(Instruction &I, AliasAnalysis *AA, DominatorTree *DT,
489 /// Instruction.
490 /// This is true when all incoming values are that instruction.
493 static bool isTriviallyReplacablePHI(PHINode &PN, Instruction &I) {
501 /// Return true if the only users of this instruction are outside of
502 /// the loop. If this is true, we can sink the instruction to the exit
505 static bool isNotUsedInLoop(Instruction &I, Loop *CurLoop) {
507 Instruction *UI = cast<Instruction>(U);
509 // A PHI node where all of the incoming values are this instruction are
510 // special -- they can just be RAUW'ed with the instruction and thus
536 static Instruction *CloneInstructionInExitBlock(Instruction &I,
539 Instruction *New = I.clone();
552 if (Instruction *OInst = dyn_cast<Instruction>(*OI))
565 /// When an instruction is found to only be used outside of the loop, this
567 /// This method is guaranteed to remove the original instruction from its
570 static bool sink(Instruction &I, LoopInfo *LI, DominatorTree *DT,
572 DEBUG(dbgs() << "LICM sinking instruction: " << I << "\n");
586 // Clones of this instruction. Don't create more than one per exit block!
587 SmallDenseMap<BasicBlock *, Instruction *, 32> SunkCopies;
589 // If this instruction is only used outside of the loop, then all users are
591 // the instruction.
593 Instruction *User = I.user_back();
605 Instruction *New;
622 /// When an instruction is found to only use loop invariant operands that
623 /// is safe to hoist, this instruction is called to do the dirty work.
625 static bool hoist(Instruction &I, BasicBlock *Preheader) {
637 /// Only sink or hoist an instruction if it is not a trapping instruction
638 /// or if it is a trapping instruction and is guaranteed to execute.
640 static bool isSafeToExecuteUnconditionally(Instruction &Inst, DominatorTree *DT,
643 // If it is not a trapping instruction, it is always safe to hoist.
650 static bool isGuaranteedToExecute(Instruction &Inst, DominatorTree *DT,
653 // We have to check to make sure that the instruction dominates all
655 // which does not execute this instruction, so we can't hoist it.
657 // If the instruction is in the header block for the loop (which is very
665 // Somewhere in this loop there is an instruction which may throw and make us
692 SmallVectorImpl<Instruction*> &LoopInsertPts;
701 if (Instruction *I = dyn_cast<Instruction>(V))
717 LoopPromoter(Value *SP, const SmallVectorImpl<Instruction *> &Insts,
720 SmallVectorImpl<Instruction *> &LIP, PredIteratorCache &PIC,
727 bool isInstInList(Instruction *I,
728 const SmallVectorImpl<Instruction*> &) const override {
747 Instruction *InsertPos = LoopInsertPts[i];
759 void instructionDeleted(Instruction *I) const override {
772 SmallVectorImpl<Instruction*>&InsertPts,
812 SmallVector<Instruction*, 64> LoopUses;
836 Instruction *UI = dyn_cast<Instruction>(U);
840 // If there is an non-load/store instruction in the loop, we can't promote
866 // If the alignment of this instruction allows us to specify a more
868 // instruction will be executed, update the alignment.
896 // If there isn't a guaranteed-to-execute instruction, we can't promote.