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);
1555 CmpInst *Cmp, in replaceMathCmpWithIntrinsic() argument
1557 auto IsReplacableIVIncrement = [this, &Cmp](BinaryOperator *BO) { in replaceMathCmpWithIntrinsic()
1563 if (LI->getLoopFor(Cmp->getParent()) != L) in replaceMathCmpWithIntrinsic()
1570 if (DT.dominates(Cmp->getParent(), BO->getParent())) in replaceMathCmpWithIntrinsic()
1576 return BO->hasOneUse() && DT.dominates(Cmp->getParent(), L->getLoopLatch()); in replaceMathCmpWithIntrinsic()
1578 if (BO->getParent() != Cmp->getParent() && !IsReplacableIVIncrement(BO)) { in replaceMathCmpWithIntrinsic()
1609 for (Instruction &Iter : *Cmp->getParent()) { in replaceMathCmpWithIntrinsic()
1612 if ((BO->getOpcode() != Instruction::Xor && &Iter == BO) || &Iter == Cmp) { in replaceMathCmpWithIntrinsic()
1628 replaceAllUsesWith(Cmp, OV, FreshBBs, IsHugeFunc); in replaceMathCmpWithIntrinsic()
1629 Cmp->eraseFromParent(); in replaceMathCmpWithIntrinsic()
1635 static bool matchUAddWithOverflowConstantEdgeCases(CmpInst *Cmp, in matchUAddWithOverflowConstantEdgeCases() argument
1639 Value *A = Cmp->getOperand(0), *B = Cmp->getOperand(1); in matchUAddWithOverflowConstantEdgeCases()
1645 ICmpInst::Predicate Pred = Cmp->getPredicate(); in matchUAddWithOverflowConstantEdgeCases()
1666 bool CodeGenPrepare::combineToUAddWithOverflow(CmpInst *Cmp, in combineToUAddWithOverflow() argument
1671 if (!match(Cmp, m_UAddWithOverflow(m_Value(A), m_Value(B), m_BinOp(Add)))) { in combineToUAddWithOverflow()
1672 if (!matchUAddWithOverflowConstantEdgeCases(Cmp, Add)) in combineToUAddWithOverflow()
1688 if (Add->getParent() != Cmp->getParent() && !Add->hasOneUse()) in combineToUAddWithOverflow()
1691 if (!replaceMathCmpWithIntrinsic(Add, A, B, Cmp, in combineToUAddWithOverflow()
1700 bool CodeGenPrepare::combineToUSubWithOverflow(CmpInst *Cmp, in combineToUSubWithOverflow() argument
1703 Value *A = Cmp->getOperand(0), *B = Cmp->getOperand(1); in combineToUSubWithOverflow()
1708 ICmpInst::Predicate Pred = Cmp->getPredicate(); in combineToUSubWithOverflow()
1755 Cmp, Intrinsic::usub_with_overflow)) in combineToUSubWithOverflow()
1769 static bool sinkCmpExpression(CmpInst *Cmp, const TargetLowering &TLI) { in sinkCmpExpression() argument
1774 if (TLI.useSoftFloat() && isa<FCmpInst>(Cmp)) in sinkCmpExpression()
1781 for (Value::user_iterator UI = Cmp->user_begin(), E = Cmp->user_end(); in sinkCmpExpression()
1795 BasicBlock *DefBB = Cmp->getParent(); in sinkCmpExpression()
1807 InsertedCmp = CmpInst::Create(Cmp->getOpcode(), Cmp->getPredicate(), in sinkCmpExpression()
1808 Cmp->getOperand(0), Cmp->getOperand(1), ""); in sinkCmpExpression()
1811 InsertedCmp->setDebugLoc(Cmp->getDebugLoc()); in sinkCmpExpression()
1821 if (Cmp->use_empty()) { in sinkCmpExpression()
1822 Cmp->eraseFromParent(); in sinkCmpExpression()
1848 static bool foldICmpWithDominatingICmp(CmpInst *Cmp, in foldICmpWithDominatingICmp() argument
1853 ICmpInst::Predicate Pred = Cmp->getPredicate(); in foldICmpWithDominatingICmp()
1859 for (User *U : Cmp->users()) { in foldICmpWithDominatingICmp()
1862 if (isa<SelectInst>(U) && cast<SelectInst>(U)->getCondition() == Cmp) in foldICmpWithDominatingICmp()
1869 BasicBlock *CmpBB = Cmp->getParent(); in foldICmpWithDominatingICmp()
1884 Value *CmpOp0 = Cmp->getOperand(0), *CmpOp1 = Cmp->getOperand(1); in foldICmpWithDominatingICmp()
1898 for (User *U : Cmp->users()) { in foldICmpWithDominatingICmp()
1912 Cmp->setPredicate(CmpInst::getSwappedPredicate(DomPred)); in foldICmpWithDominatingICmp()
1918 static bool swapICmpOperandsToExposeCSEOpportunities(CmpInst *Cmp) { in swapICmpOperandsToExposeCSEOpportunities() argument
1919 Value *Op0 = Cmp->getOperand(0); in swapICmpOperandsToExposeCSEOpportunities()
1920 Value *Op1 = Cmp->getOperand(1); in swapICmpOperandsToExposeCSEOpportunities()
1941 Cmp->swapOperands(); in swapICmpOperandsToExposeCSEOpportunities()
1947 bool CodeGenPrepare::optimizeCmp(CmpInst *Cmp, ModifyDT &ModifiedDT) { in optimizeCmp() argument
1948 if (sinkCmpExpression(Cmp, *TLI)) in optimizeCmp()
1951 if (combineToUAddWithOverflow(Cmp, ModifiedDT)) in optimizeCmp()
1954 if (combineToUSubWithOverflow(Cmp, ModifiedDT)) in optimizeCmp()
1957 if (foldICmpWithDominatingICmp(Cmp, *TLI)) in optimizeCmp()
1960 if (swapICmpOperandsToExposeCSEOpportunities(Cmp)) in optimizeCmp()
2319 Value *Cmp = Builder.CreateICmpEQ(Op, Zero, "cmpz"); in despeculateCountZeros() local
2320 Builder.CreateCondBr(Cmp, EndBlock, CallBlock); in despeculateCountZeros()
6891 CmpInst *Cmp = dyn_cast<CmpInst>(SI->getCondition()); in isFormingBranchFromSelectProfitable() local
6896 if (!Cmp || !Cmp->hasOneUse()) in isFormingBranchFromSelectProfitable()
8134 ICmpInst *Cmp = dyn_cast<ICmpInst>(Branch->getCondition()); in optimizeBranch() local
8135 if (!Cmp || !isa<ConstantInt>(Cmp->getOperand(1)) || !Cmp->hasOneUse()) in optimizeBranch()
8138 Value *X = Cmp->getOperand(0); in optimizeBranch()
8139 APInt CmpC = cast<ConstantInt>(Cmp->getOperand(1))->getValue(); in optimizeBranch()
8152 if (CmpC.isPowerOf2() && Cmp->getPredicate() == ICmpInst::ICMP_ULT && in optimizeBranch()
8160 LLVM_DEBUG(dbgs() << "Converting " << *Cmp << "\n"); in optimizeBranch()
8162 replaceAllUsesWith(Cmp, NewCmp, FreshBBs, IsHugeFunc); in optimizeBranch()
8165 if (Cmp->isEquality() && in optimizeBranch()
8172 Value *NewCmp = Builder.CreateCmp(Cmp->getPredicate(), UI, in optimizeBranch()
8174 LLVM_DEBUG(dbgs() << "Converting " << *Cmp << "\n"); in optimizeBranch()
8176 replaceAllUsesWith(Cmp, NewCmp, FreshBBs, IsHugeFunc); in optimizeBranch()
8244 if (auto *Cmp = dyn_cast<CmpInst>(I)) in optimizeInst() local
8245 if (optimizeCmp(Cmp, ModifiedDT)) in optimizeInst()