Home | History | Annotate | Download | only in Utils

Lines Matching refs:UseInst

69     Value *foldIVUser(Instruction *UseInst, Instruction *IVOperand);
71 bool eliminateIdentitySCEV(Instruction *UseInst, Instruction *IVOperand);
74 bool eliminateIVUser(Instruction *UseInst, Instruction *IVOperand);
85 /// IVOperand is guaranteed SCEVable, but UseInst may not be.
90 Value *SimplifyIndvar::foldIVUser(Instruction *UseInst, Instruction *IVOperand) {
94 switch (UseInst->getOpcode()) {
101 if (IVOperand != UseInst->getOperand(OperIdx) ||
102 !isa<ConstantInt>(UseInst->getOperand(1)))
115 ConstantInt *D = cast<ConstantInt>(UseInst->getOperand(1));
116 if (UseInst->getOpcode() == Instruction::LShr) {
118 uint32_t BitWidth = cast<IntegerType>(UseInst->getType())->getBitWidth();
122 D = ConstantInt::get(UseInst->getContext(),
128 if (!SE->isSCEVable(UseInst->getType()))
132 if (SE->getSCEV(UseInst) != FoldedExpr)
136 << " -> " << *UseInst << '\n');
138 UseInst->setOperand(OperIdx, IVSrc);
139 assert(SE->getSCEV(UseInst) == FoldedExpr && "bad SCEV with folded oper");
422 /// but UseInst may not be.
423 bool SimplifyIndvar::eliminateIVUser(Instruction *UseInst,
425 if (ICmpInst *ICmp = dyn_cast<ICmpInst>(UseInst)) {
429 if (BinaryOperator *Rem = dyn_cast<BinaryOperator>(UseInst)) {
437 if (auto *CI = dyn_cast<CallInst>(UseInst))
441 if (eliminateIdentitySCEV(UseInst, IVOperand))
448 bool SimplifyIndvar::eliminateIdentitySCEV(Instruction *UseInst,
450 if (!SE->isSCEVable(UseInst->getType()) ||
451 (UseInst->getType() != IVOperand->getType()) ||
452 (SE->getSCEV(UseInst) != SE->getSCEV(IVOperand)))
471 if (isa<PHINode>(UseInst))
472 // If UseInst
473 // UseInst directly from the legality of SSA.
474 if (!DT || !DT->dominates(IVOperand, UseInst))
477 if (!LI->replacementPreservesLCSSAForm(UseInst, IVOperand))
480 DEBUG(dbgs() << "INDVARS: Eliminated identity: " << *UseInst << '\n');
482 UseInst->replaceAllUsesWith(IVOperand);
485 DeadInsts.emplace_back(UseInst);
621 Instruction *UseInst = UseOper.first;
624 if (UseInst == CurrIV) continue;