Home | History | Annotate | Download | only in Utils

Lines Matching refs:UseInst

72     Value *foldIVUser(Instruction *UseInst, Instruction *IVOperand);
74 bool eliminateIVUser(Instruction *UseInst, Instruction *IVOperand);
84 /// IVOperand is guaranteed SCEVable, but UseInst may not be.
89 Value *SimplifyIndvar::foldIVUser(Instruction *UseInst, Instruction *IVOperand) {
93 switch (UseInst->getOpcode()) {
100 if (IVOperand != UseInst->getOperand(OperIdx) ||
101 !isa<ConstantInt>(UseInst->getOperand(1)))
114 ConstantInt *D = cast<ConstantInt>(UseInst->getOperand(1));
115 if (UseInst->getOpcode() == Instruction::LShr) {
117 uint32_t BitWidth = cast<IntegerType>(UseInst->getType())->getBitWidth();
121 D = ConstantInt::get(UseInst->getContext(),
127 if (!SE->isSCEVable(UseInst->getType()))
131 if (SE->getSCEV(UseInst) != FoldedExpr)
135 << " -> " << *UseInst << '\n');
137 UseInst->setOperand(OperIdx, IVSrc);
138 assert(SE->getSCEV(UseInst) == FoldedExpr && "bad SCEV with folded oper");
236 /// IVOperand is guaranteed SCEVable, but UseInst may not be.
237 bool SimplifyIndvar::eliminateIVUser(Instruction *UseInst,
239 if (ICmpInst *ICmp = dyn_cast<ICmpInst>(UseInst)) {
243 if (BinaryOperator *Rem = dyn_cast<BinaryOperator>(UseInst)) {
252 if (!SE->isSCEVable(UseInst->getType()) ||
253 (UseInst->getType() != IVOperand->getType()) ||
254 (SE->getSCEV(UseInst) != SE->getSCEV(IVOperand)))
257 DEBUG(dbgs() << "INDVARS: Eliminated identity: " << *UseInst << '\n');
259 UseInst->replaceAllUsesWith(IVOperand);
262 DeadInsts.push_back(UseInst);