Lines Matching refs:BinaryOperator

148 static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode) {  in isReassociableOp()
152 return cast<BinaryOperator>(I); in isReassociableOp()
156 static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode1, in isReassociableOp()
162 return cast<BinaryOperator>(I); in isReassociableOp()
222 assert(isa<BinaryOperator>(I) && "Expected binary operator."); in canonicalizeOperands()
230 cast<BinaryOperator>(I)->swapOperands(); in canonicalizeOperands()
233 static BinaryOperator *CreateAdd(Value *S1, Value *S2, const Twine &Name, in CreateAdd()
236 return BinaryOperator::CreateAdd(S1, S2, Name, InsertBefore); in CreateAdd()
238 BinaryOperator *Res = in CreateAdd()
239 BinaryOperator::CreateFAdd(S1, S2, Name, InsertBefore); in CreateAdd()
245 static BinaryOperator *CreateMul(Value *S1, Value *S2, const Twine &Name, in CreateMul()
248 return BinaryOperator::CreateMul(S1, S2, Name, InsertBefore); in CreateMul()
250 BinaryOperator *Res = in CreateMul()
251 BinaryOperator::CreateFMul(S1, S2, Name, InsertBefore); in CreateMul()
257 static BinaryOperator *CreateNeg(Value *S1, const Twine &Name, in CreateNeg()
260 return BinaryOperator::CreateNeg(S1, Name, InsertBefore); in CreateNeg()
262 BinaryOperator *Res = BinaryOperator::CreateFNeg(S1, Name, InsertBefore); in CreateNeg()
269 static BinaryOperator *LowerNegateToMultiply(Instruction *Neg) { in LowerNegateToMultiply()
274 BinaryOperator *Res = CreateMul(Neg->getOperand(1), NegOne, "", Neg, Neg); in LowerNegateToMultiply()
448 static bool LinearizeExprTree(BinaryOperator *I, in LinearizeExprTree()
466 SmallVector<std::pair<BinaryOperator*, APInt>, 8> Worklist; // (Op, Weight) in LinearizeExprTree()
493 std::pair<BinaryOperator*, APInt> P = Worklist.pop_back_val(); in LinearizeExprTree()
504 if (BinaryOperator *BO = isReassociableOp(Op, Opcode)) { in LinearizeExprTree()
545 if (BinaryOperator *BO = isReassociableOp(Op, Opcode)) { in LinearizeExprTree()
576 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(Op)) in LinearizeExprTree()
629 void ReassociatePass::RewriteExprTree(BinaryOperator *I, in RewriteExprTree()
644 SmallVector<BinaryOperator*, 8> NodesToRewrite; in RewriteExprTree()
646 BinaryOperator *Op = I; in RewriteExprTree()
665 BinaryOperator *ExpressionChanged = nullptr; in RewriteExprTree()
694 BinaryOperator *BO = isReassociableOp(OldLHS, Opcode); in RewriteExprTree()
700 BinaryOperator *BO = isReassociableOp(OldRHS, Opcode); in RewriteExprTree()
725 BinaryOperator *BO = isReassociableOp(Op->getOperand(1), Opcode); in RewriteExprTree()
739 BinaryOperator *BO = isReassociableOp(Op->getOperand(0), Opcode); in RewriteExprTree()
752 BinaryOperator *NewOp; in RewriteExprTree()
755 NewOp = BinaryOperator::Create(Instruction::BinaryOps(Opcode), in RewriteExprTree()
795 ExpressionChanged = cast<BinaryOperator>(*ExpressionChanged->user_begin()); in RewriteExprTree()
825 if (BinaryOperator *I = in NegateValue()
859 BinaryOperator *TheNeg = cast<BinaryOperator>(U); in NegateValue()
889 BinaryOperator *NewNeg = CreateNeg(V, V->getName() + ".neg", BI, BI); in NegateValue()
925 static BinaryOperator *BreakUpSubtract(Instruction *Sub, in BreakUpSubtract()
933 BinaryOperator *New = CreateAdd(Sub->getOperand(0), NegVal, "", Sub, Sub); in BreakUpSubtract()
948 static BinaryOperator *ConvertShiftToMul(Instruction *Shl) { in ConvertShiftToMul()
952 BinaryOperator *Mul = in ConvertShiftToMul()
953 BinaryOperator::CreateMul(Shl->getOperand(0), MulCst, "", Shl); in ConvertShiftToMul()
964 bool NSW = cast<BinaryOperator>(Shl)->hasNoSignedWrap(); in ConvertShiftToMul()
965 bool NUW = cast<BinaryOperator>(Shl)->hasNoUnsignedWrap(); in ConvertShiftToMul()
1015 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul, Instruction::FMul); in RemoveFactorFromExpression()
1090 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul, Instruction::FMul); in FindSingleUseMultiplyFactors()
1162 Instruction *I = BinaryOperator::CreateAnd( in createAndInstr()
1506 BinaryOperator *BOp = in OptimizeAdd()
1572 ? BinaryOperator::CreateAdd(MaxOccVal, MaxOccVal) in OptimizeAdd()
1573 : BinaryOperator::CreateFAdd(MaxOccVal, MaxOccVal); in OptimizeAdd()
1578 BinaryOperator *BOp = in OptimizeAdd()
1778 Value *ReassociatePass::OptimizeMul(BinaryOperator *I, in OptimizeMul()
1808 Value *ReassociatePass::OptimizeExpression(BinaryOperator *I, in OptimizeExpression()
1947 if (!isa<BinaryOperator>(User) || User->use_empty()) in canonicalizeNegConstExpr()
1973 cast<BinaryOperator>(User)->swapOperands(); in canonicalizeNegConstExpr()
1977 BinaryOperator *NI; in canonicalizeNegConstExpr()
1982 NI = BinaryOperator::CreateFSub(Op0, Op1); in canonicalizeNegConstExpr()
1986 NI = BinaryOperator::CreateFAdd(Op0, Op1); in canonicalizeNegConstExpr()
2004 if (!isa<BinaryOperator>(I)) in OptimizeInst()
2061 if (BinaryOperator *Tmp = dyn_cast<BinaryOperator>(U)) in OptimizeInst()
2085 if (BinaryOperator *Tmp = dyn_cast<BinaryOperator>(U)) in OptimizeInst()
2097 BinaryOperator *BO = cast<BinaryOperator>(I); in OptimizeInst()
2124 void ReassociatePass::ReassociateExpression(BinaryOperator *I) { in ReassociateExpression()