Lines Matching refs:BinaryOperator
135 void ReassociateExpression(BinaryOperator *I);
136 void RewriteExprTree(BinaryOperator *I, SmallVectorImpl<ValueEntry> &Ops);
137 Value *OptimizeExpression(BinaryOperator *I,
144 Value *OptimizeMul(BinaryOperator *I, SmallVectorImpl<ValueEntry> &Ops);
160 static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode) {
163 return cast<BinaryOperator>(V);
229 (!BinaryOperator::isNot(I) && !BinaryOperator::isNeg(I)))
240 static BinaryOperator *LowerNegateToMultiply(Instruction *Neg) {
243 BinaryOperator *Res =
244 BinaryOperator::CreateMul(Neg->getOperand(1), Cst, "",Neg);
450 static bool LinearizeExprTree(BinaryOperator *I,
473 SmallVector<std::pair<BinaryOperator*, APInt>, 8> Worklist; // (Op, Weight)
500 std::pair<BinaryOperator*, APInt> P = Worklist.pop_back_val();
518 if (BinaryOperator *BO = isReassociableOp(Op, Opcode)) {
557 if (BinaryOperator *BO = isReassociableOp(Op, Opcode)) {
586 BinaryOperator *BO = dyn_cast<BinaryOperator>(Op);
587 if (Opcode == Instruction::Mul && BO && BinaryOperator::isNeg(BO)) {
655 void Reassociate::RewriteExprTree(BinaryOperator *I,
670 SmallVector<BinaryOperator*, 8> NodesToRewrite;
672 BinaryOperator *Op = I;
677 BinaryOperator *ExpressionChanged = 0;
706 if (BinaryOperator *BO = isReassociableOp(OldLHS, Opcode))
711 if (BinaryOperator *BO = isReassociableOp(OldRHS, Opcode))
735 if (BinaryOperator *BO = isReassociableOp(Op->getOperand(1), Opcode))
748 if (BinaryOperator *BO = isReassociableOp(Op->getOperand(0), Opcode)) {
760 BinaryOperator *NewOp;
763 NewOp = BinaryOperator::Create(Instruction::BinaryOps(Opcode),
788 ExpressionChanged = cast<BinaryOperator>(*ExpressionChanged->use_begin());
813 if (BinaryOperator *I = isReassociableOp(V, Instruction::Add)) {
832 if (!BinaryOperator::isNeg(U)) continue;
838 BinaryOperator *TheNeg = cast<BinaryOperator>(U);
862 return BinaryOperator::CreateNeg(V, V->getName() + ".neg", BI);
869 if (BinaryOperator::isNeg(Sub))
891 static BinaryOperator *BreakUpSubtract(Instruction *Sub) {
899 BinaryOperator *New =
900 BinaryOperator::CreateAdd(Sub->getOperand(0), NegVal, "", Sub);
916 static BinaryOperator *ConvertShiftToMul(Instruction *Shl) {
920 BinaryOperator *Mul =
921 BinaryOperator::CreateMul(Shl->getOperand(0), MulCst, "", Shl);
956 return BinaryOperator::CreateAdd(V2, V1, "tmp", I);
963 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul);
1014 V = BinaryOperator::CreateNeg(V, "neg", InsertPt);
1026 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul);
1048 if (BinaryOperator::isNot(Ops[i].Op)) { // Cannot occur for ^.
1049 Value *X = BinaryOperator::getNotArgument(Ops[i].Op);
1115 Mul = BinaryOperator::CreateMul(TheOp, Mul, "factor", I);
1137 if (!BinaryOperator::isNeg(TheOp))
1140 Value *X = BinaryOperator::getNegArgument(TheOp);
1172 BinaryOperator *BOp = isReassociableOp(Ops[i].Op, Instruction::Mul);
1214 Instruction *DummyInst = BinaryOperator::CreateAdd(MaxOccVal, MaxOccVal);
1218 BinaryOperator *BOp = isReassociableOp(Ops[i].Op, Instruction::Mul);
1251 Instruction *V2 = BinaryOperator::CreateMul(V, MaxOccVal, "tmp", I);
1421 Value *Reassociate::OptimizeMul(BinaryOperator *I,
1445 Value *Reassociate::OptimizeExpression(BinaryOperator *I,
1508 if (!isa<BinaryOperator>(I))
1566 } else if (BinaryOperator::isNeg(I)) {
1582 BinaryOperator *BO = cast<BinaryOperator>(I);
1599 void Reassociate::ReassociateExpression(BinaryOperator *I) {