Lines Matching defs:BO

267   APInt findInEitherOperand(BinaryOperator *BO, bool SignExtended,
313 /// of binary operator BO for a constant offset.
315 /// \p SignExtended Whether BO is surrounded by sext
316 /// \p ZeroExtended Whether BO is surrounded by zext
317 /// \p NonNegative Whether BO is known to be non-negative, e.g., an in-bound
319 bool CanTraceInto(bool SignExtended, bool ZeroExtended, BinaryOperator *BO,
513 BinaryOperator *BO,
518 if (BO->getOpcode() != Instruction::Add &&
519 BO->getOpcode() != Instruction::Sub &&
520 BO->getOpcode() != Instruction::Or) {
524 Value *LHS = BO->getOperand(0), *RHS = BO->getOperand(1);
527 if (BO->getOpcode() == Instruction::Or &&
528 !cast<PossiblyDisjointInst>(BO)->isDisjoint())
534 if (ZeroExtended && !SignExtended && BO->getOpcode() == Instruction::Sub)
537 // In addition, tracing into BO requires that its surrounding s/zext (if
540 // Suppose BO = A op B.
544 // 0 | 1 | zext(BO) == zext(A) op zext(B)
545 // 1 | 0 | sext(BO) == sext(A) op sext(B)
546 // 1 | 1 | zext(sext(BO)) ==
548 if (BO->getOpcode() == Instruction::Add && !ZeroExtended && NonNegative) {
569 if (BO->getOpcode() == Instruction::Add ||
570 BO->getOpcode() == Instruction::Sub) {
571 if (SignExtended && !BO->hasNoSignedWrap())
573 if (ZeroExtended && !BO->hasNoUnsignedWrap())
580 APInt ConstantOffsetExtractor::findInEitherOperand(BinaryOperator *BO,
586 // BO being non-negative does not shed light on whether its operands are
588 APInt ConstantOffset = find(BO->getOperand(0), SignExtended, ZeroExtended,
601 ConstantOffset = find(BO->getOperand(1), SignExtended, ZeroExtended,
605 if (BO->getOpcode() == Instruction::Sub)
630 } else if (BinaryOperator *BO = dyn_cast<BinaryOperator>(V)) {
632 if (CanTraceInto(SignExtended, ZeroExtended, BO, NonNegative))
633 ConstantOffset = findInEitherOperand(BO, SignExtended, ZeroExtended);
712 BinaryOperator *BO = cast<BinaryOperator>(U);
713 // OpNo = which operand of BO is UserChain[ChainIndex - 1]
714 unsigned OpNo = (BO->getOperand(0) == UserChain[ChainIndex - 1] ? 0 : 1);
715 Value *TheOther = applyExts(BO->getOperand(1 - OpNo));
720 NewBO = BinaryOperator::Create(BO->getOpcode(), NextInChain, TheOther,
721 BO->getName(), IP);
723 NewBO = BinaryOperator::Create(BO->getOpcode(), TheOther, NextInChain,
724 BO->getName(), IP);
735 BinaryOperator *BO = cast<BinaryOperator>(UserChain[ChainIndex]);
736 assert((BO->use_empty() || BO->hasOneUse()) &&
741 unsigned OpNo = (BO->getOperand(0) == UserChain[ChainIndex - 1] ? 0 : 1);
742 assert(BO->getOperand(OpNo) == UserChain[ChainIndex - 1]);
744 Value *TheOther = BO->getOperand(1 - OpNo);
749 if (CI->isZero() && !(BO->getOpcode() == Instruction::Sub && OpNo == 0))
753 BinaryOperator::BinaryOps NewOp = BO->getOpcode();
754 if (BO->getOpcode() == Instruction::Or) {
777 NewBO->takeName(BO);
1345 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(FirstOffsetDef)) {
1346 unsigned opc = BO->getOpcode();
1348 (isa<ConstantInt>(BO->getOperand(0)) ||
1349 isa<ConstantInt>(BO->getOperand(1))))