Lines Matching refs:BinaryOperator

149 static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode) {  in isReassociableOp()
153 return cast<BinaryOperator>(I); in isReassociableOp()
157 static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode1, in isReassociableOp()
163 return cast<BinaryOperator>(I); in isReassociableOp()
223 assert(isa<BinaryOperator>(I) && "Expected binary operator."); in canonicalizeOperands()
231 cast<BinaryOperator>(I)->swapOperands(); in canonicalizeOperands()
234 static BinaryOperator *CreateAdd(Value *S1, Value *S2, const Twine &Name, in CreateAdd()
237 return BinaryOperator::CreateAdd(S1, S2, Name, InsertBefore); in CreateAdd()
239 BinaryOperator *Res = in CreateAdd()
240 BinaryOperator::CreateFAdd(S1, S2, Name, InsertBefore); in CreateAdd()
246 static BinaryOperator *CreateMul(Value *S1, Value *S2, const Twine &Name, in CreateMul()
249 return BinaryOperator::CreateMul(S1, S2, Name, InsertBefore); in CreateMul()
251 BinaryOperator *Res = in CreateMul()
252 BinaryOperator::CreateFMul(S1, S2, Name, InsertBefore); in CreateMul()
261 return BinaryOperator::CreateNeg(S1, Name, InsertBefore); in CreateNeg()
270 static BinaryOperator *LowerNegateToMultiply(Instruction *Neg) { in LowerNegateToMultiply()
271 assert((isa<UnaryOperator>(Neg) || isa<BinaryOperator>(Neg)) && in LowerNegateToMultiply()
274 unsigned OpNo = isa<BinaryOperator>(Neg) ? 1 : 0; in LowerNegateToMultiply()
279 BinaryOperator *Res = CreateMul(Neg->getOperand(OpNo), NegOne, "", Neg, Neg); in LowerNegateToMultiply()
455 assert((isa<UnaryOperator>(I) || isa<BinaryOperator>(I)) && in LinearizeExprTree()
511 if (BinaryOperator *BO = isReassociableOp(Op, Opcode)) { in LinearizeExprTree()
552 if (BinaryOperator *BO = isReassociableOp(Op, Opcode)) { in LinearizeExprTree()
636 void ReassociatePass::RewriteExprTree(BinaryOperator *I, in RewriteExprTree()
651 SmallVector<BinaryOperator*, 8> NodesToRewrite; in RewriteExprTree()
653 BinaryOperator *Op = I; in RewriteExprTree()
672 BinaryOperator *ExpressionChanged = nullptr; in RewriteExprTree()
701 BinaryOperator *BO = isReassociableOp(OldLHS, Opcode); in RewriteExprTree()
707 BinaryOperator *BO = isReassociableOp(OldRHS, Opcode); in RewriteExprTree()
732 BinaryOperator *BO = isReassociableOp(Op->getOperand(1), Opcode); in RewriteExprTree()
746 BinaryOperator *BO = isReassociableOp(Op->getOperand(0), Opcode); in RewriteExprTree()
759 BinaryOperator *NewOp; in RewriteExprTree()
762 NewOp = BinaryOperator::Create(Instruction::BinaryOps(Opcode), in RewriteExprTree()
802 ExpressionChanged = cast<BinaryOperator>(*ExpressionChanged->user_begin()); in RewriteExprTree()
832 if (BinaryOperator *I = in NegateValue()
1002 static BinaryOperator *convertOrWithNoCommonBitsToAdd(Instruction *Or) { in convertOrWithNoCommonBitsToAdd()
1004 BinaryOperator *New = in convertOrWithNoCommonBitsToAdd()
1049 static BinaryOperator *BreakUpSubtract(Instruction *Sub, in BreakUpSubtract()
1057 BinaryOperator *New = CreateAdd(Sub->getOperand(0), NegVal, "", Sub, Sub); in BreakUpSubtract()
1072 static BinaryOperator *ConvertShiftToMul(Instruction *Shl) { in ConvertShiftToMul()
1077 BinaryOperator *Mul = in ConvertShiftToMul()
1078 BinaryOperator::CreateMul(Shl->getOperand(0), MulCst, "", Shl); in ConvertShiftToMul()
1090 bool NSW = cast<BinaryOperator>(Shl)->hasNoSignedWrap(); in ConvertShiftToMul()
1091 bool NUW = cast<BinaryOperator>(Shl)->hasNoUnsignedWrap(); in ConvertShiftToMul()
1141 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul, Instruction::FMul); in RemoveFactorFromExpression()
1216 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul, Instruction::FMul); in FindSingleUseMultiplyFactors()
1288 Instruction *I = BinaryOperator::CreateAnd( in createAndInstr()
1631 BinaryOperator *BOp = in OptimizeAdd()
1697 ? BinaryOperator::CreateAdd(MaxOccVal, MaxOccVal) in OptimizeAdd()
1698 : BinaryOperator::CreateFAdd(MaxOccVal, MaxOccVal); in OptimizeAdd()
1703 BinaryOperator *BOp = in OptimizeAdd()
1902 Value *ReassociatePass::OptimizeMul(BinaryOperator *I, in OptimizeMul()
1932 Value *ReassociatePass::OptimizeExpression(BinaryOperator *I, in OptimizeExpression()
2174 if (!isa<UnaryOperator>(I) && !isa<BinaryOperator>(I)) in OptimizeInst()
2244 if (BinaryOperator *Tmp = dyn_cast<BinaryOperator>(U)) in OptimizeInst()
2262 Value *Op = isa<BinaryOperator>(I) ? I->getOperand(1) : in OptimizeInst()
2271 if (BinaryOperator *Tmp = dyn_cast<BinaryOperator>(U)) in OptimizeInst()
2283 BinaryOperator *BO = cast<BinaryOperator>(I); in OptimizeInst()
2310 void ReassociatePass::ReassociateExpression(BinaryOperator *I) { in ReassociateExpression()