Lines Matching refs:BinaryOperator

163 static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode) {
164 auto *BO = dyn_cast<BinaryOperator>(V);
171 static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode1,
173 auto *BO = dyn_cast<BinaryOperator>(V);
237 assert(isa<BinaryOperator>(I) && "Expected binary operator.");
245 cast<BinaryOperator>(I)->swapOperands();
248 static BinaryOperator *CreateAdd(Value *S1, Value *S2, const Twine &Name,
252 return BinaryOperator::CreateAdd(S1, S2, Name, InsertBefore);
254 BinaryOperator *Res =
255 BinaryOperator::CreateFAdd(S1, S2, Name, InsertBefore);
261 static BinaryOperator *CreateMul(Value *S1, Value *S2, const Twine &Name,
265 return BinaryOperator::CreateMul(S1, S2, Name, InsertBefore);
267 BinaryOperator *Res =
268 BinaryOperator::CreateFMul(S1, S2, Name, InsertBefore);
278 return BinaryOperator::CreateNeg(S1, Name, InsertBefore);
287 static BinaryOperator *LowerNegateToMultiply(Instruction *Neg) {
288 assert((isa<UnaryOperator>(Neg) || isa<BinaryOperator>(Neg)) &&
291 unsigned OpNo = isa<BinaryOperator>(Neg) ? 1 : 0;
296 BinaryOperator *Res =
384 assert((isa<UnaryOperator>(I) || isa<BinaryOperator>(I)) &&
385 "Expected a UnaryOperator or BinaryOperator!");
444 if (BinaryOperator *BO = isReassociableOp(Op, Opcode)) {
511 if (BinaryOperator *UserBO = dyn_cast<BinaryOperator>(U))
568 void ReassociatePass::RewriteExprTree(BinaryOperator *I,
584 SmallVector<BinaryOperator*, 8> NodesToRewrite;
586 BinaryOperator *Op = I;
606 BinaryOperator *ExpressionChangedStart = nullptr,
636 BinaryOperator *BO = isReassociableOp(OldLHS, Opcode);
642 BinaryOperator *BO = isReassociableOp(OldRHS, Opcode);
669 BinaryOperator *BO = isReassociableOp(Op->getOperand(1), Opcode);
685 BinaryOperator *BO = isReassociableOp(Op->getOperand(0), Opcode);
698 BinaryOperator *NewOp;
701 NewOp = BinaryOperator::Create(Instruction::BinaryOps(Opcode), Poison,
760 cast<BinaryOperator>(*ExpressionChangedStart->user_begin());
765 for (BinaryOperator *BO : NodesToRewrite)
796 if (BinaryOperator *I =
962 static BinaryOperator *convertOrWithNoCommonBitsToAdd(Instruction *Or) {
964 BinaryOperator *New = CreateAdd(Or->getOperand(0), Or->getOperand(1), "",
1009 static BinaryOperator *BreakUpSubtract(Instruction *Sub,
1017 BinaryOperator *New =
1033 static BinaryOperator *ConvertShiftToMul(Instruction *Shl) {
1039 BinaryOperator *Mul = BinaryOperator::CreateMul(Shl->getOperand(0), MulCst,
1052 bool NSW = cast<BinaryOperator>(Shl)->hasNoSignedWrap();
1053 bool NUW = cast<BinaryOperator>(Shl)->hasNoUnsignedWrap();
1103 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul, Instruction::FMul);
1178 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul, Instruction::FMul);
1250 Instruction *I = BinaryOperator::CreateAnd(
1592 BinaryOperator *BOp =
1657 ? BinaryOperator::CreateAdd(MaxOccVal, MaxOccVal)
1658 : BinaryOperator::CreateFAdd(MaxOccVal, MaxOccVal);
1663 BinaryOperator *BOp =
1862 Value *ReassociatePass::OptimizeMul(BinaryOperator *I,
1892 Value *ReassociatePass::OptimizeExpression(BinaryOperator *I,
2146 if (!isa<UnaryOperator>(I) && !isa<BinaryOperator>(I))
2219 if (BinaryOperator *Tmp = dyn_cast<BinaryOperator>(U))
2237 Value *Op = isa<BinaryOperator>(I) ? I->getOperand(1) :
2246 if (BinaryOperator *Tmp = dyn_cast<BinaryOperator>(U))
2258 BinaryOperator *BO = cast<BinaryOperator>(I);
2285 void ReassociatePass::ReassociateExpression(BinaryOperator *I) {