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),
757 static Value *SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
759 if (Constant *CLHS = dyn_cast<Constant>(Op0))
768 if (match(Op0, m_Undef()) || match(Op1, m_Undef()))
769 return UndefValue::get(Op0->getType());
773 return Op0;
776 if (Op0 == Op1)
777 return Constant::getNullValue(Op0->getType());
782 if (match(Op0, m_Mul(m_Specific(Op1), m_ConstantInt<2>())) ||
783 match(Op0, m_Shl(m_Specific(Op1), m_One())))
789 if (MaxRecurse && match(Op0, m_Add(m_Value(X), m_Value(Y)))) { // (X + Y) - Z
810 X = Op0;
832 Z = Op0;
844 if (MaxRecurse && match(Op0, m_Trunc(m_Value(X))) &&
850 if (Value *W = SimplifyTruncInst(V, Op0->getType(), Q, MaxRecurse-1))
855 if (Q.TD && match(Op0, m_PtrToInt(m_Value(X))) &&
858 return ConstantExpr::getIntegerCast(Result, Op0->getType(), true);
861 if (Value *V = FactorizeBinOp(Instruction::Sub, Op0, Op1, Instruction::Mul,
866 if (MaxRecurse && Op0->getType()->isIntegerTy(1))
867 if (Value *V = SimplifyXorInst(Op0, Op1, Q, MaxRecurse-1))
882 Value *llvm::SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
885 return ::SimplifySubInst(Op0, Op1, isNSW, isNUW, Query (TD, TLI, DT),
891 static Value *SimplifyMulInst(Value *Op0, Value *Op1, const Query &Q,
893 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
901 std::swap(Op0, Op1);
906 return Constant::getNullValue(Op0->getType());
914 return Op0;
918 if (match(Op0, m_Exact(m_IDiv(m_Value(X), m_Specific(Op1)))) || // (X / Y) * Y
919 match(Op1, m_Exact(m_IDiv(m_Value(X), m_Specific(Op0))))) // Y * (X / Y)
923 if (MaxRecurse && Op0->getType()->isIntegerTy(1))
924 if (Value *V = SimplifyAndInst(Op0, Op1, Q, MaxRecurse-1))
928 if (Value *V = SimplifyAssociativeBinOp(Instruction::Mul, Op0, Op1, Q,
933 if (Value *V = ExpandBinOp(Instruction::Mul, Op0, Op1, Instruction::Add,
939 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
940 if (Value *V = ThreadBinOpOverSelect(Instruction::Mul, Op0, Op1, Q,
946 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
947 if (Value *V = ThreadBinOpOverPHI(Instruction::Mul, Op0, Op1, Q,
954 Value *llvm::SimplifyMulInst(Value *Op0, Value *Op1, const TargetData *TD,
957 return ::SimplifyMulInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
962 static Value *SimplifyDiv(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1,
964 if (Constant *C0 = dyn_cast<Constant>(Op0)) {
978 if (match(Op0, m_Undef()))
979 return Constant::getNullValue(Op0->getType());
982 if (match(Op0, m_Zero()))
983 return Op0;
987 return Op0;
989 if (Op0->getType()->isIntegerTy(1))
991 return Op0;
994 if (Op0 == Op1)
995 return ConstantInt::get(Op0->getType(), 1);
999 if (match(Op0, m_Mul(m_Value(X), m_Value(Y))) && (X == Op1 || Y == Op1)) {
1001 OverflowingBinaryOperator *Mul = cast<OverflowingBinaryOperator>(Op0);
1013 if ((isSigned && match(Op0, m_SRem(m_Value(), m_Specific(Op1)))) ||
1014 (!isSigned && match(Op0, m_URem(m_Value(), m_Specific(Op1)))))
1015 return Constant::getNullValue(Op0->getType());
1019 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1020 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, Q, MaxRecurse))
1025 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1026 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, Q, MaxRecurse))
1034 static Value *SimplifySDivInst(Value *Op0, Value *Op1, const Query &Q,
1036 if (Value *V = SimplifyDiv(Instruction::SDiv, Op0, Op1, Q, MaxRecurse))
1042 Value *llvm::SimplifySDivInst(Value *Op0, Value *Op1, const TargetData *TD,
1045 return ::SimplifySDivInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1050 static Value *SimplifyUDivInst(Value *Op0, Value *Op1, const Query &Q,
1052 if (Value *V = SimplifyDiv(Instruction::UDiv, Op0, Op1, Q, MaxRecurse))
1058 Value *llvm::SimplifyUDivInst(Value *Op0, Value *Op1, const TargetData *TD,
1061 return ::SimplifyUDivInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1064 static Value *SimplifyFDivInst(Value *Op0, Value *Op1, const Query &Q,
1067 if (match(Op0, m_Undef()))
1068 return Op0;
1077 Value *llvm::SimplifyFDivInst(Value *Op0, Value *Op1, const TargetData *TD,
1080 return ::SimplifyFDivInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1085 static Value *SimplifyRem(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1,
1087 if (Constant *C0 = dyn_cast<Constant>(Op0)) {
1099 if (match(Op0, m_Undef()))
1100 return Constant::getNullValue(Op0->getType());
1103 if (match(Op0, m_Zero()))
1104 return Op0;
1108 return UndefValue::get(Op0->getType());
1112 return Constant::getNullValue(Op0->getType());
1114 if (Op0->getType()->isIntegerTy(1))
1116 return Constant::getNullValue(Op0->getType());
1119 if (Op0 == Op1)
1120 return Constant::getNullValue(Op0->getType());
1124 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1125 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, Q, MaxRecurse))
1130 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1131 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, Q, MaxRecurse))
1139 static Value *SimplifySRemInst(Value *Op0, Value *Op1, const Query &Q,
1141 if (Value *V = SimplifyRem(Instruction::SRem, Op0, Op1, Q, MaxRecurse))
1147 Value *llvm::SimplifySRemInst(Value *Op0, Value *Op1, const TargetData *TD,
1150 return ::SimplifySRemInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1155 static Value *SimplifyURemInst(Value *Op0, Value *Op1, const Query &Q,
1157 if (Value *V = SimplifyRem(Instruction::URem, Op0, Op1, Q, MaxRecurse))
1163 Value *llvm::SimplifyURemInst(Value *Op0, Value *Op1, const TargetData *TD,
1166 return ::SimplifyURemInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1169 static Value *SimplifyFRemInst(Value *Op0, Value *Op1, const Query &,
1172 if (match(Op0, m_Undef()))
1173 return Op0;
1182 Value *llvm::SimplifyFRemInst(Value *Op0, Value *Op1, const TargetData *TD,
1185 return ::SimplifyFRemInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1190 static Value *SimplifyShift(unsigned Opcode, Value *Op0, Value *Op1,
1192 if (Constant *C0 = dyn_cast<Constant>(Op0)) {
1200 if (match(Op0, m_Zero()))
1201 return Op0;
1205 return Op0;
1214 Op0->getType()->getScalarSizeInBits())
1215 return UndefValue::get(Op0->getType());
1219 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1220 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, Q, MaxRecurse))
1225 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1226 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, Q, MaxRecurse))
1234 static Value *SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
1236 if (Value *V = SimplifyShift(Instruction::Shl, Op0, Op1, Q, MaxRecurse))
1240 if (match(Op0, m_Undef()))
1241 return Constant::getNullValue(Op0->getType());
1245 if (match(Op0, m_Exact(m_Shr(m_Value(X), m_Specific(Op1)))))
1250 Value *llvm::SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
1253 return ::SimplifyShlInst(Op0, Op1, isNSW, isNUW, Query (TD, TLI, DT),
1259 static Value *SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact,
1261 if (Value *V = SimplifyShift(Instruction::LShr, Op0, Op1, Q, MaxRecurse))
1265 if (match(Op0, m_Undef()))
1266 return Constant::getNullValue(Op0->getType());
1270 if (match(Op0, m_Shl(m_Value(X), m_Specific(Op1))) &&
1271 cast<OverflowingBinaryOperator>(Op0)->hasNoUnsignedWrap())
1277 Value *llvm::SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact,
1281 return ::SimplifyLShrInst(Op0, Op1, isExact, Query (TD, TLI, DT),
1287 static Value *SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
1289 if (Value *V = SimplifyShift(Instruction::AShr, Op0, Op1, Q, MaxRecurse))
1293 if (match(Op0, m_AllOnes()))
1294 return Op0;
1297 if (match(Op0, m_Undef()))
1298 return Constant::getAllOnesValue(Op0->getType());
1302 if (match(Op0, m_Shl(m_Value(X), m_Specific(Op1))) &&
1303 cast<OverflowingBinaryOperator>(Op0)->hasNoSignedWrap())
1309 Value *llvm::SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
1313 return ::SimplifyAShrInst(Op0, Op1, isExact, Query (TD, TLI, DT),
1319 static Value *SimplifyAndInst(Value *Op0, Value *Op1, const Query &Q,
1321 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
1329 std::swap(Op0, Op1);
1334 return Constant::getNullValue(Op0->getType());
1337 if (Op0 == Op1)
1338 return Op0;
1346 return Op0;
1349 if (match(Op0, m_Not(m_Specific(Op1))) ||
1350 match(Op1, m_Not(m_Specific(Op0))))
1351 return Constant::getNullValue(Op0->getType());
1355 if (match(Op0, m_Or(m_Value(A), m_Value(B))) &&
1361 (A == Op0 || B == Op0))
1362 return Op0;
1365 if (match(Op0, m_Neg(m_Specific(Op1))) ||
1366 match(Op1, m_Neg(m_Specific(Op0)))) {
1367 if (isPowerOfTwo(Op0, Q.TD, /*OrZero*/true))
1368 return Op0;
1374 if (Value *V = SimplifyAssociativeBinOp(Instruction::And, Op0, Op1, Q,
1379 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Or,
1384 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Xor,
1389 if (Value *V = FactorizeBinOp(Instruction::And, Op0, Op1, Instruction::Or,
1395 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1396 if (Value *V = ThreadBinOpOverSelect(Instruction::And, Op0, Op1, Q,
1402 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1403 if (Value *V = ThreadBinOpOverPHI(Instruction::And, Op0, Op1, Q,
1410 Value *llvm::SimplifyAndInst(Value *Op0, Value *Op1, const TargetData *TD,
1413 return ::SimplifyAndInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1418 static Value *SimplifyOrInst(Value *Op0, Value *Op1, const Query &Q,
1420 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
1428 std::swap(Op0, Op1);
1433 return Constant::getAllOnesValue(Op0->getType());
1436 if (Op0 == Op1)
1437 return Op0;
1441 return Op0;
1448 if (match(Op0, m_Not(m_Specific(Op1))) ||
1449 match(Op1, m_Not(m_Specific(Op0))))
1450 return Constant::getAllOnesValue(Op0->getType());
1454 if (match(Op0, m_And(m_Value(A), m_Value(B))) &&
1460 (A == Op0 || B == Op0))
1461 return Op0;
1464 if (match(Op0, m_Not(m_And(m_Value(A), m_Value(B)))) &&
1470 (A == Op0 || B == Op0))
1471 return Constant::getAllOnesValue(Op0->getType());
1474 if (Value *V = SimplifyAssociativeBinOp(Instruction::Or, Op0, Op1, Q,
1479 if (Value *V = ExpandBinOp(Instruction::Or, Op0, Op1, Instruction::And, Q,
1484 if (Value *V = FactorizeBinOp(Instruction::Or, Op0, Op1, Instruction::And,
1490 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1491 if (Value *V = ThreadBinOpOverSelect(Instruction::Or, Op0, Op1, Q,
1497 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1498 if (Value *V = ThreadBinOpOverPHI(Instruction::Or, Op0, Op1, Q, MaxRecurse))
1504 Value *llvm::SimplifyOrInst(Value *Op0, Value *Op1, const TargetData *TD,
1507 return ::SimplifyOrInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
1512 static Value *SimplifyXorInst(Value *Op0, Value *Op1, const Query &Q,
1514 if (Constant *CLHS = dyn_cast<Constant>(Op0)) {
1522 std::swap(Op0, Op1);
1531 return Op0;
1534 if (Op0 == Op1)
1535 return Constant::getNullValue(Op0->getType());
1538 if (match(Op0, m_Not(m_Specific(Op1))) ||
1539 match(Op1, m_Not(m_Specific(Op0))))
1540 return Constant::getAllOnesValue(Op0->getType());
1543 if (Value *V = SimplifyAssociativeBinOp(Instruction::Xor, Op0, Op1, Q,
1548 if (Value *V = FactorizeBinOp(Instruction::Xor, Op0, Op1, Instruction::And,
1564 Value *llvm::SimplifyXorInst(Value *Op0, Value *Op1, const TargetData *TD,
1567 return ::SimplifyXorInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);