Lines Matching defs:ICmp

98     bool makeIVComparisonInvariant(ICmpInst *ICmp, Instruction *IVOperand);
99 void eliminateIVComparison(ICmpInst *ICmp, Instruction *IVOperand);
202 bool SimplifyIndvar::makeIVComparisonInvariant(ICmpInst *ICmp,
208 ICmpInst::Predicate Pred = ICmp->getPredicate();
209 if (IVOperand != ICmp->getOperand(0)) {
211 assert(IVOperand == ICmp->getOperand(1) && "Can't find IVOperand");
216 // Get the SCEVs for the ICmp operands (in the specific context of the
218 const Loop *ICmpLoop = LI->getLoopFor(ICmp->getParent());
219 const SCEV *S = SE->getSCEVAtScope(ICmp->getOperand(IVOperIdx), ICmpLoop);
220 const SCEV *X = SE->getSCEVAtScope(ICmp->getOperand(1 - IVOperIdx), ICmpLoop);
221 auto LIP = SE->getLoopInvariantPredicate(Pred, S, X, L, ICmp);
239 LLVM_DEBUG(dbgs() << "INDVARS: Simplified comparison: " << *ICmp << '\n');
240 ICmp->setPredicate(InvariantPredicate);
241 ICmp->setOperand(0, NewLHS);
242 ICmp->setOperand(1, NewRHS);
249 void SimplifyIndvar::eliminateIVComparison(ICmpInst *ICmp,
252 ICmpInst::Predicate Pred = ICmp->getPredicate();
254 if (IVOperand != ICmp->getOperand(0)) {
256 assert(IVOperand == ICmp->getOperand(1) && "Can't find IVOperand");
261 // Get the SCEVs for the ICmp operands (in the specific context of the
263 const Loop *ICmpLoop = LI->getLoopFor(ICmp->getParent());
264 const SCEV *S = SE->getSCEVAtScope(ICmp->getOperand(IVOperIdx), ICmpLoop);
265 const SCEV *X = SE->getSCEVAtScope(ICmp->getOperand(1 - IVOperIdx), ICmpLoop);
270 for (auto *U : ICmp->users())
274 SE->forgetValue(ICmp);
275 ICmp->replaceAllUsesWith(ConstantInt::getBool(ICmp->getContext(), *Ev));
276 DeadInsts.emplace_back(ICmp);
277 LLVM_DEBUG(dbgs() << "INDVARS: Eliminated comparison: " << *ICmp << '\n');
278 } else if (makeIVComparisonInvariant(ICmp, IVOperand)) {
287 assert(ICmp->getPredicate() == OriginalPred && "Predicate changed?");
288 LLVM_DEBUG(dbgs() << "INDVARS: Turn to unsigned comparison: " << *ICmp
290 ICmp->setPredicate(ICmpInst::getUnsignedPredicate(OriginalPred));
299 // Get the SCEVs for the ICmp operands.
352 ICmpInst *ICmp = new ICmpInst(Rem->getIterator(), ICmpInst::ICMP_EQ, N, D);
354 SelectInst::Create(ICmp, ConstantInt::get(T, 0), N, "iv.rem", Rem->getIterator());
596 if (ICmpInst *ICmp = dyn_cast<ICmpInst>(UseInst)) {
597 eliminateIVComparison(ICmp, IVOperand);
1702 if (auto *ICmp = dyn_cast<ICmpInst>(User)) {
1703 auto Pred = ICmp->getPredicate();
1712 ICmpUsers.push_back(ICmp);