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),
734 static Value *SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
736 if (Constant *CLHS = dyn_cast<Constant>(Op0))
745 if (match(Op0, m_Undef()) || match(Op1, m_Undef()))
746 return UndefValue::get(Op0->getType());
750 return Op0;
753 if (Op0 == Op1)
754 return Constant::getNullValue(Op0->getType());
759 if (match(Op0, m_Mul(m_Specific(Op1), m_ConstantInt<2>())) ||
760 match(Op0, m_Shl(m_Specific(Op1), m_One())))
766 if (MaxRecurse && match(Op0, m_Add(m_Value(X), m_Value(Y)))) { // (X + Y) - Z
787 X = Op0;
809 Z = Op0;
821 if (MaxRecurse && match(Op0, m_Trunc(m_Value(X))) &&
827 if (Value *W = SimplifyTruncInst(V, Op0->getType(), Q, MaxRecurse-1))
832 if (match(Op0, m_PtrToInt(m_Value(X))) &&
835 return ConstantExpr::getIntegerCast(Result, Op0->getType(), true);
838 if (Value *V = FactorizeBinOp(Instruction::Sub, Op0, Op1, Instruction::Mul,
843 if (MaxRecurse && Op0->getType()->isIntegerTy(1))
844 if (Value *V = SimplifyXorInst(Op0, Op1, Q, MaxRecurse-1))
859 Value *llvm::SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
862 return ::SimplifySubInst(Op0, Op1, isNSW, isNUW, Query (TD, TLI, DT),
868 static Value *SimplifyFAddInst(Value *Op0, Value *Op1, FastMathFlags FMF,
870 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
878 std::swap(Op0, Op1);
883 return Op0;
887 (FMF.noSignedZeros() || CannotBeNegativeZero(Op0)))
888 return Op0;
894 if (match(Op1, m_FSub(m_AnyZero(), m_Specific(Op0))))
896 else if (match(Op0, m_FSub(m_AnyZero(), m_Specific(Op1))))
897 SubOp = Op0;
902 return Constant::getNullValue(Op0->getType());
910 static Value *SimplifyFSubInst(Value *Op0, Value *Op1, FastMathFlags FMF,
912 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
922 return Op0;
926 (FMF.noSignedZeros() || CannotBeNegativeZero(Op0)))
927 return Op0;
931 if (match(Op0, m_AnyZero())) {
939 if (FMF.noNaNs() && FMF.noInfs() && Op0 == Op1)
940 return Constant::getNullValue(Op0->getType());
946 static Value *SimplifyFMulInst(Value *Op0, Value *Op1,
950 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
958 std::swap(Op0, Op1);
963 return Op0;
974 static Value *SimplifyMulInst(Value *Op0, Value *Op1, const Query &Q,
976 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
984 std::swap(Op0, Op1);
989 return Constant::getNullValue(Op0->getType());
997 return Op0;
1001 if (match(Op0, m_Exact(m_IDiv(m_Value(X), m_Specific(Op1)))) || // (X / Y) * Y
1002 match(Op1, m_Exact(m_IDiv(m_Value(X), m_Specific(Op0))))) // Y * (X / Y)
1006 if (MaxRecurse && Op0->getType()->isIntegerTy(1))
1007 if (Value *V = SimplifyAndInst(Op0, Op1, Q, MaxRecurse-1))
1011 if (Value *V = SimplifyAssociativeBinOp(Instruction::Mul, Op0, Op1, Q,
1016 if (Value *V = ExpandBinOp(Instruction::Mul, Op0, Op1, Instruction::Add,
1022 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1023 if (Value *V = ThreadBinOpOverSelect(Instruction::Mul, Op0, Op1, Q,
1029 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1030 if (Value *V = ThreadBinOpOverPHI(Instruction::Mul, Op0, Op1, Q,
1037 Value *llvm::SimplifyFAddInst(Value *Op0, Value *Op1, FastMathFlags FMF,
1040 return ::SimplifyFAddInst(Op0, Op1, FMF, Query (TD, TLI, DT), RecursionLimit);
1043 Value *llvm::SimplifyFSubInst(Value *Op0, Value *Op1, FastMathFlags FMF,
1046 return ::SimplifyFSubInst(Op0, Op1, FMF, Query (TD, TLI, DT), RecursionLimit);
1049 Value *llvm::SimplifyFMulInst(Value *Op0, Value *Op1,
1054 return ::SimplifyFMulInst(Op0, Op1, FMF, Query (TD, TLI, DT), RecursionLimit);
1057 Value *llvm::SimplifyMulInst(Value *Op0, Value *Op1, const DataLayout *TD,
1060 return ::SimplifyMulInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1065 static Value *SimplifyDiv(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1,
1067 if (Constant *C0 = dyn_cast<Constant>(Op0)) {
1081 if (match(Op0, m_Undef()))
1082 return Constant::getNullValue(Op0->getType());
1085 if (match(Op0, m_Zero()))
1086 return Op0;
1090 return Op0;
1092 if (Op0->getType()->isIntegerTy(1))
1094 return Op0;
1097 if (Op0 == Op1)
1098 return ConstantInt::get(Op0->getType(), 1);
1102 if (match(Op0, m_Mul(m_Value(X), m_Value(Y))) && (X == Op1 || Y == Op1)) {
1104 OverflowingBinaryOperator *Mul = cast<OverflowingBinaryOperator>(Op0);
1116 if ((isSigned && match(Op0, m_SRem(m_Value(), m_Specific(Op1)))) ||
1117 (!isSigned && match(Op0, m_URem(m_Value(), m_Specific(Op1)))))
1118 return Constant::getNullValue(Op0->getType());
1122 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1123 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, Q, MaxRecurse))
1128 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1129 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, Q, MaxRecurse))
1137 static Value *SimplifySDivInst(Value *Op0, Value *Op1, const Query &Q,
1139 if (Value *V = SimplifyDiv(Instruction::SDiv, Op0, Op1, Q, MaxRecurse))
1145 Value *llvm::SimplifySDivInst(Value *Op0, Value *Op1, const DataLayout *TD,
1148 return ::SimplifySDivInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1153 static Value *SimplifyUDivInst(Value *Op0, Value *Op1, const Query &Q,
1155 if (Value *V = SimplifyDiv(Instruction::UDiv, Op0, Op1, Q, MaxRecurse))
1161 Value *llvm::SimplifyUDivInst(Value *Op0, Value *Op1, const DataLayout *TD,
1164 return ::SimplifyUDivInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1167 static Value *SimplifyFDivInst(Value *Op0, Value *Op1, const Query &Q,
1170 if (match(Op0, m_Undef()))
1171 return Op0;
1180 Value *llvm::SimplifyFDivInst(Value *Op0, Value *Op1, const DataLayout *TD,
1183 return ::SimplifyFDivInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1188 static Value *SimplifyRem(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1,
1190 if (Constant *C0 = dyn_cast<Constant>(Op0)) {
1202 if (match(Op0, m_Undef()))
1203 return Constant::getNullValue(Op0->getType());
1206 if (match(Op0, m_Zero()))
1207 return Op0;
1211 return UndefValue::get(Op0->getType());
1215 return Constant::getNullValue(Op0->getType());
1217 if (Op0->getType()->isIntegerTy(1))
1219 return Constant::getNullValue(Op0->getType());
1222 if (Op0 == Op1)
1223 return Constant::getNullValue(Op0->getType());
1227 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1228 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, Q, MaxRecurse))
1233 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1234 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, Q, MaxRecurse))
1242 static Value *SimplifySRemInst(Value *Op0, Value *Op1, const Query &Q,
1244 if (Value *V = SimplifyRem(Instruction::SRem, Op0, Op1, Q, MaxRecurse))
1250 Value *llvm::SimplifySRemInst(Value *Op0, Value *Op1, const DataLayout *TD,
1253 return ::SimplifySRemInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1258 static Value *SimplifyURemInst(Value *Op0, Value *Op1, const Query &Q,
1260 if (Value *V = SimplifyRem(Instruction::URem, Op0, Op1, Q, MaxRecurse))
1266 Value *llvm::SimplifyURemInst(Value *Op0, Value *Op1, const DataLayout *TD,
1269 return ::SimplifyURemInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1272 static Value *SimplifyFRemInst(Value *Op0, Value *Op1, const Query &,
1275 if (match(Op0, m_Undef()))
1276 return Op0;
1285 Value *llvm::SimplifyFRemInst(Value *Op0, Value *Op1, const DataLayout *TD,
1288 return ::SimplifyFRemInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1293 static Value *SimplifyShift(unsigned Opcode, Value *Op0, Value *Op1,
1295 if (Constant *C0 = dyn_cast<Constant>(Op0)) {
1303 if (match(Op0, m_Zero()))
1304 return Op0;
1308 return Op0;
1317 Op0->getType()->getScalarSizeInBits())
1318 return UndefValue::get(Op0->getType());
1322 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1323 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, Q, MaxRecurse))
1328 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1329 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, Q, MaxRecurse))
1337 static Value *SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
1339 if (Value *V = SimplifyShift(Instruction::Shl, Op0, Op1, Q, MaxRecurse))
1343 if (match(Op0, m_Undef()))
1344 return Constant::getNullValue(Op0->getType());
1348 if (match(Op0, m_Exact(m_Shr(m_Value(X), m_Specific(Op1)))))
1353 Value *llvm::SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
1356 return ::SimplifyShlInst(Op0, Op1, isNSW, isNUW, Query (TD, TLI, DT),
1362 static Value *SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact,
1364 if (Value *V = SimplifyShift(Instruction::LShr, Op0, Op1, Q, MaxRecurse))
1368 if (Op0 == Op1)
1369 return Constant::getNullValue(Op0->getType());
1372 if (match(Op0, m_Undef()))
1373 return Constant::getNullValue(Op0->getType());
1377 if (match(Op0, m_Shl(m_Value(X), m_Specific(Op1))) &&
1378 cast<OverflowingBinaryOperator>(Op0)->hasNoUnsignedWrap())
1384 Value *llvm::SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact,
1388 return ::SimplifyLShrInst(Op0, Op1, isExact, Query (TD, TLI, DT),
1394 static Value *SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
1396 if (Value *V = SimplifyShift(Instruction::AShr, Op0, Op1, Q, MaxRecurse))
1400 if (Op0 == Op1)
1401 return Constant::getNullValue(Op0->getType());
1404 if (match(Op0, m_AllOnes()))
1405 return Op0;
1408 if (match(Op0, m_Undef()))
1409 return Constant::getAllOnesValue(Op0->getType());
1413 if (match(Op0, m_Shl(m_Value(X), m_Specific(Op1))) &&
1414 cast<OverflowingBinaryOperator>(Op0)->hasNoSignedWrap())
1420 Value *llvm::SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
1424 return ::SimplifyAShrInst(Op0, Op1, isExact, Query (TD, TLI, DT),
1430 static Value *SimplifyAndInst(Value *Op0, Value *Op1, const Query &Q,
1432 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
1440 std::swap(Op0, Op1);
1445 return Constant::getNullValue(Op0->getType());
1448 if (Op0 == Op1)
1449 return Op0;
1457 return Op0;
1460 if (match(Op0, m_Not(m_Specific(Op1))) ||
1461 match(Op1, m_Not(m_Specific(Op0))))
1462 return Constant::getNullValue(Op0->getType());
1466 if (match(Op0, m_Or(m_Value(A), m_Value(B))) &&
1472 (A == Op0 || B == Op0))
1473 return Op0;
1476 if (match(Op0, m_Neg(m_Specific(Op1))) ||
1477 match(Op1, m_Neg(m_Specific(Op0)))) {
1478 if (isKnownToBeAPowerOfTwo(Op0, /*OrZero*/true))
1479 return Op0;
1485 if (Value *V = SimplifyAssociativeBinOp(Instruction::And, Op0, Op1, Q,
1490 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Or,
1495 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Xor,
1500 if (Value *V = FactorizeBinOp(Instruction::And, Op0, Op1, Instruction::Or,
1506 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1507 if (Value *V = ThreadBinOpOverSelect(Instruction::And, Op0, Op1, Q,
1513 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1514 if (Value *V = ThreadBinOpOverPHI(Instruction::And, Op0, Op1, Q,
1521 Value *llvm::SimplifyAndInst(Value *Op0, Value *Op1, const DataLayout *TD,
1524 return ::SimplifyAndInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1529 static Value *SimplifyOrInst(Value *Op0, Value *Op1, const Query &Q,
1531 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
1539 std::swap(Op0, Op1);
1544 return Constant::getAllOnesValue(Op0->getType());
1547 if (Op0 == Op1)
1548 return Op0;
1552 return Op0;
1559 if (match(Op0, m_Not(m_Specific(Op1))) ||
1560 match(Op1, m_Not(m_Specific(Op0))))
1561 return Constant::getAllOnesValue(Op0->getType());
1565 if (match(Op0, m_And(m_Value(A), m_Value(B))) &&
1571 (A == Op0 || B == Op0))
1572 return Op0;
1575 if (match(Op0, m_Not(m_And(m_Value(A), m_Value(B)))) &&
1581 (A == Op0 || B == Op0))
1582 return Constant::getAllOnesValue(Op0->getType());
1585 if (Value *V = SimplifyAssociativeBinOp(Instruction::Or, Op0, Op1, Q,
1590 if (Value *V = ExpandBinOp(Instruction::Or, Op0, Op1, Instruction::And, Q,
1595 if (Value *V = FactorizeBinOp(Instruction::Or, Op0, Op1, Instruction::And,
1601 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1602 if (Value *V = ThreadBinOpOverSelect(Instruction::Or, Op0, Op1, Q,
1608 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1609 if (Value *V = ThreadBinOpOverPHI(Instruction::Or, Op0, Op1, Q, MaxRecurse))
1615 Value *llvm::SimplifyOrInst(Value *Op0, Value *Op1, const DataLayout *TD,
1618 return ::SimplifyOrInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1623 static Value *SimplifyXorInst(Value *Op0, Value *Op1, const Query &Q,
1625 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
1633 std::swap(Op0, Op1);
1642 return Op0;
1645 if (Op0 == Op1)
1646 return Constant::getNullValue(Op0->getType());
1649 if (match(Op0, m_Not(m_Specific(Op1))) ||
1650 match(Op1, m_Not(m_Specific(Op0))))
1651 return Constant::getAllOnesValue(Op0->getType());
1654 if (Value *V = SimplifyAssociativeBinOp(Instruction::Xor, Op0, Op1, Q,
1659 if (Value *V = FactorizeBinOp(Instruction::Xor, Op0, Op1, Instruction::And,
1675 Value *llvm::SimplifyXorInst(Value *Op0, Value *Op1, const DataLayout *TD,
1678 return ::SimplifyXorInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);