Home | History | Annotate | Download | only in Scalar

Lines Matching full:instruction

15 // cost. If the constant can be folded into the instruction (the cost is
21 // into the instruction and it might be beneficial to hoist the constant.
66 Instruction *Inst;
69 ConstantUser(Instruction *Inst, unsigned Idx) : Inst(Inst), OpndIdx(Idx) { }
82 void addUser(Instruction *Inst, unsigned Idx, unsigned Cost) {
117 SmallDenseMap<Instruction *, Instruction *> ClonedCastMap;
157 Instruction *findMatInsertPt(Instruction *Inst, unsigned Idx = ~0U) const;
158 Instruction *findConstantInsertionPoint(const ConstantInfo &ConstInfo) const;
160 Instruction *Inst, unsigned Idx,
163 Instruction *Inst);
168 void emitBaseConstants(Instruction *Base, Constant *Offset,
214 Instruction *ConstantHoisting::findMatInsertPt(Instruction *Inst,
216 // If the operand is a cast instruction, then we have to materialize the
217 // constant before the cast instruction.
220 if (auto CastInst = dyn_cast<Instruction>(Opnd))
240 Instruction *ConstantHoisting::
264 Instruction &FirstInst = (*BBs.begin())->front();
269 /// \brief Record constant integer ConstInt for instruction Inst at operand
273 /// could also be a cast instruction or a constant expression that uses the
276 Instruction *Inst,
281 // instruction and operand index.
310 /// \brief Scan the instruction for expensive integer constants and record them
313 Instruction *Inst) {
334 if (auto CastInst = dyn_cast<Instruction>(Opnd)) {
341 // Pretend the constant is directly used by the instruction and ignore
342 // the cast instruction.
355 // Pretend the constant is directly used by the instruction and ignore
365 /// into an instruction itself.
439 /// \brief Updates the operand at Idx in instruction Inst with the result of
440 /// instruction Mat. If the instruction is a PHI node then special
445 static bool updateOperand(Instruction *Inst, unsigned Idx, Instruction *Mat) {
469 void ConstantHoisting::emitBaseConstants(Instruction *Base, Constant *Offset,
471 Instruction *Mat = Base;
473 Instruction *InsertionPt = findMatInsertPt(ConstUser.Inst,
475 Mat = BinaryOperator::Create(Instruction::Add, Base, Offset,
494 // Visit cast instruction.
495 if (auto CastInst = dyn_cast<Instruction>(Opnd)) {
496 assert(CastInst->isCast() && "Expected an cast instruction!");
497 // Check if we already have visited this cast instruction before to avoid
499 Instruction *&ClonedCastInst = ClonedCastMap[CastInst];
504 // Use the same debug location as the original cast instruction.
506 DEBUG(dbgs() << "Clone instruction: " << *CastInst << '\n'
518 Instruction *ConstExprInst = ConstExpr->getAsInstruction();
523 // Use the same debug location as the instruction we are about to update.
526 DEBUG(dbgs() << "Create instruction: " << *ConstExprInst << '\n'
545 Instruction *IP = findConstantInsertionPoint(ConstInfo);
547 Instruction *Base =
562 assert(isa<Instruction>(Base->user_back()) &&
564 Base->setDebugLoc(cast<Instruction>(Base->user_back())->getDebugLoc());