Lines Matching refs:BO

248   APInt findInEitherOperand(BinaryOperator *BO, bool SignExtended,
290 /// of binary operator BO for a constant offset.
292 /// \p SignExtended Whether BO is surrounded by sext
293 /// \p ZeroExtended Whether BO is surrounded by zext
294 /// \p NonNegative Whether BO is known to be non-negative, e.g., an in-bound
296 bool CanTraceInto(bool SignExtended, bool ZeroExtended, BinaryOperator *BO,
447 BinaryOperator *BO,
452 if (BO->getOpcode() != Instruction::Add &&
453 BO->getOpcode() != Instruction::Sub &&
454 BO->getOpcode() != Instruction::Or) {
458 Value *LHS = BO->getOperand(0), *RHS = BO->getOperand(1);
461 if (BO->getOpcode() == Instruction::Or &&
462 !haveNoCommonBitsSet(LHS, RHS, DL, nullptr, BO, DT))
465 // In addition, tracing into BO requires that its surrounding s/zext (if
468 // Suppose BO = A op B.
472 // 0 | 1 | zext(BO) == zext(A) op zext(B)
473 // 1 | 0 | sext(BO) == sext(A) op sext(B)
474 // 1 | 1 | zext(sext(BO)) ==
476 if (BO->getOpcode() == Instruction::Add && !ZeroExtended && NonNegative) {
497 if (BO->getOpcode() == Instruction::Add ||
498 BO->getOpcode() == Instruction::Sub) {
499 if (SignExtended && !BO->hasNoSignedWrap())
501 if (ZeroExtended && !BO->hasNoUnsignedWrap())
508 APInt ConstantOffsetExtractor::findInEitherOperand(BinaryOperator *BO,
511 // BO being non-negative does not shed light on whether its operands are
513 APInt ConstantOffset = find(BO->getOperand(0), SignExtended, ZeroExtended,
521 ConstantOffset = find(BO->getOperand(1), SignExtended, ZeroExtended,
525 if (BO->getOpcode() == Instruction::Sub)
545 } else if (BinaryOperator *BO = dyn_cast<BinaryOperator>(V)) {
547 if (CanTraceInto(SignExtended, ZeroExtended, BO, NonNegative))
548 ConstantOffset = findInEitherOperand(BO, SignExtended, ZeroExtended);
621 BinaryOperator *BO = cast<BinaryOperator>(U);
622 // OpNo = which operand of BO is UserChain[ChainIndex - 1]
623 unsigned OpNo = (BO->getOperand(0) == UserChain[ChainIndex - 1] ? 0 : 1);
624 Value *TheOther = applyExts(BO->getOperand(1 - OpNo));
629 NewBO = BinaryOperator::Create(BO->getOpcode(), NextInChain, TheOther,
630 BO->getName(), IP);
632 NewBO = BinaryOperator::Create(BO->getOpcode(), TheOther, NextInChain,
633 BO->getName(), IP);
644 BinaryOperator *BO = cast<BinaryOperator>(UserChain[ChainIndex]);
645 assert(BO->getNumUses() <= 1 &&
650 unsigned OpNo = (BO->getOperand(0) == UserChain[ChainIndex - 1] ? 0 : 1);
651 assert(BO->getOperand(OpNo) == UserChain[ChainIndex - 1]);
653 Value *TheOther = BO->getOperand(1 - OpNo);
658 if (CI->isZero() && !(BO->getOpcode() == Instruction::Sub && OpNo == 0))
662 BinaryOperator::BinaryOps NewOp = BO->getOpcode();
663 if (BO->getOpcode() == Instruction::Or) {
686 NewBO->takeName(BO);
1223 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(FirstOffsetDef)) {
1224 unsigned opc = BO->getOpcode();
1226 (isa<ConstantInt>(BO->getOperand(0)) ||
1227 isa<ConstantInt>(BO->getOperand(1))))