Lines Matching refs:UseInst
70 Value *foldIVUser(Instruction *UseInst, Instruction *IVOperand);
72 bool eliminateIdentitySCEV(Instruction *UseInst, Instruction *IVOperand);
74 bool eliminateIVUser(Instruction *UseInst, Instruction *IVOperand);
88 /// IVOperand is guaranteed SCEVable, but UseInst may not be.
93 Value *SimplifyIndvar::foldIVUser(Instruction *UseInst, Instruction *IVOperand) {
97 switch (UseInst->getOpcode()) {
104 if (IVOperand != UseInst->getOperand(OperIdx) ||
105 !isa<ConstantInt>(UseInst->getOperand(1)))
118 ConstantInt *D = cast<ConstantInt>(UseInst->getOperand(1));
119 if (UseInst->getOpcode() == Instruction::LShr) {
121 uint32_t BitWidth = cast<IntegerType>(UseInst->getType())->getBitWidth();
125 D = ConstantInt::get(UseInst->getContext(),
131 if (!SE->isSCEVable(UseInst->getType()))
135 if (SE->getSCEV(UseInst) != FoldedExpr)
139 << " -> " << *UseInst << '\n');
141 UseInst->setOperand(OperIdx, IVSrc);
142 assert(SE->getSCEV(UseInst) == FoldedExpr && "bad SCEV with folded oper");
285 /// but UseInst may not be.
286 bool SimplifyIndvar::eliminateIVUser(Instruction *UseInst,
288 if (ICmpInst *ICmp = dyn_cast<ICmpInst>(UseInst)) {
292 if (BinaryOperator *Rem = dyn_cast<BinaryOperator>(UseInst)) {
300 if (eliminateIdentitySCEV(UseInst, IVOperand))
307 bool SimplifyIndvar::eliminateIdentitySCEV(Instruction *UseInst,
309 if (!SE->isSCEVable(UseInst->getType()) ||
310 (UseInst->getType() != IVOperand->getType()) ||
311 (SE->getSCEV(UseInst) != SE->getSCEV(IVOperand)))
330 if (isa<PHINode>(UseInst))
331 // If UseInst is not a PHI node then we know that IVOperand dominates
332 // UseInst directly from the legality of SSA.
333 if (!DT || !DT->dominates(IVOperand, UseInst))
336 if (!LI->replacementPreservesLCSSAForm(UseInst, IVOperand))
339 DEBUG(dbgs() << "INDVARS: Eliminated identity: " << *UseInst << '\n');
341 UseInst->replaceAllUsesWith(IVOperand);
344 DeadInsts.emplace_back(UseInst);
445 if (Instruction *UseInst = dyn_cast<Instruction>(U.getUser())) {
446 BasicBlock *UseBB = UseInst->getParent();
447 if (PHINode *PHI = dyn_cast<PHINode>(UseInst))
543 Instruction *UseInst = UseOper.first;
546 if (UseInst == CurrIV) continue;
549 UseInst = splitOverflowIntrinsic(UseInst, V->getDomTree());
550 if (!UseInst)