Lines Matching refs:UseInst

80     Value *foldIVUser(Instruction *UseInst, Instruction *IVOperand);
82 bool eliminateIdentitySCEV(Instruction *UseInst, Instruction *IVOperand);
83 bool replaceIVUserWithLoopInvariant(Instruction *UseInst);
88 bool eliminateIVUser(Instruction *UseInst, Instruction *IVOperand);
128 Value *SimplifyIndvar::foldIVUser(Instruction *UseInst, Instruction *IVOperand) { in foldIVUser() argument
133 switch (UseInst->getOpcode()) { in foldIVUser()
140 if (IVOperand != UseInst->getOperand(OperIdx) || in foldIVUser()
141 !isa<ConstantInt>(UseInst->getOperand(1))) in foldIVUser()
154 ConstantInt *D = cast<ConstantInt>(UseInst->getOperand(1)); in foldIVUser()
155 if (UseInst->getOpcode() == Instruction::LShr) { in foldIVUser()
157 uint32_t BitWidth = cast<IntegerType>(UseInst->getType())->getBitWidth(); in foldIVUser()
161 D = ConstantInt::get(UseInst->getContext(), in foldIVUser()
167 if (UseInst->isExact() && in foldIVUser()
172 if (!SE->isSCEVable(UseInst->getType())) in foldIVUser()
176 if (SE->getSCEV(UseInst) != FoldedExpr) in foldIVUser()
180 << " -> " << *UseInst << '\n'); in foldIVUser()
182 UseInst->setOperand(OperIdx, IVSrc); in foldIVUser()
183 assert(SE->getSCEV(UseInst) == FoldedExpr && "bad SCEV with folded oper"); in foldIVUser()
186 UseInst->dropPoisonGeneratingFlags(); in foldIVUser()
601 bool SimplifyIndvar::eliminateIVUser(Instruction *UseInst, in eliminateIVUser() argument
603 if (ICmpInst *ICmp = dyn_cast<ICmpInst>(UseInst)) { in eliminateIVUser()
607 if (BinaryOperator *Bin = dyn_cast<BinaryOperator>(UseInst)) { in eliminateIVUser()
618 if (auto *WO = dyn_cast<WithOverflowInst>(UseInst)) in eliminateIVUser()
622 if (auto *SI = dyn_cast<SaturatingInst>(UseInst)) in eliminateIVUser()
626 if (auto *TI = dyn_cast<TruncInst>(UseInst)) in eliminateIVUser()
630 if (eliminateIdentitySCEV(UseInst, IVOperand)) in eliminateIVUser()
678 bool SimplifyIndvar::eliminateIdentitySCEV(Instruction *UseInst, in eliminateIdentitySCEV() argument
680 if (!SE->isSCEVable(UseInst->getType()) || in eliminateIdentitySCEV()
681 (UseInst->getType() != IVOperand->getType()) || in eliminateIdentitySCEV()
682 (SE->getSCEV(UseInst) != SE->getSCEV(IVOperand))) in eliminateIdentitySCEV()
701 if (isa<PHINode>(UseInst)) in eliminateIdentitySCEV()
704 if (!DT || !DT->dominates(IVOperand, UseInst)) in eliminateIdentitySCEV()
707 if (!LI->replacementPreservesLCSSAForm(UseInst, IVOperand)) in eliminateIdentitySCEV()
710 LLVM_DEBUG(dbgs() << "INDVARS: Eliminated identity: " << *UseInst << '\n'); in eliminateIdentitySCEV()
712 UseInst->replaceAllUsesWith(IVOperand); in eliminateIdentitySCEV()
715 DeadInsts.emplace_back(UseInst); in eliminateIdentitySCEV()
853 Instruction *UseInst = UseOper.first; in simplifyUsers() local
859 if (isInstructionTriviallyDead(UseInst, /* TLI */ nullptr)) { in simplifyUsers()
860 DeadInsts.emplace_back(UseInst); in simplifyUsers()
865 if (UseInst == CurrIV) continue; in simplifyUsers()
869 if (replaceIVUserWithLoopInvariant(UseInst)) in simplifyUsers()
876 Value *NewOper = foldIVUser(UseInst, IVOperand); in simplifyUsers()
884 if (eliminateIVUser(UseInst, IVOperand)) { in simplifyUsers()
889 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(UseInst)) { in simplifyUsers()
899 CastInst *Cast = dyn_cast<CastInst>(UseInst); in simplifyUsers()
904 if (isSimpleIVUser(UseInst, L, SE)) { in simplifyUsers()
905 pushIVUsers(UseInst, L, Simplified, SimpleIVUsers); in simplifyUsers()