Lines Matching refs:BinaryOperator
156 static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode) { in isReassociableOp()
157 auto *BO = dyn_cast<BinaryOperator>(V); in isReassociableOp()
164 static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode1, in isReassociableOp()
166 auto *BO = dyn_cast<BinaryOperator>(V); in isReassociableOp()
230 assert(isa<BinaryOperator>(I) && "Expected binary operator."); in canonicalizeOperands()
238 cast<BinaryOperator>(I)->swapOperands(); in canonicalizeOperands()
241 static BinaryOperator *CreateAdd(Value *S1, Value *S2, const Twine &Name, in CreateAdd()
244 return BinaryOperator::CreateAdd(S1, S2, Name, InsertBefore); in CreateAdd()
246 BinaryOperator *Res = in CreateAdd()
247 BinaryOperator::CreateFAdd(S1, S2, Name, InsertBefore); in CreateAdd()
253 static BinaryOperator *CreateMul(Value *S1, Value *S2, const Twine &Name, in CreateMul()
256 return BinaryOperator::CreateMul(S1, S2, Name, InsertBefore); in CreateMul()
258 BinaryOperator *Res = in CreateMul()
259 BinaryOperator::CreateFMul(S1, S2, Name, InsertBefore); in CreateMul()
268 return BinaryOperator::CreateNeg(S1, Name, InsertBefore); in CreateNeg()
277 static BinaryOperator *LowerNegateToMultiply(Instruction *Neg) { in LowerNegateToMultiply()
278 assert((isa<UnaryOperator>(Neg) || isa<BinaryOperator>(Neg)) && in LowerNegateToMultiply()
281 unsigned OpNo = isa<BinaryOperator>(Neg) ? 1 : 0; in LowerNegateToMultiply()
286 BinaryOperator *Res = CreateMul(Neg->getOperand(OpNo), NegOne, "", Neg, Neg); in LowerNegateToMultiply()
463 assert((isa<UnaryOperator>(I) || isa<BinaryOperator>(I)) && in LinearizeExprTree()
519 if (BinaryOperator *BO = isReassociableOp(Op, Opcode)) { in LinearizeExprTree()
560 if (BinaryOperator *BO = isReassociableOp(Op, Opcode)) { in LinearizeExprTree()
604 if (BinaryOperator *UserBO = dyn_cast<BinaryOperator>(U)) in LinearizeExprTree()
653 void ReassociatePass::RewriteExprTree(BinaryOperator *I, in RewriteExprTree()
668 SmallVector<BinaryOperator*, 8> NodesToRewrite; in RewriteExprTree()
670 BinaryOperator *Op = I; in RewriteExprTree()
689 BinaryOperator *ExpressionChanged = nullptr; in RewriteExprTree()
718 BinaryOperator *BO = isReassociableOp(OldLHS, Opcode); in RewriteExprTree()
724 BinaryOperator *BO = isReassociableOp(OldRHS, Opcode); in RewriteExprTree()
749 BinaryOperator *BO = isReassociableOp(Op->getOperand(1), Opcode); in RewriteExprTree()
763 BinaryOperator *BO = isReassociableOp(Op->getOperand(0), Opcode); in RewriteExprTree()
776 BinaryOperator *NewOp; in RewriteExprTree()
779 NewOp = BinaryOperator::Create(Instruction::BinaryOps(Opcode), in RewriteExprTree()
819 ExpressionChanged = cast<BinaryOperator>(*ExpressionChanged->user_begin()); in RewriteExprTree()
849 if (BinaryOperator *I = in NegateValue()
1019 static BinaryOperator *convertOrWithNoCommonBitsToAdd(Instruction *Or) { in convertOrWithNoCommonBitsToAdd()
1021 BinaryOperator *New = in convertOrWithNoCommonBitsToAdd()
1066 static BinaryOperator *BreakUpSubtract(Instruction *Sub, in BreakUpSubtract()
1074 BinaryOperator *New = CreateAdd(Sub->getOperand(0), NegVal, "", Sub, Sub); in BreakUpSubtract()
1089 static BinaryOperator *ConvertShiftToMul(Instruction *Shl) { in ConvertShiftToMul()
1094 BinaryOperator *Mul = in ConvertShiftToMul()
1095 BinaryOperator::CreateMul(Shl->getOperand(0), MulCst, "", Shl); in ConvertShiftToMul()
1107 bool NSW = cast<BinaryOperator>(Shl)->hasNoSignedWrap(); in ConvertShiftToMul()
1108 bool NUW = cast<BinaryOperator>(Shl)->hasNoUnsignedWrap(); in ConvertShiftToMul()
1158 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul, Instruction::FMul); in RemoveFactorFromExpression()
1233 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul, Instruction::FMul); in FindSingleUseMultiplyFactors()
1305 Instruction *I = BinaryOperator::CreateAnd( in createAndInstr()
1647 BinaryOperator *BOp = in OptimizeAdd()
1713 ? BinaryOperator::CreateAdd(MaxOccVal, MaxOccVal) in OptimizeAdd()
1714 : BinaryOperator::CreateFAdd(MaxOccVal, MaxOccVal); in OptimizeAdd()
1719 BinaryOperator *BOp = in OptimizeAdd()
1918 Value *ReassociatePass::OptimizeMul(BinaryOperator *I, in OptimizeMul()
1948 Value *ReassociatePass::OptimizeExpression(BinaryOperator *I, in OptimizeExpression()
2202 if (!isa<UnaryOperator>(I) && !isa<BinaryOperator>(I)) in OptimizeInst()
2273 if (BinaryOperator *Tmp = dyn_cast<BinaryOperator>(U)) in OptimizeInst()
2291 Value *Op = isa<BinaryOperator>(I) ? I->getOperand(1) : in OptimizeInst()
2300 if (BinaryOperator *Tmp = dyn_cast<BinaryOperator>(U)) in OptimizeInst()
2312 BinaryOperator *BO = cast<BinaryOperator>(I); in OptimizeInst()
2339 void ReassociatePass::ReassociateExpression(BinaryOperator *I) { in ReassociateExpression()