Home | History | Annotate | Download | only in Analysis

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;
196 BinaryOperator *Op0 = dyn_cast<BinaryOperator>(LHS);
200 if (Op0 && Op0->getOpcode() == Opcode) {
201 Value *A = Op0->getOperand(0);
202 Value *B = Op0->getOperand(1);
242 if (Op0 && Op0->getOpcode() == Opcode) {
243 Value *A = Op0->getOperand(0);
244 Value *B = Op0->getOperand(1);
520 static Value *SimplifyAddInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
522 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
530 std::swap(Op0, Op1);
539 return Op0;
545 if (match(Op1, m_Sub(m_Value(Y), m_Specific(Op0))) ||
546 match(Op0, m_Sub(m_Value(Y), m_Specific(Op1))))
550 if (match(Op0, m_Not(m_Specific(Op1))) ||
551 match(Op1, m_Not(m_Specific(Op0))))
552 return Constant::getAllOnesValue(Op0->getType());
555 if (MaxRecurse && Op0->getType()->isIntegerTy(1))
556 if (Value *V = SimplifyXorInst(Op0, Op1, Q, MaxRecurse-1))
560 if (Value *V = SimplifyAssociativeBinOp(Instruction::Add, Op0, Op1, Q,
576 Value *llvm::SimplifyAddInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
579 return ::SimplifyAddInst(Op0, Op1, isNSW, isNUW, Query (DL, TLI, DT),
657 static Value *SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
659 if (Constant *CLHS = dyn_cast<Constant>(Op0))
668 if (match(Op0, m_Undef()) || match(Op1, m_Undef()))
669 return UndefValue::get(Op0->getType());
673 return Op0;
676 if (Op0 == Op1)
677 return Constant::getNullValue(Op0->getType());
682 if (MaxRecurse && match(Op0, m_Add(m_Value(X), m_Value(Y)))) { // (X + Y) - Z
703 X = Op0;
725 Z = Op0;
737 if (MaxRecurse && match(Op0, m_Trunc(m_Value(X))) &&
743 if (Value *W = SimplifyTruncInst(V, Op0->getType(), Q, MaxRecurse-1))
748 if (match(Op0, m_PtrToInt(m_Value(X))) &&
751 return ConstantExpr::getIntegerCast(Result, Op0->getType(), true);
754 if (MaxRecurse && Op0->getType()->isIntegerTy(1))
755 if (Value *V = SimplifyXorInst(Op0, Op1, Q, MaxRecurse-1))
770 Value *llvm::SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
773 return ::SimplifySubInst(Op0, Op1, isNSW, isNUW, Query (DL, TLI, DT),
779 static Value *SimplifyFAddInst(Value *Op0, Value *Op1, FastMathFlags FMF,
781 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
789 std::swap(Op0, Op1);
794 return Op0;
798 (FMF.noSignedZeros() || CannotBeNegativeZero(Op0)))
799 return Op0;
805 if (match(Op1, m_FSub(m_AnyZero(), m_Specific(Op0))))
807 else if (match(Op0, m_FSub(m_AnyZero(), m_Specific(Op1))))
808 SubOp = Op0;
813 return Constant::getNullValue(Op0->getType());
821 Op0, Value *Op1, FastMathFlags FMF,
823 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
833 return Op0;
837 (FMF.noSignedZeros() || CannotBeNegativeZero(Op0)))
838 return Op0;
842 if (match(Op0, m_AnyZero())) {
850 if (FMF.noNaNs() && FMF.noInfs() && Op0 == Op1)
851 return Constant::getNullValue(Op0->getType());
857 static Value *SimplifyFMulInst(Value *Op0, Value *Op1,
861 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
869 std::swap(Op0, Op1);
874 return Op0;
885 static Value *SimplifyMulInst(Value *Op0, Value *Op1, const Query &Q,
887 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
895 std::swap(Op0, Op1);
900 return Constant::getNullValue(Op0->getType());
908 return Op0;
912 if (match(Op0, m_Exact(m_IDiv(m_Value(X), m_Specific(Op1)))) || // (X / Y) * Y
913 match(Op1, m_Exact(m_IDiv(m_Value(X), m_Specific(Op0))))) // Y * (X / Y)
917 if (MaxRecurse && Op0->getType()->isIntegerTy(1))
918 if (Value *V = SimplifyAndInst(Op0, Op1, Q, MaxRecurse-1))
922 if (Value *V = SimplifyAssociativeBinOp(Instruction::Mul, Op0, Op1, Q,
927 if (Value *V = ExpandBinOp(Instruction::Mul, Op0, Op1, Instruction::Add,
933 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
934 if (Value *V = ThreadBinOpOverSelect(Instruction::Mul, Op0, Op1, Q,
940 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
941 if (Value *V = ThreadBinOpOverPHI(Instruction::Mul, Op0, Op1, Q,
948 Value *llvm::SimplifyFAddInst(Value *Op0, Value *Op1, FastMathFlags FMF,
951 return ::SimplifyFAddInst(Op0, Op1, FMF, Query (DL, TLI, DT), RecursionLimit);
954 Value *llvm::SimplifyFSubInst(Value *Op0, Value *Op1, FastMathFlags FMF,
957 return ::SimplifyFSubInst(Op0, Op1, FMF, Query (DL, TLI, DT), RecursionLimit);
960 Value *llvm::SimplifyFMulInst(Value *Op0, Value *Op1,
965 return ::SimplifyFMulInst(Op0, Op1, FMF, Query (DL, TLI, DT), RecursionLimit);
968 Value *llvm::SimplifyMulInst(Value *Op0, Value *Op1, const DataLayout *DL,
971 return ::SimplifyMulInst(Op0, Op1, Query (DL, TLI, DT), RecursionLimit);
976 static Value *SimplifyDiv(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1,
978 if (Constant *C0 = dyn_cast<Constant>(Op0)) {
992 if (match(Op0, m_Undef()))
993 return Constant::getNullValue(Op0->getType());
996 if (match(Op0, m_Zero()))
997 return Op0;
1001 return Op0;
1003 if (Op0->getType()->isIntegerTy(1))
1005 return Op0;
1008 if (Op0 == Op1)
1009 return ConstantInt::get(Op0->getType(), 1);
1013 if (match(Op0, m_Mul(m_Value(X), m_Value(Y))) && (X == Op1 || Y == Op1)) {
1015 OverflowingBinaryOperator *Mul = cast<OverflowingBinaryOperator>(Op0);
1027 if ((isSigned && match(Op0, m_SRem(m_Value(), m_Specific(Op1)))) ||
1028 (!isSigned && match(Op0, m_URem(m_Value(), m_Specific(Op1)))))
1029 return Constant::getNullValue(Op0->getType());
1033 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1034 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, Q, MaxRecurse))
1039 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1040 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, Q, MaxRecurse))
1048 static Value *SimplifySDivInst(Value *Op0, Value *Op1, const Query &Q,
1050 if (Value *V = SimplifyDiv(Instruction::SDiv, Op0, Op1, Q, MaxRecurse))
1056 Value *llvm::SimplifySDivInst(Value *Op0, Value *Op1, const DataLayout *DL,
1059 return ::SimplifySDivInst(Op0, Op1, Query (DL, TLI, DT), RecursionLimit);
1064 static Value *SimplifyUDivInst(Value *Op0, Value *Op1, const Query &Q,
1066 if (Value *V = SimplifyDiv(Instruction::UDiv, Op0, Op1, Q, MaxRecurse))
1072 Value *llvm::SimplifyUDivInst(Value *Op0, Value *Op1, const DataLayout *DL,
1075 return ::SimplifyUDivInst(Op0, Op1, Query (DL, TLI, DT), RecursionLimit);
1078 static Value *SimplifyFDivInst(Value *Op0, Value *Op1, const Query &Q,
1081 if (match(Op0, m_Undef()))
1082 return Op0;
1091 Value *llvm::SimplifyFDivInst(Value *Op0, Value *Op1, const DataLayout *DL,
1094 return ::SimplifyFDivInst(Op0, Op1, Query (DL, TLI, DT), RecursionLimit);
1099 static Value *SimplifyRem(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1,
1101 if (Constant *C0 = dyn_cast<Constant>(Op0)) {
1113 if (match(Op0, m_Undef()))
1114 return Constant::getNullValue(Op0->getType());
1117 if (match(Op0, m_Zero()))
1118 return Op0;
1122 return UndefValue::get(Op0->getType());
1126 return Constant::getNullValue(Op0->getType());
1128 if (Op0->getType()->isIntegerTy(1))
1130 return Constant::getNullValue(Op0->getType());
1133 if (Op0 == Op1)
1134 return Constant::getNullValue(Op0->getType());
1138 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1139 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, Q, MaxRecurse))
1144 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1145 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, Q, MaxRecurse))
1153 static Value *SimplifySRemInst(Value *Op0, Value *Op1, const Query &Q,
1155 if (Value *V = SimplifyRem(Instruction::SRem, Op0, Op1, Q, MaxRecurse))
1161 Value *llvm::SimplifySRemInst(Value *Op0, Value *Op1, const DataLayout *DL,
1164 return ::SimplifySRemInst(Op0, Op1, Query (DL, TLI, DT), RecursionLimit);
1169 static Value *SimplifyURemInst(Value *Op0, Value *Op1, const Query &Q,
1171 if (Value *V = SimplifyRem(Instruction::URem, Op0, Op1, Q, MaxRecurse))
1177 Value *llvm::SimplifyURemInst(Value *Op0, Value *Op1, const DataLayout *DL,
1180 return ::SimplifyURemInst(Op0, Op1, Query (DL, TLI, DT), RecursionLimit);
1183 static Value *SimplifyFRemInst(Value *Op0, Value *Op1, const Query &,
1186 if (match(Op0, m_Undef()))
1187 return Op0;
1196 Value *llvm::SimplifyFRemInst(Value *Op0, Value *Op1, const DataLayout *DL,
1199 return ::SimplifyFRemInst(Op0, Op1, Query (DL, TLI, DT), RecursionLimit);
1231 static Value *SimplifyShift(unsigned Opcode, Value *Op0, Value *Op1,
1233 if (Constant *C0 = dyn_cast<Constant>(Op0)) {
1241 if (match(Op0, m_Zero()))
1242 return Op0;
1246 return Op0;
1250 return UndefValue::get(Op0->getType());
1254 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1255 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, Q, MaxRecurse))
1260 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1261 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, Q, MaxRecurse))
1269 static Value *SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
1271 if (Value *V = SimplifyShift(Instruction::Shl, Op0, Op1, Q, MaxRecurse))
1275 if (match(Op0, m_Undef()))
1276 return Constant::getNullValue(Op0->getType());
1280 if (match(Op0, m_Exact(m_Shr(m_Value(X), m_Specific(Op1)))))
1285 Value *llvm::SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
1288 return ::SimplifyShlInst(Op0, Op1, isNSW, isNUW, Query (DL, TLI, DT),
1294 static Value *SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact,
1296 if (Value *V = SimplifyShift(Instruction::LShr, Op0, Op1, Q, MaxRecurse))
1300 if (Op0 == Op1)
1301 return Constant::getNullValue(Op0->getType());
1304 if (match(Op0, m_Undef()))
1305 return Constant::getNullValue(Op0->getType());
1309 if (match(Op0, m_Shl(m_Value(X), m_Specific(Op1))) &&
1310 cast<OverflowingBinaryOperator>(Op0)->hasNoUnsignedWrap())
1316 Value *llvm::SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact,
1320 return ::SimplifyLShrInst(Op0, Op1, isExact, Query (DL, TLI, DT),
1326 static Value *SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
1328 if (Value *V = SimplifyShift(Instruction::AShr, Op0, Op1, Q, MaxRecurse))
1332 if (Op0 == Op1)
1333 return Constant::getNullValue(Op0->getType());
1336 if (match(Op0, m_AllOnes()))
1337 return Op0;
1340 if (match(Op0, m_Undef()))
1341 return Constant::getAllOnesValue(Op0->getType());
1345 if (match(Op0, m_Shl(m_Value(X), m_Specific(Op1))) &&
1346 cast<OverflowingBinaryOperator>(Op0)->hasNoSignedWrap())
1352 Value *llvm::SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
1356 return ::SimplifyAShrInst(Op0, Op1, isExact, Query (DL, TLI, DT),
1362 static Value *SimplifyAndInst(Value *Op0, Value *Op1, const Query &Q,
1364 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
1372 std::swap(Op0, Op1);
1377 return Constant::getNullValue(Op0->getType());
1380 if (Op0 == Op1)
1381 return Op0;
1389 return Op0;
1392 if (match(Op0, m_Not(m_Specific(Op1))) ||
1393 match(Op1, m_Not(m_Specific(Op0))))
1394 return Constant::getNullValue(Op0->getType());
1398 if (match(Op0, m_Or(m_Value(A), m_Value(B))) &&
1404 (A == Op0 || B == Op0))
1405 return Op0;
1408 if (match(Op0, m_Neg(m_Specific(Op1))) ||
1409 match(Op1, m_Neg(m_Specific(Op0)))) {
1410 if (isKnownToBeAPowerOfTwo(Op0, /*OrZero*/true))
1411 return Op0;
1417 if (Value *V = SimplifyAssociativeBinOp(Instruction::And, Op0, Op1, Q,
1422 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Or,
1427 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Xor,
1433 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1434 if (Value *V = ThreadBinOpOverSelect(Instruction::And, Op0, Op1, Q,
1440 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1441 if (Value *V = ThreadBinOpOverPHI(Instruction::And, Op0, Op1, Q,
1448 Value *llvm::SimplifyAndInst(Value *Op0, Value *Op1, const DataLayout *DL,
1451 return ::SimplifyAndInst(Op0, Op1, Query (DL, TLI, DT), RecursionLimit);
1456 static Value *SimplifyOrInst(Value *Op0, Value *Op1, const Query &Q,
1458 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
1466 std::swap(Op0, Op1);
1471 return Constant::getAllOnesValue(Op0->getType());
1474 if (Op0 == Op1)
1475 return Op0;
1479 return Op0;
1486 if (match(Op0, m_Not(m_Specific(Op1))) ||
1487 match(Op1, m_Not(m_Specific(Op0))))
1488 return Constant::getAllOnesValue(Op0->getType());
1492 if (match(Op0, m_And(m_Value(A), m_Value(B))) &&
1498 (A == Op0 || B == Op0))
1499 return Op0;
1502 if (match(Op0, m_Not(m_And(m_Value(A), m_Value(B)))) &&
1508 (A == Op0 || B == Op0))
1509 return Constant::getAllOnesValue(Op0->getType());
1512 if (Value *V = SimplifyAssociativeBinOp(Instruction::Or, Op0, Op1, Q,
1517 if (Value *V = ExpandBinOp(Instruction::Or, Op0, Op1, Instruction::And, Q,
1523 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1524 if (Value *V = ThreadBinOpOverSelect(Instruction::Or, Op0, Op1, Q,
1530 if (match(Op0, m_And(m_Value(A), m_Value(C))) &&
1562 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1563 if (Value *V = ThreadBinOpOverPHI(Instruction::Or, Op0, Op1, Q, MaxRecurse))
1569 Value *llvm::SimplifyOrInst(Value *Op0, Value *Op1, const DataLayout *DL,
1572 return ::SimplifyOrInst(Op0, Op1, Query (DL, TLI, DT), RecursionLimit);
1577 static Value *SimplifyXorInst(Value *Op0, Value *Op1, const Query &Q,
1579 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
1587 std::swap(Op0, Op1);
1596 return Op0;
1599 if (Op0 == Op1)
1600 return Constant::getNullValue(Op0->getType());
1603 if (match(Op0, m_Not(m_Specific(Op1))) ||
1604 match(Op1, m_Not(m_Specific(Op0))))
1605 return Constant::getAllOnesValue(Op0->getType());
1608 if (Value *V = SimplifyAssociativeBinOp(Instruction::Xor, Op0, Op1, Q,
1624 Value *llvm::SimplifyXorInst(Value *Op0, Value *Op1, const DataLayout *DL,
1627 return ::SimplifyXorInst(Op0, Op1, Query (DL, TLI, DT), RecursionLimit);