Lines Matching refs:Cmp

472                                    CmpInst *Cmp, Intrinsic::ID IID);
473 bool optimizeCmp(CmpInst *Cmp, ModifyDT &ModifiedDT);
474 bool combineToUSubWithOverflow(CmpInst *Cmp, ModifyDT &ModifiedDT);
475 bool combineToUAddWithOverflow(CmpInst *Cmp, ModifyDT &ModifiedDT);
1552 CmpInst *Cmp, in replaceMathCmpWithIntrinsic() argument
1554 auto IsReplacableIVIncrement = [this, &Cmp](BinaryOperator *BO) { in replaceMathCmpWithIntrinsic()
1560 if (LI->getLoopFor(Cmp->getParent()) != L) in replaceMathCmpWithIntrinsic()
1567 if (DT.dominates(Cmp->getParent(), BO->getParent())) in replaceMathCmpWithIntrinsic()
1573 return BO->hasOneUse() && DT.dominates(Cmp->getParent(), L->getLoopLatch()); in replaceMathCmpWithIntrinsic()
1575 if (BO->getParent() != Cmp->getParent() && !IsReplacableIVIncrement(BO)) { in replaceMathCmpWithIntrinsic()
1606 for (Instruction &Iter : *Cmp->getParent()) { in replaceMathCmpWithIntrinsic()
1609 if ((BO->getOpcode() != Instruction::Xor && &Iter == BO) || &Iter == Cmp) { in replaceMathCmpWithIntrinsic()
1625 replaceAllUsesWith(Cmp, OV, FreshBBs, IsHugeFunc); in replaceMathCmpWithIntrinsic()
1626 Cmp->eraseFromParent(); in replaceMathCmpWithIntrinsic()
1632 static bool matchUAddWithOverflowConstantEdgeCases(CmpInst *Cmp, in matchUAddWithOverflowConstantEdgeCases() argument
1636 Value *A = Cmp->getOperand(0), *B = Cmp->getOperand(1); in matchUAddWithOverflowConstantEdgeCases()
1642 ICmpInst::Predicate Pred = Cmp->getPredicate(); in matchUAddWithOverflowConstantEdgeCases()
1663 bool CodeGenPrepare::combineToUAddWithOverflow(CmpInst *Cmp, in combineToUAddWithOverflow() argument
1668 if (!match(Cmp, m_UAddWithOverflow(m_Value(A), m_Value(B), m_BinOp(Add)))) { in combineToUAddWithOverflow()
1669 if (!matchUAddWithOverflowConstantEdgeCases(Cmp, Add)) in combineToUAddWithOverflow()
1685 if (Add->getParent() != Cmp->getParent() && !Add->hasOneUse()) in combineToUAddWithOverflow()
1688 if (!replaceMathCmpWithIntrinsic(Add, A, B, Cmp, in combineToUAddWithOverflow()
1697 bool CodeGenPrepare::combineToUSubWithOverflow(CmpInst *Cmp, in combineToUSubWithOverflow() argument
1700 Value *A = Cmp->getOperand(0), *B = Cmp->getOperand(1); in combineToUSubWithOverflow()
1705 ICmpInst::Predicate Pred = Cmp->getPredicate(); in combineToUSubWithOverflow()
1752 Cmp, Intrinsic::usub_with_overflow)) in combineToUSubWithOverflow()
1766 static bool sinkCmpExpression(CmpInst *Cmp, const TargetLowering &TLI) { in sinkCmpExpression() argument
1771 if (TLI.useSoftFloat() && isa<FCmpInst>(Cmp)) in sinkCmpExpression()
1778 for (Value::user_iterator UI = Cmp->user_begin(), E = Cmp->user_end(); in sinkCmpExpression()
1792 BasicBlock *DefBB = Cmp->getParent(); in sinkCmpExpression()
1804 InsertedCmp = CmpInst::Create(Cmp->getOpcode(), Cmp->getPredicate(), in sinkCmpExpression()
1805 Cmp->getOperand(0), Cmp->getOperand(1), ""); in sinkCmpExpression()
1808 InsertedCmp->setDebugLoc(Cmp->getDebugLoc()); in sinkCmpExpression()
1818 if (Cmp->use_empty()) { in sinkCmpExpression()
1819 Cmp->eraseFromParent(); in sinkCmpExpression()
1845 static bool foldICmpWithDominatingICmp(CmpInst *Cmp, in foldICmpWithDominatingICmp() argument
1850 ICmpInst::Predicate Pred = Cmp->getPredicate(); in foldICmpWithDominatingICmp()
1856 for (User *U : Cmp->users()) { in foldICmpWithDominatingICmp()
1859 if (isa<SelectInst>(U) && cast<SelectInst>(U)->getCondition() == Cmp) in foldICmpWithDominatingICmp()
1866 BasicBlock *CmpBB = Cmp->getParent(); in foldICmpWithDominatingICmp()
1881 Value *CmpOp0 = Cmp->getOperand(0), *CmpOp1 = Cmp->getOperand(1); in foldICmpWithDominatingICmp()
1895 for (User *U : Cmp->users()) { in foldICmpWithDominatingICmp()
1909 Cmp->setPredicate(CmpInst::getSwappedPredicate(DomPred)); in foldICmpWithDominatingICmp()
1915 static bool swapICmpOperandsToExposeCSEOpportunities(CmpInst *Cmp) { in swapICmpOperandsToExposeCSEOpportunities() argument
1916 Value *Op0 = Cmp->getOperand(0); in swapICmpOperandsToExposeCSEOpportunities()
1917 Value *Op1 = Cmp->getOperand(1); in swapICmpOperandsToExposeCSEOpportunities()
1938 Cmp->swapOperands(); in swapICmpOperandsToExposeCSEOpportunities()
1944 static bool foldFCmpToFPClassTest(CmpInst *Cmp, const TargetLowering &TLI, in foldFCmpToFPClassTest() argument
1946 FCmpInst *FCmp = dyn_cast<FCmpInst>(Cmp); in foldFCmpToFPClassTest()
1951 EVT VT = TLI.getValueType(DL, Cmp->getOperand(0)->getType()); in foldFCmpToFPClassTest()
1970 IRBuilder<> Builder(Cmp); in foldFCmpToFPClassTest()
1972 Cmp->replaceAllUsesWith(IsFPClass); in foldFCmpToFPClassTest()
1973 RecursivelyDeleteTriviallyDeadInstructions(Cmp); in foldFCmpToFPClassTest()
1977 bool CodeGenPrepare::optimizeCmp(CmpInst *Cmp, ModifyDT &ModifiedDT) { in optimizeCmp() argument
1978 if (sinkCmpExpression(Cmp, *TLI)) in optimizeCmp()
1981 if (combineToUAddWithOverflow(Cmp, ModifiedDT)) in optimizeCmp()
1984 if (combineToUSubWithOverflow(Cmp, ModifiedDT)) in optimizeCmp()
1987 if (foldICmpWithDominatingICmp(Cmp, *TLI)) in optimizeCmp()
1990 if (swapICmpOperandsToExposeCSEOpportunities(Cmp)) in optimizeCmp()
1993 if (foldFCmpToFPClassTest(Cmp, *TLI, *DL)) in optimizeCmp()
2352 Value *Cmp = Builder.CreateICmpEQ(Op, Zero, "cmpz"); in despeculateCountZeros() local
2353 Builder.CreateCondBr(Cmp, EndBlock, CallBlock); in despeculateCountZeros()
7005 CmpInst *Cmp = dyn_cast<CmpInst>(SI->getCondition()); in isFormingBranchFromSelectProfitable() local
7010 if (!Cmp || !Cmp->hasOneUse()) in isFormingBranchFromSelectProfitable()
8248 ICmpInst *Cmp = dyn_cast<ICmpInst>(Branch->getCondition()); in optimizeBranch() local
8249 if (!Cmp || !isa<ConstantInt>(Cmp->getOperand(1)) || !Cmp->hasOneUse()) in optimizeBranch()
8252 Value *X = Cmp->getOperand(0); in optimizeBranch()
8253 APInt CmpC = cast<ConstantInt>(Cmp->getOperand(1))->getValue(); in optimizeBranch()
8266 if (CmpC.isPowerOf2() && Cmp->getPredicate() == ICmpInst::ICMP_ULT && in optimizeBranch()
8274 LLVM_DEBUG(dbgs() << "Converting " << *Cmp << "\n"); in optimizeBranch()
8276 replaceAllUsesWith(Cmp, NewCmp, FreshBBs, IsHugeFunc); in optimizeBranch()
8279 if (Cmp->isEquality() && in optimizeBranch()
8286 Value *NewCmp = Builder.CreateCmp(Cmp->getPredicate(), UI, in optimizeBranch()
8288 LLVM_DEBUG(dbgs() << "Converting " << *Cmp << "\n"); in optimizeBranch()
8290 replaceAllUsesWith(Cmp, NewCmp, FreshBBs, IsHugeFunc); in optimizeBranch()
8359 if (auto *Cmp = dyn_cast<CmpInst>(I)) in optimizeInst() local
8360 if (optimizeCmp(Cmp, ModifiedDT)) in optimizeInst()