Home | History | Annotate | Download | only in Analysis

Lines Matching defs:Op1

129   if (BinaryOperator *Op1 = dyn_cast<BinaryOperator>(RHS))
130 if (Op1->getOpcode() == OpcodeToExpand) {
132 Value *A = LHS, *B = Op1->getOperand(0), *C = Op1->getOperand(1);
168 BinaryOperator *Op1 = dyn_cast<BinaryOperator>(RHS);
171 !Op1 || Op1->getOpcode() != OpcodeToExtract)
176 Value *C = Op1->getOperand(0), *D = Op1->getOperand(1);
241 BinaryOperator *Op1 = dyn_cast<BinaryOperator>(RHS);
263 if (Op1 && Op1->getOpcode() == Opcode) {
265 Value *B = Op1->getOperand(0);
266 Value *C = Op1->getOperand(1);
305 if (Op1 && Op1->getOpcode() == Opcode) {
307 Value *B = Op1->getOperand(0);
308 Value *C = Op1->getOperand(1);
542 static Value *SimplifyAddInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
546 if (Constant *CRHS = dyn_cast<Constant>(Op1)) {
553 std::swap(Op0, Op1);
557 if (match(Op1, m_Undef()))
558 return Op1;
561 if (match(Op1, m_Zero()))
568 if (match(Op1, m_Sub(m_Value(Y), m_Specific(Op0))) ||
569 match(Op0, m_Sub(m_Value(Y), m_Specific(Op1))))
573 if (match(Op0, m_Not(m_Specific(Op1))) ||
574 match(Op1, m_Not(m_Specific(Op0))))
579 if (Value *V = SimplifyXorInst(Op0, Op1, TD, DT, MaxRecurse-1))
583 if (Value *V = SimplifyAssociativeBinOp(Instruction::Add, Op0, Op1, TD, DT,
588 if (Value *V = FactorizeBinOp(Instruction::Add, Op0, Op1, Instruction::Mul,
604 Value *llvm::SimplifyAddInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
606 return ::SimplifyAddInst(Op0, Op1, isNSW, isNUW, TD, DT, RecursionLimit);
611 static Value *SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
615 if (Constant *CRHS = dyn_cast<Constant>(Op1)) {
623 if (match(Op0, m_Undef()) || match(Op1, m_Undef()))
627 if (match(Op1, m_Zero()))
631 if (Op0 == Op1)
637 if (match(Op0, m_Mul(m_Specific(Op1), m_ConstantInt<2>())) ||
638 match(Op0, m_Shl(m_Specific(Op1), m_One())))
639 return Op1;
643 Value *Y = 0, *Z = Op1;
668 if (MaxRecurse && match(Op1, m_Add(m_Value(Y), m_Value(Z)))) { // X - (Y + Z)
692 if (MaxRecurse && match(Op1, m_Sub(m_Value(X), m_Value(Y)))) // Z - (X - Y)
704 if (Value *V = FactorizeBinOp(Instruction::Sub, Op0, Op1, Instruction::Mul,
710 if (Value *V = SimplifyXorInst(Op0, Op1, TD, DT, MaxRecurse-1))
725 Value *llvm::SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
727 return ::SimplifySubInst(Op0, Op1, isNSW, isNUW, TD, DT, RecursionLimit);
732 static Value *SimplifyMulInst(Value *Op0, Value *Op1, const TargetData *TD,
735 if (Constant *CRHS = dyn_cast<Constant>(Op1)) {
742 std::swap(Op0, Op1);
746 if (match(Op1, m_Undef()))
750 if (match(Op1, m_Zero()))
751 return Op1;
754 if (match(Op1, m_One()))
759 if ((match(Op0, m_IDiv(m_Value(X), m_Value(Y))) && Y == Op1) || // (X / Y) * Y
760 (match(Op1, m_IDiv(m_Value(X), m_Value(Y))) && Y == Op0)) { // Y * (X / Y)
761 BinaryOperator *Div = cast<BinaryOperator>(Y == Op1 ? Op0 : Op1);
768 if (Value *V = SimplifyAndInst(Op0, Op1, TD, DT, MaxRecurse-1))
772 if (Value *V = SimplifyAssociativeBinOp(Instruction::Mul, Op0, Op1, TD, DT,
777 if (Value *V = ExpandBinOp(Instruction::Mul, Op0, Op1, Instruction::Add,
783 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
784 if (Value *V = ThreadBinOpOverSelect(Instruction::Mul, Op0, Op1, TD, DT,
790 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
791 if (Value *V = ThreadBinOpOverPHI(Instruction::Mul, Op0, Op1, TD, DT,
798 Value *llvm::SimplifyMulInst(Value *Op0, Value *Op1, const TargetData *TD,
800 return ::SimplifyMulInst(Op0, Op1, TD, DT, RecursionLimit);
805 Op1,
809 if (Constant *C1 = dyn_cast<Constant>(Op1)) {
818 if (match(Op1, m_Undef()))
819 return Op1;
830 if (match(Op1, m_One()))
838 if (Op0 == Op1)
843 if (match(Op0, m_Mul(m_Value(X), m_Value(Y))) && (X == Op1 || Y == Op1)) {
844 if (Y != Op1) std::swap(X, Y); // Ensure expression is (X * Y) / Y, Y = Op1
857 if ((isSigned && match(Op0, m_SRem(m_Value(), m_Specific(Op1)))) ||
858 (!isSigned && match(Op0, m_URem(m_Value(), m_Specific(Op1)))))
863 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
864 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, TD, DT, MaxRecurse))
869 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
870 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, TD, DT, MaxRecurse))
878 static Value *SimplifySDivInst(Value *Op0, Value *Op1, const TargetData *TD,
880 if (Value *V = SimplifyDiv(Instruction::SDiv, Op0, Op1, TD, DT, MaxRecurse))
886 Value *llvm::SimplifySDivInst(Value *Op0, Value *Op1, const TargetData *TD,
888 return ::SimplifySDivInst(Op0, Op1, TD, DT, RecursionLimit);
893 static Value *SimplifyUDivInst(Value *Op0, Value *Op1, const TargetData *TD,
895 if (Value *V = SimplifyDiv(Instruction::UDiv, Op0, Op1, TD, DT, MaxRecurse))
901 Value *llvm::SimplifyUDivInst(Value *Op0, Value *Op1, const TargetData *TD,
903 return ::SimplifyUDivInst(Op0, Op1, TD, DT, RecursionLimit);
906 static Value *SimplifyFDivInst(Value *Op0, Value *Op1, const TargetData *,
913 if (match(Op1, m_Undef()))
914 return Op1;
919 Value *llvm::SimplifyFDivInst(Value *Op0, Value *Op1, const TargetData *TD,
921 return ::SimplifyFDivInst(Op0, Op1, TD, DT, RecursionLimit);
926 static Value *SimplifyRem(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1,
930 if (Constant *C1 = dyn_cast<Constant>(Op1)) {
937 if (match(Op1, m_Undef()))
938 return Op1;
949 if (match(Op1, m_Zero()))
953 if (match(Op1, m_One()))
961 if (Op0 == Op1)
966 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
967 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, TD, DT, MaxRecurse))
972 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
973 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, TD, DT, MaxRecurse))
981 static Value *SimplifySRemInst(Value *Op0, Value *Op1, const TargetData *TD,
983 if (Value *V = SimplifyRem(Instruction::SRem, Op0, Op1, TD, DT, MaxRecurse))
989 Value *llvm::SimplifySRemInst(Value *Op0, Value *Op1, const TargetData *TD,
991 return ::SimplifySRemInst(Op0, Op1, TD, DT, RecursionLimit);
996 static Value *SimplifyURemInst(Value *Op0, Value *Op1, const TargetData *TD,
998 if (Value *V = SimplifyRem(Instruction::URem, Op0, Op1, TD, DT, MaxRecurse))
1004 Value *llvm::SimplifyURemInst(Value *Op0, Value *Op1, const TargetData *TD,
1006 return ::SimplifyURemInst(Op0, Op1, TD, DT, RecursionLimit);
1009 static Value *SimplifyFRemInst(Value *Op0, Value *Op1, const TargetData *,
1016 if (match(Op1, m_Undef()))
1017 return Op1;
1022 Value *llvm::SimplifyFRemInst(Value *Op0, Value *Op1, const TargetData *TD,
1024 return ::SimplifyFRemInst(Op0, Op1, TD, DT, RecursionLimit);
1029 static Value *SimplifyShift(unsigned Opcode, Value *Op0, Value *Op1,
1033 if (Constant *C1 = dyn_cast<Constant>(Op1)) {
1044 if (match(Op1, m_Zero()))
1048 if (match(Op1, m_Undef()))
1049 return Op1;
1052 if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1))
1059 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1060 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, TD, DT, MaxRecurse))
1065 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1066 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, TD, DT, MaxRecurse))
1074 static Value *SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
1077 if (Value *V = SimplifyShift(Instruction::Shl, Op0, Op1, TD, DT, MaxRecurse))
1086 if (match(Op0, m_Shr(m_Value(X), m_Specific(Op1))) &&
1092 Value *llvm::SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
1094 return ::SimplifyShlInst(Op0, Op1, isNSW, isNUW, TD, DT, RecursionLimit);
1099 static Value *SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact,
1102 if (Value *V = SimplifyShift(Instruction::LShr, Op0, Op1, TD, DT, MaxRecurse))
1111 if (match(Op0, m_Shl(m_Value(X), m_Specific(Op1))) &&
1118 Value *llvm::SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact,
1120 return ::SimplifyLShrInst(Op0, Op1, isExact, TD, DT, RecursionLimit);
1125 static Value *SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
1128 if (Value *V = SimplifyShift(Instruction::AShr, Op0, Op1, TD, DT, MaxRecurse))
1141 if (match(Op0, m_Shl(m_Value(X), m_Specific(Op1))) &&
1148 Value *llvm::SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
1150 return ::SimplifyAShrInst(Op0, Op1, isExact, TD, DT, RecursionLimit);
1155 static Value *SimplifyAndInst(Value *Op0, Value *Op1, const TargetData *TD,
1158 if (Constant *CRHS = dyn_cast<Constant>(Op1)) {
1165 std::swap(Op0, Op1);
1169 if (match(Op1, m_Undef()))
1173 if (Op0 == Op1)
1177 if (match(Op1, m_Zero()))
1178 return Op1;
1181 if (match(Op1, m_AllOnes()))
1185 if (match(Op0, m_Not(m_Specific(Op1))) ||
1186 match(Op1, m_Not(m_Specific(Op0))))
1192 (A == Op1 || B == Op1))
1193 return Op1;
1196 if (match(Op1, m_Or(m_Value(A), m_Value(B))) &&
1201 if (Value *V = SimplifyAssociativeBinOp(Instruction::And, Op0, Op1, TD, DT,
1206 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Or,
1211 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Xor,
1216 if (Value *V = FactorizeBinOp(Instruction::And, Op0, Op1, Instruction::Or,
1222 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1223 if (Value *V = ThreadBinOpOverSelect(Instruction::And, Op0, Op1, TD, DT,
1229 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1230 if (Value *V = ThreadBinOpOverPHI(Instruction::And, Op0, Op1, TD, DT,
1237 Value *llvm::SimplifyAndInst(Value *Op0, Value *Op1, const TargetData *TD,
1239 return ::SimplifyAndInst(Op0, Op1, TD, DT, RecursionLimit);
1244 static Value *SimplifyOrInst(Value *Op0, Value *Op1, const TargetData *TD,
1247 if (Constant *CRHS = dyn_cast<Constant>(Op1)) {
1254 std::swap(Op0, Op1);
1258 if (match(Op1, m_Undef()))
1262 if (Op0 == Op1)
1266 if (match(Op1, m_Zero()))
1270 if (match(Op1, m_AllOnes()))
1271 return Op1;
1274 if (match(Op0, m_Not(m_Specific(Op1))) ||
1275 match(Op1, m_Not(m_Specific(Op0))))
1281 (A == Op1 || B == Op1))
1282 return Op1;
1285 if (match(Op1, m_And(m_Value(A), m_Value(B))) &&
1291 (A == Op1 || B == Op1))
1292 return Constant::getAllOnesValue(Op1->getType());
1295 if (match(Op1, m_Not(m_And(m_Value(A), m_Value(B)))) &&
1300 if (Value *V = SimplifyAssociativeBinOp(Instruction::Or, Op0, Op1, TD, DT,
1305 if (Value *V = ExpandBinOp(Instruction::Or, Op0, Op1, Instruction::And,
1310 if (Value *V = FactorizeBinOp(Instruction::Or, Op0, Op1, Instruction::And,
1316 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))
1317 if (Value *V = ThreadBinOpOverSelect(Instruction::Or, Op0, Op1, TD, DT,
1323 if (isa<PHINode>(Op0) || isa<PHINode>(Op1))
1324 if (Value *V = ThreadBinOpOverPHI(Instruction::Or, Op0, Op1, TD, DT,
1331 Value *llvm::SimplifyOrInst(Value *Op0, Value *Op1, const TargetData *TD,
1333 return ::SimplifyOrInst(Op0, Op1, TD, DT, RecursionLimit);
1338 static Value *SimplifyXorInst(Value *Op0, Value *Op1, const TargetData *TD,
1341 if (Constant *CRHS = dyn_cast<Constant>(Op1)) {
1348 std::swap(Op0, Op1);
1352 if (match(Op1, m_Undef()))
1353 return Op1;
1356 if (match(Op1, m_Zero()))
1360 if (Op0 == Op1)
1364 if (match(Op0, m_Not(m_Specific(Op1))) ||
1365 match(Op1, m_Not(m_Specific(Op0))))
1369 if (Value *V = SimplifyAssociativeBinOp(Instruction::Xor, Op0, Op1, TD, DT,
1374 if (Value *V = FactorizeBinOp(Instruction::Xor, Op0, Op1, Instruction::And,
1390 Value *llvm::SimplifyXorInst(Value *Op0, Value *Op1, const TargetData *TD,
1392 return ::SimplifyXorInst(Op0, Op1, TD, DT, RecursionLimit);