Lines Matching refs:Op0

137   if (BinaryOperator *Op0 = dyn_cast<BinaryOperator>(LHS))
138 if (Op0->getOpcode() == OpcodeToExpand) {
140 Value *A = Op0->getOperand(0), *B = Op0->getOperand(1), *C = RHS;
197 BinaryOperator *Op0 = dyn_cast<BinaryOperator>(LHS);
200 if (!Op0 || Op0->getOpcode() != OpcodeToExtract ||
205 Value *A = Op0->getOperand(0), *B = Op0->getOperand(1);
268 BinaryOperator *Op0 = dyn_cast<BinaryOperator>(LHS);
272 if (Op0 && Op0->getOpcode() == Opcode) {
273 Value *A = Op0->getOperand(0);
274 Value *B = Op0->getOperand(1);
314 if (Op0 && Op0->getOpcode() == Opcode) {
315 Value *A = Op0->getOperand(0);
316 Value *B = Op0->getOperand(1);
592 static Value *SimplifyAddInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
594 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
602 std::swap(Op0, Op1);
611 return Op0;
617 if (match(Op1, m_Sub(m_Value(Y), m_Specific(Op0))) ||
618 match(Op0, m_Sub(m_Value(Y), m_Specific(Op1))))
622 if (match(Op0, m_Not(m_Specific(Op1))) ||
623 match(Op1, m_Not(m_Specific(Op0))))
624 return Constant::getAllOnesValue(Op0->getType());
627 if (MaxRecurse && Op0->getType()->isIntegerTy(1))
628 if (Value *V = SimplifyXorInst(Op0, Op1, Q, MaxRecurse-1))
632 if (Value *V = SimplifyAssociativeBinOp(Instruction::Add, Op0, Op1, Q,
637 if (Value *V = FactorizeBinOp(Instruction::Add, Op0, Op1, Instruction::Mul,
653 Value *llvm::SimplifyAddInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
656 return ::SimplifyAddInst(Op0, Op1, isNSW, isNUW, Query (TD, TLI, DT),
733 static Value *SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
735 if (Constant *CLHS = dyn_cast<Constant>(Op0))
744 if (match(Op0, m_Undef()) || match(Op1, m_Undef()))
745 return UndefValue::get(Op0->getType());
749 return Op0;
752 if (Op0 == Op1)
753 return Constant::getNullValue(Op0->getType());
758 if (match(Op0, m_Mul(m_Specific(Op1), m_ConstantInt<2>())) ||
759 match(Op0, m_Shl(m_Specific(Op1), m_One())))
765 if (MaxRecurse && match(Op0, m_Add(m_Value(X), m_Value(Y)))) { // (X + Y) - Z
786 X = Op0;
808 Z = Op0;
820 if (MaxRecurse && match(Op0, m_Trunc(m_Value(X))) &&
826 if (Value *W = SimplifyTruncInst(V, Op0->getType(), Q, MaxRecurse-1))
831 if (match(Op0, m_PtrToInt(m_Value(X))) &&
834 return ConstantExpr::getIntegerCast(Result, Op0->getType(), true);
837 if (Value *V = FactorizeBinOp(Instruction::Sub, Op0, Op1, Instruction::Mul,
842 if (MaxRecurse && Op0->getType()->isIntegerTy(1))
843 if (Value *V = SimplifyXorInst(Op0, Op1, Q, MaxRecurse-1))
858 Value *llvm::SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
861 return ::SimplifySubInst(Op0, Op1, isNSW, isNUW, Query (TD, TLI, DT),
867 static Value *SimplifyFAddInst(Value *Op0, Value *Op1, FastMathFlags FMF,
869 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
877 std::swap(Op0, Op1);
882 return Op0;
886 (FMF.noSignedZeros() || CannotBeNegativeZero(Op0)))
887 return Op0;
893 if (match(Op1, m_FSub(m_AnyZero(), m_Specific(Op0))))
895 else if (match(Op0, m_FSub(m_AnyZero(), m_Specific(Op1))))
896 SubOp = Op0;
901 return Constant::getNullValue(Op0->getType());
909 static Value *SimplifyFSubInst(Value *Op0, Value *Op1, FastMathFlags FMF,
911 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
921 return Op0;
925 (FMF.noSignedZeros() || CannotBeNegativeZero(Op0)))
926 return Op0;
930 if (match(Op0, m_AnyZero())) {
938 if (FMF.noNaNs() && FMF.noInfs() && Op0 == Op1)
939 return Constant::getNullValue(Op0->getType());
945 static Value *SimplifyFMulInst(Value *Op0, Value *Op1,
949 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
957 std::swap(Op0, Op1);
962 return Op0;
973 static Value *SimplifyMulInst(Value *Op0, Value *Op1, const Query &Q,
975 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
983 std::swap(Op0, Op1);
988 return Constant::getNullValue(Op0->getType());
996 return Op0;
1000 if (match(Op0, m_Exact(m_IDiv(m_Value(X), m_Specific(Op1)))) || // (X / Y) * Y
1001 match(Op1, m_Exact(m_IDiv(m_Value(X), m_Specific(Op0))))) // Y * (X / Y)
1005 if (MaxRecurse && Op0->getType()->isIntegerTy(1))
1006 if (Value *V = SimplifyAndInst(Op0, Op1, Q, MaxRecurse-1))
1010 if (Value *V = SimplifyAssociativeBinOp(Instruction::Mul, Op0, Op1, Q,
1015 if (Value *V = ExpandBinOp(Instruction::Mul, Op0, Op1, Instruction::Add,
1021 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1022 if (Value *V = ThreadBinOpOverSelect(Instruction::Mul, Op0, Op1, Q,
1028 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1029 if (Value *V = ThreadBinOpOverPHI(Instruction::Mul, Op0, Op1, Q,
1036 Value *llvm::SimplifyFAddInst(Value *Op0, Value *Op1, FastMathFlags FMF,
1039 return ::SimplifyFAddInst(Op0, Op1, FMF, Query (TD, TLI, DT), RecursionLimit);
1042 Value *llvm::SimplifyFSubInst(Value *Op0, Value *Op1, FastMathFlags FMF,
1045 return ::SimplifyFSubInst(Op0, Op1, FMF, Query (TD, TLI, DT), RecursionLimit);
1048 Value *llvm::SimplifyFMulInst(Value *Op0, Value *Op1,
1053 return ::SimplifyFMulInst(Op0, Op1, FMF, Query (TD, TLI, DT), RecursionLimit);
1056 Value *llvm::SimplifyMulInst(Value *Op0, Value *Op1, const DataLayout *TD,
1059 return ::SimplifyMulInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1064 static Value *SimplifyDiv(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1,
1066 if (Constant *C0 = dyn_cast<Constant>(Op0)) {
1080 if (match(Op0, m_Undef()))
1081 return Constant::getNullValue(Op0->getType());
1084 if (match(Op0, m_Zero()))
1085 return Op0;
1089 return Op0;
1091 if (Op0->getType()->isIntegerTy(1))
1093 return Op0;
1096 if (Op0 == Op1)
1097 return ConstantInt::get(Op0->getType(), 1);
1101 if (match(Op0, m_Mul(m_Value(X), m_Value(Y))) && (X == Op1 || Y == Op1)) {
1103 OverflowingBinaryOperator *Mul = cast<OverflowingBinaryOperator>(Op0);
1115 if ((isSigned && match(Op0, m_SRem(m_Value(), m_Specific(Op1)))) ||
1116 (!isSigned && match(Op0, m_URem(m_Value(), m_Specific(Op1)))))
1117 return Constant::getNullValue(Op0->getType());
1121 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1122 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, Q, MaxRecurse))
1127 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1128 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, Q, MaxRecurse))
1136 static Value *SimplifySDivInst(Value *Op0, Value *Op1, const Query &Q,
1138 if (Value *V = SimplifyDiv(Instruction::SDiv, Op0, Op1, Q, MaxRecurse))
1144 Value *llvm::SimplifySDivInst(Value *Op0, Value *Op1, const DataLayout *TD,
1147 return ::SimplifySDivInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1152 static Value *SimplifyUDivInst(Value *Op0, Value *Op1, const Query &Q,
1154 if (Value *V = SimplifyDiv(Instruction::UDiv, Op0, Op1, Q, MaxRecurse))
1160 Value *llvm::SimplifyUDivInst(Value *Op0, Value *Op1, const DataLayout *TD,
1163 return ::SimplifyUDivInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1166 static Value *SimplifyFDivInst(Value *Op0, Value *Op1, const Query &Q,
1169 if (match(Op0, m_Undef()))
1170 return Op0;
1179 Value *llvm::SimplifyFDivInst(Value *Op0, Value *Op1, const DataLayout *TD,
1182 return ::SimplifyFDivInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1187 static Value *SimplifyRem(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1,
1189 if (Constant *C0 = dyn_cast<Constant>(Op0)) {
1201 if (match(Op0, m_Undef()))
1202 return Constant::getNullValue(Op0->getType());
1205 if (match(Op0, m_Zero()))
1206 return Op0;
1210 return UndefValue::get(Op0->getType());
1214 return Constant::getNullValue(Op0->getType());
1216 if (Op0->getType()->isIntegerTy(1))
1218 return Constant::getNullValue(Op0->getType());
1221 if (Op0 == Op1)
1222 return Constant::getNullValue(Op0->getType());
1226 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1227 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, Q, MaxRecurse))
1232 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1233 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, Q, MaxRecurse))
1241 static Value *SimplifySRemInst(Value *Op0, Value *Op1, const Query &Q,
1243 if (Value *V = SimplifyRem(Instruction::SRem, Op0, Op1, Q, MaxRecurse))
1249 Value *llvm::SimplifySRemInst(Value *Op0, Value *Op1, const DataLayout *TD,
1252 return ::SimplifySRemInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1257 static Value *SimplifyURemInst(Value *Op0, Value *Op1, const Query &Q,
1259 if (Value *V = SimplifyRem(Instruction::URem, Op0, Op1, Q, MaxRecurse))
1265 Value *llvm::SimplifyURemInst(Value *Op0, Value *Op1, const DataLayout *TD,
1268 return ::SimplifyURemInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1271 static Value *SimplifyFRemInst(Value *Op0, Value *Op1, const Query &,
1274 if (match(Op0, m_Undef()))
1275 return Op0;
1284 Value *llvm::SimplifyFRemInst(Value *Op0, Value *Op1, const DataLayout *TD,
1287 return ::SimplifyFRemInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1292 static Value *SimplifyShift(unsigned Opcode, Value *Op0, Value *Op1,
1294 if (Constant *C0 = dyn_cast<Constant>(Op0)) {
1302 if (match(Op0, m_Zero()))
1303 return Op0;
1307 return Op0;
1316 Op0->getType()->getScalarSizeInBits())
1317 return UndefValue::get(Op0->getType());
1321 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1322 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, Q, MaxRecurse))
1327 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1328 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, Q, MaxRecurse))
1336 static Value *SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
1338 if (Value *V = SimplifyShift(Instruction::Shl, Op0, Op1, Q, MaxRecurse))
1342 if (match(Op0, m_Undef()))
1343 return Constant::getNullValue(Op0->getType());
1347 if (match(Op0, m_Exact(m_Shr(m_Value(X), m_Specific(Op1)))))
1352 Value *llvm::SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
1355 return ::SimplifyShlInst(Op0, Op1, isNSW, isNUW, Query (TD, TLI, DT),
1361 static Value *SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact,
1363 if (Value *V = SimplifyShift(Instruction::LShr, Op0, Op1, Q, MaxRecurse))
1367 if (match(Op0, m_Undef()))
1368 return Constant::getNullValue(Op0->getType());
1372 if (match(Op0, m_Shl(m_Value(X), m_Specific(Op1))) &&
1373 cast<OverflowingBinaryOperator>(Op0)->hasNoUnsignedWrap())
1379 Value *llvm::SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact,
1383 return ::SimplifyLShrInst(Op0, Op1, isExact, Query (TD, TLI, DT),
1389 static Value *SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
1391 if (Value *V = SimplifyShift(Instruction::AShr, Op0, Op1, Q, MaxRecurse))
1395 if (match(Op0, m_AllOnes()))
1396 return Op0;
1399 if (match(Op0, m_Undef()))
1400 return Constant::getAllOnesValue(Op0->getType());
1404 if (match(Op0, m_Shl(m_Value(X), m_Specific(Op1))) &&
1405 cast<OverflowingBinaryOperator>(Op0)->hasNoSignedWrap())
1411 Value *llvm::SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
1415 return ::SimplifyAShrInst(Op0, Op1, isExact, Query (TD, TLI, DT),
1421 static Value *SimplifyAndInst(Value *Op0, Value *Op1, const Query &Q,
1423 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
1431 std::swap(Op0, Op1);
1436 return Constant::getNullValue(Op0->getType());
1439 if (Op0 == Op1)
1440 return Op0;
1448 return Op0;
1451 if (match(Op0, m_Not(m_Specific(Op1))) ||
1452 match(Op1, m_Not(m_Specific(Op0))))
1453 return Constant::getNullValue(Op0->getType());
1457 if (match(Op0, m_Or(m_Value(A), m_Value(B))) &&
1463 (A == Op0 || B == Op0))
1464 return Op0;
1467 if (match(Op0, m_Neg(m_Specific(Op1))) ||
1468 match(Op1, m_Neg(m_Specific(Op0)))) {
1469 if (isKnownToBeAPowerOfTwo(Op0, /*OrZero*/true))
1470 return Op0;
1476 if (Value *V = SimplifyAssociativeBinOp(Instruction::And, Op0, Op1, Q,
1481 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Or,
1486 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Xor,
1491 if (Value *V = FactorizeBinOp(Instruction::And, Op0, Op1, Instruction::Or,
1497 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1498 if (Value *V = ThreadBinOpOverSelect(Instruction::And, Op0, Op1, Q,
1504 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1505 if (Value *V = ThreadBinOpOverPHI(Instruction::And, Op0, Op1, Q,
1512 Value *llvm::SimplifyAndInst(Value *Op0, Value *Op1, const DataLayout *TD,
1515 return ::SimplifyAndInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1520 static Value *SimplifyOrInst(Value *Op0, Value *Op1, const Query &Q,
1522 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
1530 std::swap(Op0, Op1);
1535 return Constant::getAllOnesValue(Op0->getType());
1538 if (Op0 == Op1)
1539 return Op0;
1543 return Op0;
1550 if (match(Op0, m_Not(m_Specific(Op1))) ||
1551 match(Op1, m_Not(m_Specific(Op0))))
1552 return Constant::getAllOnesValue(Op0->getType());
1556 if (match(Op0, m_And(m_Value(A), m_Value(B))) &&
1562 (A == Op0 || B == Op0))
1563 return Op0;
1566 if (match(Op0, m_Not(m_And(m_Value(A), m_Value(B)))) &&
1572 (A == Op0 || B == Op0))
1573 return Constant::getAllOnesValue(Op0->getType());
1576 if (Value *V = SimplifyAssociativeBinOp(Instruction::Or, Op0, Op1, Q,
1581 if (Value *V = ExpandBinOp(Instruction::Or, Op0, Op1, Instruction::And, Q,
1586 if (Value *V = FactorizeBinOp(Instruction::Or, Op0, Op1, Instruction::And,
1592 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1593 if (Value *V = ThreadBinOpOverSelect(Instruction::Or, Op0, Op1, Q,
1599 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1600 if (Value *V = ThreadBinOpOverPHI(Instruction::Or, Op0, Op1, Q, MaxRecurse))
1606 Value *llvm::SimplifyOrInst(Value *Op0, Value *Op1, const DataLayout *TD,
1609 return ::SimplifyOrInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1614 static Value *SimplifyXorInst(Value *Op0, Value *Op1, const Query &Q,
1616 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
1624 std::swap(Op0, Op1);
1633 return Op0;
1636 if (Op0 == Op1)
1637 return Constant::getNullValue(Op0->getType());
1640 if (match(Op0, m_Not(m_Specific(Op1))) ||
1641 match(Op1, m_Not(m_Specific(Op0))))
1642 return Constant::getAllOnesValue(Op0->getType());
1645 if (Value *V = SimplifyAssociativeBinOp(Instruction::Xor, Op0, Op1, Q,
1650 if (Value *V = FactorizeBinOp(Instruction::Xor, Op0, Op1, Instruction::And,
1666 Value *llvm::SimplifyXorInst(Value *Op0, Value *Op1, const DataLayout *TD,
1669 return ::SimplifyXorInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);