|
reference, declaration → definition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
|
Declarations
include/llvm/Analysis/InstructionSimplify.h 55 class BinaryOperator;
include/llvm/IR/Instruction.def 147 HANDLE_BINARY_INST(13, Add , BinaryOperator)
148 HANDLE_BINARY_INST(14, FAdd , BinaryOperator)
149 HANDLE_BINARY_INST(15, Sub , BinaryOperator)
150 HANDLE_BINARY_INST(16, FSub , BinaryOperator)
151 HANDLE_BINARY_INST(17, Mul , BinaryOperator)
152 HANDLE_BINARY_INST(18, FMul , BinaryOperator)
153 HANDLE_BINARY_INST(19, UDiv , BinaryOperator)
154 HANDLE_BINARY_INST(20, SDiv , BinaryOperator)
155 HANDLE_BINARY_INST(21, FDiv , BinaryOperator)
156 HANDLE_BINARY_INST(22, URem , BinaryOperator)
157 HANDLE_BINARY_INST(23, SRem , BinaryOperator)
158 HANDLE_BINARY_INST(24, FRem , BinaryOperator)
161 HANDLE_BINARY_INST(25, Shl , BinaryOperator) // Shift left (logical)
162 HANDLE_BINARY_INST(26, LShr , BinaryOperator) // Shift right (logical)
163 HANDLE_BINARY_INST(27, AShr , BinaryOperator) // Shift right (arithmetic)
164 HANDLE_BINARY_INST(28, And , BinaryOperator)
165 HANDLE_BINARY_INST(29, Or , BinaryOperator)
166 HANDLE_BINARY_INST(30, Xor , BinaryOperator)
include/llvm/Transforms/Scalar/JumpThreading.h 33 class BinaryOperator;
include/llvm/Transforms/Scalar/NaryReassociate.h 89 class BinaryOperator;
include/llvm/Transforms/Scalar/Reassociate.h 37 class BinaryOperator;
include/llvm/Transforms/Utils/IntegerDivision.h 20 class BinaryOperator;
References
examples/Fibonacci/fibonacci.cpp 83 Value *Sub = BinaryOperator::CreateSub(ArgX, One, "arg", RecurseBB);
88 Sub = BinaryOperator::CreateSub(ArgX, Two, "arg", RecurseBB);
93 Value *Sum = BinaryOperator::CreateAdd(CallFibX1, CallFibX2,
examples/ModuleMaker/ModuleMaker.cpp 54 Instruction *Add = BinaryOperator::Create(Instruction::Add, Two, Three,
examples/ParallelJIT/ParallelJIT.cpp 71 Instruction *Add = BinaryOperator::CreateAdd(One, ArgX, "addresult", BB);
113 Value *Sub = BinaryOperator::CreateSub(ArgX, One, "arg", RecurseBB);
117 Sub = BinaryOperator::CreateSub(ArgX, Two, "arg", RecurseBB);
122 BinaryOperator::CreateAdd(CallFibX1, CallFibX2, "addresult", RecurseBB);
include/llvm/ADT/ArrayRef.h 108 const ArrayRef<U *> &A,
110 std::is_convertible<U *const *, T const *>::value>::type * = nullptr)
118 const SmallVectorTemplateCommon<U *, DummyT> &Vec,
120 std::is_convertible<U *const *, T const *>::value>::type * = nullptr)
include/llvm/Analysis/IVDescriptors.h 283 BinaryOperator *getInductionBinOp() const { return InductionBinOp; }
349 BinaryOperator *InductionBinOp = nullptr,
359 BinaryOperator *InductionBinOp = nullptr;
include/llvm/Analysis/InstructionSimplify.h 71 template <class InstT> bool hasNoUnsignedWrap(const InstT *Op) const {
77 template <class InstT> bool hasNoSignedWrap(const InstT *Op) const {
83 bool isExact(const BinaryOperator *Op) const {
include/llvm/Analysis/LoopUnrollAnalyzer.h 87 bool visitBinaryOperator(BinaryOperator &I);
include/llvm/CodeGen/BasicTTIImpl.h 1054 BinaryOperator::And, MaskVT);
1139 Cost += ConcreteTTI->getArithmeticInstrCost(BinaryOperator::Or, RetTy);
1140 Cost += ConcreteTTI->getArithmeticInstrCost(BinaryOperator::Sub, RetTy);
1141 Cost += ConcreteTTI->getArithmeticInstrCost(BinaryOperator::Shl, RetTy,
1143 Cost += ConcreteTTI->getArithmeticInstrCost(BinaryOperator::LShr, RetTy,
1148 Cost += ConcreteTTI->getArithmeticInstrCost(BinaryOperator::URem, RetTy,
1154 Cost += ConcreteTTI->getCmpSelInstrCost(BinaryOperator::ICmp, RetTy,
1156 Cost += ConcreteTTI->getCmpSelInstrCost(BinaryOperator::Select, RetTy,
1339 Cost += ConcreteTTI->getCmpSelInstrCost(BinaryOperator::ICmp, RetTy,
1341 Cost += 2 * ConcreteTTI->getCmpSelInstrCost(BinaryOperator::Select, RetTy,
1357 Cost += ConcreteTTI->getCmpSelInstrCost(BinaryOperator::Select, RetTy,
1388 ? BinaryOperator::Add
1389 : BinaryOperator::Sub;
1401 Cost += 3 * ConcreteTTI->getCmpSelInstrCost(BinaryOperator::ICmp, SumTy,
1404 BinaryOperator::ICmp, OverflowTy, OverflowTy, nullptr);
1406 ConcreteTTI->getArithmeticInstrCost(BinaryOperator::And, OverflowTy);
1414 ? BinaryOperator::Add
1415 : BinaryOperator::Sub;
1419 Cost += ConcreteTTI->getCmpSelInstrCost(BinaryOperator::ICmp, SumTy,
1447 Cost += ConcreteTTI->getCmpSelInstrCost(BinaryOperator::ICmp, MulTy,
1499 return ConcreteTTI->getArithmeticInstrCost(BinaryOperator::FMul, RetTy) +
1500 ConcreteTTI->getArithmeticInstrCost(BinaryOperator::FAdd, RetTy);
include/llvm/IR/IRBuilder.h 845 InstTy *Insert(InstTy *I, const Twine &Name = "") const {
845 InstTy *Insert(InstTy *I, const Twine &Name = "") const {
1073 BinaryOperator *CreateInsertNUWNSWBinOp(BinaryOperator::BinaryOps Opc,
1073 BinaryOperator *CreateInsertNUWNSWBinOp(BinaryOperator::BinaryOps Opc,
1077 BinaryOperator *BO = Insert(BinaryOperator::Create(Opc, LHS, RHS), Name);
1077 BinaryOperator *BO = Insert(BinaryOperator::Create(Opc, LHS, RHS), Name);
1190 return Insert(BinaryOperator::CreateUDiv(LHS, RHS), Name);
1191 return Insert(BinaryOperator::CreateExactUDiv(LHS, RHS), Name);
1204 return Insert(BinaryOperator::CreateSDiv(LHS, RHS), Name);
1205 return Insert(BinaryOperator::CreateExactSDiv(LHS, RHS), Name);
1214 return Insert(BinaryOperator::CreateURem(LHS, RHS), Name);
1219 return Insert(BinaryOperator::CreateSRem(LHS, RHS), Name);
1249 return Insert(BinaryOperator::CreateLShr(LHS, RHS), Name);
1250 return Insert(BinaryOperator::CreateExactLShr(LHS, RHS), Name);
1269 return Insert(BinaryOperator::CreateAShr(LHS, RHS), Name);
1270 return Insert(BinaryOperator::CreateExactAShr(LHS, RHS), Name);
1290 return Insert(BinaryOperator::CreateAnd(LHS, RHS), Name);
1316 return Insert(BinaryOperator::CreateOr(LHS, RHS), Name);
1337 return Insert(BinaryOperator::CreateXor(LHS, RHS), Name);
1355 Instruction *I = setFPAttrs(BinaryOperator::CreateFAdd(L, R), FPMD, FMF);
1368 Instruction *I = setFPAttrs(BinaryOperator::CreateFAdd(L, R), nullptr,
1380 Instruction *I = setFPAttrs(BinaryOperator::CreateFSub(L, R), FPMD, FMF);
1393 Instruction *I = setFPAttrs(BinaryOperator::CreateFSub(L, R), nullptr,
1405 Instruction *I = setFPAttrs(BinaryOperator::CreateFMul(L, R), FPMD, FMF);
1418 Instruction *I = setFPAttrs(BinaryOperator::CreateFMul(L, R), nullptr,
1430 Instruction *I = setFPAttrs(BinaryOperator::CreateFDiv(L, R), FPMD, FMF);
1443 Instruction *I = setFPAttrs(BinaryOperator::CreateFDiv(L, R), nullptr,
1455 Instruction *I = setFPAttrs(BinaryOperator::CreateFRem(L, R), FPMD, FMF);
1468 Instruction *I = setFPAttrs(BinaryOperator::CreateFRem(L, R), nullptr,
1477 Instruction *BinOp = BinaryOperator::Create(Opc, LHS, RHS);
1506 BinaryOperator *BO = Insert(BinaryOperator::CreateNeg(V), Name);
1506 BinaryOperator *BO = Insert(BinaryOperator::CreateNeg(V), Name);
1542 return Insert(BinaryOperator::CreateNot(V), Name);
include/llvm/IR/InstVisitor.h 269 RetTy visitBinaryOperator(BinaryOperator &I) { DELEGATE(Instruction);}
include/llvm/IR/InstrTypes.h 200 BinaryOperator *cloneImpl() const;
216 static BinaryOperator *Create(BinaryOps Op, Value *S1, Value *S2,
224 static BinaryOperator *Create(BinaryOps Op, Value *S1, Value *S2,
249 static BinaryOperator *CreateWithCopiedFlags(BinaryOps Opc,
253 BinaryOperator *BO = Create(Opc, V1, V2, Name);
258 static BinaryOperator *CreateFAddFMF(Value *V1, Value *V2,
263 static BinaryOperator *CreateFSubFMF(Value *V1, Value *V2,
268 static BinaryOperator *CreateFMulFMF(Value *V1, Value *V2,
273 static BinaryOperator *CreateFDivFMF(Value *V1, Value *V2,
278 static BinaryOperator *CreateFRemFMF(Value *V1, Value *V2,
283 static BinaryOperator *CreateFNegFMF(Value *Op, Instruction *FMFSource,
289 static BinaryOperator *CreateNSW(BinaryOps Opc, Value *V1, Value *V2,
291 BinaryOperator *BO = Create(Opc, V1, V2, Name);
295 static BinaryOperator *CreateNSW(BinaryOps Opc, Value *V1, Value *V2,
297 BinaryOperator *BO = Create(Opc, V1, V2, Name, BB);
301 static BinaryOperator *CreateNSW(BinaryOps Opc, Value *V1, Value *V2,
303 BinaryOperator *BO = Create(Opc, V1, V2, Name, I);
308 static BinaryOperator *CreateNUW(BinaryOps Opc, Value *V1, Value *V2,
310 BinaryOperator *BO = Create(Opc, V1, V2, Name);
314 static BinaryOperator *CreateNUW(BinaryOps Opc, Value *V1, Value *V2,
316 BinaryOperator *BO = Create(Opc, V1, V2, Name, BB);
320 static BinaryOperator *CreateNUW(BinaryOps Opc, Value *V1, Value *V2,
322 BinaryOperator *BO = Create(Opc, V1, V2, Name, I);
327 static BinaryOperator *CreateExact(BinaryOps Opc, Value *V1, Value *V2,
329 BinaryOperator *BO = Create(Opc, V1, V2, Name);
333 static BinaryOperator *CreateExact(BinaryOps Opc, Value *V1, Value *V2,
335 BinaryOperator *BO = Create(Opc, V1, V2, Name, BB);
339 static BinaryOperator *CreateExact(BinaryOps Opc, Value *V1, Value *V2,
341 BinaryOperator *BO = Create(Opc, V1, V2, Name, I);
381 static BinaryOperator *CreateNeg(Value *Op, const Twine &Name = "",
383 static BinaryOperator *CreateNeg(Value *Op, const Twine &Name,
385 static BinaryOperator *CreateNSWNeg(Value *Op, const Twine &Name = "",
387 static BinaryOperator *CreateNSWNeg(Value *Op, const Twine &Name,
389 static BinaryOperator *CreateNUWNeg(Value *Op, const Twine &Name = "",
391 static BinaryOperator *CreateNUWNeg(Value *Op, const Twine &Name,
393 static BinaryOperator *CreateFNeg(Value *Op, const Twine &Name = "",
395 static BinaryOperator *CreateFNeg(Value *Op, const Twine &Name,
397 static BinaryOperator *CreateNot(Value *Op, const Twine &Name = "",
399 static BinaryOperator *CreateNot(Value *Op, const Twine &Name,
424 public FixedNumOperandTraits<BinaryOperator, 2> {
include/llvm/IR/NoFolder.h 43 BinaryOperator *BO = BinaryOperator::CreateAdd(LHS, RHS);
43 BinaryOperator *BO = BinaryOperator::CreateAdd(LHS, RHS);
50 return BinaryOperator::CreateNSWAdd(LHS, RHS);
54 return BinaryOperator::CreateNUWAdd(LHS, RHS);
58 return BinaryOperator::CreateFAdd(LHS, RHS);
63 BinaryOperator *BO = BinaryOperator::CreateSub(LHS, RHS);
63 BinaryOperator *BO = BinaryOperator::CreateSub(LHS, RHS);
70 return BinaryOperator::CreateNSWSub(LHS, RHS);
74 return BinaryOperator::CreateNUWSub(LHS, RHS);
78 return BinaryOperator::CreateFSub(LHS, RHS);
83 BinaryOperator *BO = BinaryOperator::CreateMul(LHS, RHS);
83 BinaryOperator *BO = BinaryOperator::CreateMul(LHS, RHS);
90 return BinaryOperator::CreateNSWMul(LHS, RHS);
94 return BinaryOperator::CreateNUWMul(LHS, RHS);
98 return BinaryOperator::CreateFMul(LHS, RHS);
104 return BinaryOperator::CreateUDiv(LHS, RHS);
105 return BinaryOperator::CreateExactUDiv(LHS, RHS);
109 return BinaryOperator::CreateExactUDiv(LHS, RHS);
115 return BinaryOperator::CreateSDiv(LHS, RHS);
116 return BinaryOperator::CreateExactSDiv(LHS, RHS);
120 return BinaryOperator::CreateExactSDiv(LHS, RHS);
124 return BinaryOperator::CreateFDiv(LHS, RHS);
128 return BinaryOperator::CreateURem(LHS, RHS);
132 return BinaryOperator::CreateSRem(LHS, RHS);
136 return BinaryOperator::CreateFRem(LHS, RHS);
141 BinaryOperator *BO = BinaryOperator::CreateShl(LHS, RHS);
141 BinaryOperator *BO = BinaryOperator::CreateShl(LHS, RHS);
150 return BinaryOperator::CreateLShr(LHS, RHS);
151 return BinaryOperator::CreateExactLShr(LHS, RHS);
157 return BinaryOperator::CreateAShr(LHS, RHS);
158 return BinaryOperator::CreateExactAShr(LHS, RHS);
162 return BinaryOperator::CreateAnd(LHS, RHS);
166 return BinaryOperator::CreateOr(LHS, RHS);
170 return BinaryOperator::CreateXor(LHS, RHS);
175 return BinaryOperator::Create(Opc, LHS, RHS);
184 BinaryOperator *BO = BinaryOperator::CreateNeg(C);
184 BinaryOperator *BO = BinaryOperator::CreateNeg(C);
191 return BinaryOperator::CreateNSWNeg(C);
195 return BinaryOperator::CreateNUWNeg(C);
203 return BinaryOperator::CreateNot(C);
include/llvm/IR/OperandTraits.h 31 static Use *op_begin(SubClass* U) {
33 !std::is_polymorphic<SubClass>::value,
37 static Use *op_end(SubClass* U) {
include/llvm/IR/PatternMatch.h 47 template <typename Val, typename Pattern> bool match(Val *V, const Pattern &P) {
56 template <typename OpTy> bool match(OpTy *V) {
66 template <typename ITy> bool match(ITy *V) { return isa<Class>(V); }
73 inline class_match<BinaryOperator> m_BinOp() {
540 Class *&VR;
542 bind_ty(Class *&V) : VR(V) {}
545 if (auto *CV = dyn_cast<Class>(V)) {
545 if (auto *CV = dyn_cast<Class>(V)) {
560 inline bind_ty<BinaryOperator> m_BinOp(BinaryOperator *&I) { return I; }
560 inline bind_ty<BinaryOperator> m_BinOp(BinaryOperator *&I) { return I; }
714 template <typename OpTy> bool match(OpTy *V) {
715 if (auto *I = dyn_cast<BinaryOperator>(V))
715 if (auto *I = dyn_cast<BinaryOperator>(V))
742 template <typename OpTy> bool match(OpTy *V) {
744 auto *I = cast<BinaryOperator>(V);
744 auto *I = cast<BinaryOperator>(V);
786 template <typename OpTy> bool match(OpTy *V) {
1010 template <typename OpTy> bool match(OpTy *V) {
1904 template <typename OpTy> bool match(OpTy *V) {
include/llvm/IR/User.h 127 template <int Idx, typename U> static Use &OpFrom(const U *that) {
129 ? OperandTraits<U>::op_end(const_cast<U*>(that))[Idx]
130 : OperandTraits<U>::op_begin(const_cast<U*>(that))[Idx];
include/llvm/Support/Casting.h 34 using SimpleType = From; // The real type this represents...
37 static SimpleType &getSimplifiedValue(From &Val) { return Val; }
41 using NonConstSimpleType = typename simplify_type<From>::SimpleType;
47 static RetType getSimplifiedValue(const From& Val) {
57 static inline bool doit(const From &Val) {
58 return To::classof(&Val);
66 static inline bool doit(const From &) { return true; }
76 static inline bool doit(const From &Val) {
77 return isa_impl<To, From>::doit(Val);
77 return isa_impl<To, From>::doit(Val);
92 return isa_impl<To, From>::doit(*Val);
104 static inline bool doit(const From *Val) {
106 return isa_impl<To, From>::doit(*Val);
106 return isa_impl<To, From>::doit(*Val);
122 return isa_impl_wrap<To, SimpleFrom,
132 return isa_impl_cl<To,FromTy>::doit(Val);
141 template <class X, class Y> LLVM_NODISCARD inline bool isa(const Y &Val) {
142 return isa_impl_wrap<X, const Y,
142 return isa_impl_wrap<X, const Y,
143 typename simplify_type<const Y>::SimpleType>::doit(Val);
172 using ret_type = To *; // Pointer arg case, return Ty*
176 using ret_type = const To *; // Constant pointer arg case, return const Ty*
198 using ret_type = typename cast_retty<To, SimpleFrom>::ret_type;
204 using ret_type = typename cast_retty_impl<To,FromTy>::ret_type;
204 using ret_type = typename cast_retty_impl<To,FromTy>::ret_type;
210 To, From, typename simplify_type<From>::SimpleType>::ret_type;
210 To, From, typename simplify_type<From>::SimpleType>::ret_type;
210 To, From, typename simplify_type<From>::SimpleType>::ret_type;
218 static typename cast_retty<To, From>::ret_type doit(From &Val) {
219 return cast_convert_val<To, SimpleFrom,
227 static typename cast_retty<To, FromTy>::ret_type doit(const FromTy &Val) {
227 static typename cast_retty<To, FromTy>::ret_type doit(const FromTy &Val) {
227 static typename cast_retty<To, FromTy>::ret_type doit(const FromTy &Val) {
228 typename cast_retty<To, FromTy>::ret_type Res2
228 typename cast_retty<To, FromTy>::ret_type Res2
236 std::is_same<X, typename simplify_type<X>::SimpleType>::value;
236 std::is_same<X, typename simplify_type<X>::SimpleType>::value;
248 typename cast_retty<X, const Y>::ret_type>::type
252 X, const Y, typename simplify_type<const Y>::SimpleType>::doit(Val);
256 inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
256 inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
256 inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
258 return cast_convert_val<X, Y,
258 return cast_convert_val<X, Y,
259 typename simplify_type<Y>::SimpleType>::doit(Val);
263 inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
263 inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
263 inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
265 return cast_convert_val<X, Y*,
265 return cast_convert_val<X, Y*,
266 typename simplify_type<Y*>::SimpleType>::doit(Val);
331 typename cast_retty<X, const Y>::ret_type>::type
333 return isa<X>(Val) ? cast<X>(Val) : nullptr;
333 return isa<X>(Val) ? cast<X>(Val) : nullptr;
337 LLVM_NODISCARD inline typename cast_retty<X, Y>::ret_type dyn_cast(Y &Val) {
338 return isa<X>(Val) ? cast<X>(Val) : nullptr;
338 return isa<X>(Val) ? cast<X>(Val) : nullptr;
342 LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type dyn_cast(Y *Val) {
342 LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type dyn_cast(Y *Val) {
342 LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type dyn_cast(Y *Val) {
343 return isa<X>(Val) ? cast<X>(Val) : nullptr;
343 return isa<X>(Val) ? cast<X>(Val) : nullptr;
366 LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type
368 return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr;
368 return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr;
include/llvm/Support/type_traits.h 55 struct add_const_past_pointer { using type = const T; };
include/llvm/Transforms/Scalar/JumpThreading.h 137 bool ProcessBranchOnXOR(BinaryOperator *BO);
include/llvm/Transforms/Scalar/NaryReassociate.h 139 Instruction *tryReassociateBinaryOp(BinaryOperator *I);
144 BinaryOperator *I);
147 BinaryOperator *I);
150 bool matchTernaryOp(BinaryOperator *I, Value *V, Value *&Op1, Value *&Op2);
153 const SCEV *getBinarySCEV(BinaryOperator *I, const SCEV *LHS,
include/llvm/Transforms/Scalar/Reassociate.h 103 void ReassociateExpression(BinaryOperator *I);
104 void RewriteExprTree(BinaryOperator *I,
106 Value *OptimizeExpression(BinaryOperator *I,
119 Value *OptimizeMul(BinaryOperator *I,
include/llvm/Transforms/Utils/IntegerDivision.h 32 bool expandRemainder(BinaryOperator *Rem);
41 bool expandDivision(BinaryOperator* Div);
49 bool expandRemainderUpTo32Bits(BinaryOperator *Rem);
55 bool expandRemainderUpTo64Bits(BinaryOperator *Rem);
62 bool expandDivisionUpTo32Bits(BinaryOperator *Div);
68 bool expandDivisionUpTo64Bits(BinaryOperator *Div);
lib/Analysis/BasicAliasAnalysis.cpp 301 if (const BinaryOperator *BOp = dyn_cast<BinaryOperator>(V)) {
301 if (const BinaryOperator *BOp = dyn_cast<BinaryOperator>(V)) {
lib/Analysis/BranchProbabilityInfo.cpp 509 SmallVector<BinaryOperator *, 1> InstChain;
510 while (!CmpPHI && CmpLHS && isa<BinaryOperator>(CmpLHS) &&
515 InstChain.push_back(cast<BinaryOperator>(CmpLHS));
lib/Analysis/CFLGraph.h 287 void visitBinaryOperator(BinaryOperator &Inst) {
lib/Analysis/IVDescriptors.cpp 777 const SCEV *Step, BinaryOperator *BOp,
852 BinaryOperator *BOp = dyn_cast<BinaryOperator>(BEValue);
852 BinaryOperator *BOp = dyn_cast<BinaryOperator>(BEValue);
931 const BinaryOperator *BinOp = dyn_cast<BinaryOperator>(Val);
931 const BinaryOperator *BinOp = dyn_cast<BinaryOperator>(Val);
1061 BinaryOperator *BOp =
1062 dyn_cast<BinaryOperator>(Phi->getIncomingValueForBlock(Latch));
lib/Analysis/InlineCost.cpp 274 bool visitSub(BinaryOperator &I);
275 bool visitBinaryOperator(BinaryOperator &I);
1037 bool CallAnalyzer::visitSub(BinaryOperator &I) {
1064 bool CallAnalyzer::visitBinaryOperator(BinaryOperator &I) {
lib/Analysis/InstructionSimplify.cpp 74 BinaryOperator::BinaryOps BinOpCode;
75 if (auto *BO = dyn_cast<BinaryOperator>(Cond))
75 if (auto *BO = dyn_cast<BinaryOperator>(Cond))
81 if (BinOpCode == BinaryOperator::Or) {
83 } else if (BinOpCode == BinaryOperator::And) {
109 return BinOpCode == BinaryOperator::Or ? TrueVal : FalseVal;
179 if (BinaryOperator *Op0 = dyn_cast<BinaryOperator>(LHS))
179 if (BinaryOperator *Op0 = dyn_cast<BinaryOperator>(LHS))
202 if (BinaryOperator *Op1 = dyn_cast<BinaryOperator>(RHS))
202 if (BinaryOperator *Op1 = dyn_cast<BinaryOperator>(RHS))
239 BinaryOperator *Op0 = dyn_cast<BinaryOperator>(LHS);
239 BinaryOperator *Op0 = dyn_cast<BinaryOperator>(LHS);
240 BinaryOperator *Op1 = dyn_cast<BinaryOperator>(RHS);
240 BinaryOperator *Op1 = dyn_cast<BinaryOperator>(RHS);
1695 auto *AddInst = cast<BinaryOperator>(Op0->getOperand(0));
1695 auto *AddInst = cast<BinaryOperator>(Op0->getOperand(0));
2669 BinaryOperator *LBO = dyn_cast<BinaryOperator>(LHS);
2669 BinaryOperator *LBO = dyn_cast<BinaryOperator>(LHS);
2670 BinaryOperator *RBO = dyn_cast<BinaryOperator>(RHS);
2670 BinaryOperator *RBO = dyn_cast<BinaryOperator>(RHS);
3680 if (auto *B = dyn_cast<BinaryOperator>(I)) {
3680 if (auto *B = dyn_cast<BinaryOperator>(I)) {
5257 Q.IIQ.hasNoSignedWrap(cast<BinaryOperator>(I)),
5258 Q.IIQ.hasNoUnsignedWrap(cast<BinaryOperator>(I)), Q);
5267 Q.IIQ.hasNoSignedWrap(cast<BinaryOperator>(I)),
5268 Q.IIQ.hasNoUnsignedWrap(cast<BinaryOperator>(I)), Q);
5300 Q.IIQ.hasNoSignedWrap(cast<BinaryOperator>(I)),
5301 Q.IIQ.hasNoUnsignedWrap(cast<BinaryOperator>(I)), Q);
5305 Q.IIQ.isExact(cast<BinaryOperator>(I)), Q);
5309 Q.IIQ.isExact(cast<BinaryOperator>(I)), Q);
lib/Analysis/LazyValueInfo.cpp 429 bool solveBlockValueBinaryOp(ValueLatticeElement &BBLV, BinaryOperator *BBI,
651 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(BBI))
651 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(BBI))
1082 BinaryOperator *BO,
1294 BinaryOperator *BO = dyn_cast<BinaryOperator>(Cond);
1294 BinaryOperator *BO = dyn_cast<BinaryOperator>(Cond);
1295 if (!BO || (isTrueDest && BO->getOpcode() != BinaryOperator::And) ||
1296 (!isTrueDest && BO->getOpcode() != BinaryOperator::Or))
1341 return isa<CastInst>(Usr) || isa<BinaryOperator>(Usr);
1361 } else if (auto *BO = dyn_cast<BinaryOperator>(Usr)) {
1361 } else if (auto *BO = dyn_cast<BinaryOperator>(Usr)) {
lib/Analysis/Lint.cpp 107 void visitXor(BinaryOperator &I);
108 void visitSub(BinaryOperator &I);
109 void visitLShr(BinaryOperator &I);
110 void visitAShr(BinaryOperator &I);
111 void visitShl(BinaryOperator &I);
112 void visitSDiv(BinaryOperator &I);
113 void visitUDiv(BinaryOperator &I);
114 void visitSRem(BinaryOperator &I);
115 void visitURem(BinaryOperator &I);
518 void Lint::visitXor(BinaryOperator &I) {
523 void Lint::visitSub(BinaryOperator &I) {
528 void Lint::visitLShr(BinaryOperator &I) {
535 void Lint::visitAShr(BinaryOperator &I) {
542 void Lint::visitShl(BinaryOperator &I) {
584 void Lint::visitSDiv(BinaryOperator &I) {
589 void Lint::visitUDiv(BinaryOperator &I) {
594 void Lint::visitSRem(BinaryOperator &I) {
599 void Lint::visitURem(BinaryOperator &I) {
lib/Analysis/Loads.cpp 187 if (isa<BinaryOperator>(A) || isa<CastInst>(A) || isa<PHINode>(A) ||
lib/Analysis/LoopAccessAnalysis.cpp 2266 Instruction *Check = BinaryOperator::CreateAnd(MemoryRuntimeCheck,
lib/Analysis/LoopUnrollAnalyzer.cpp 68 bool UnrolledInstAnalyzer::visitBinaryOperator(BinaryOperator &I) {
lib/Analysis/PHITransAddr.cpp 257 bool isNSW = cast<BinaryOperator>(Inst)->hasNoSignedWrap();
258 bool isNUW = cast<BinaryOperator>(Inst)->hasNoUnsignedWrap();
264 if (BinaryOperator *BOp = dyn_cast<BinaryOperator>(LHS))
264 if (BinaryOperator *BOp = dyn_cast<BinaryOperator>(LHS))
292 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(U))
292 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(U))
lib/Analysis/ScalarEvolution.cpp 5968 const BinaryOperator *BinOp = cast<BinaryOperator>(V);
5968 const BinaryOperator *BinOp = cast<BinaryOperator>(V);
6334 if (auto *LBO = dyn_cast<BinaryOperator>(BO->LHS))
6334 if (auto *LBO = dyn_cast<BinaryOperator>(BO->LHS))
7227 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(ExitCond)) {
7227 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(ExitCond)) {
7712 if (isa<BinaryOperator>(I) || isa<CmpInst>(I) ||
8878 return A->isIdenticalTo(B) && (isa<BinaryOperator>(A) || isa<GetElementPtrInst>(A));
9683 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(FoundCondValue)) {
9683 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(FoundCondValue)) {
lib/Analysis/ScalarEvolutionExpander.cpp 1320 cast<BinaryOperator>(IncV)->setHasNoUnsignedWrap();
1322 cast<BinaryOperator>(IncV)->setHasNoSignedWrap();
1583 Instruction *Add = BinaryOperator::CreateAdd(CanonicalIV, One,
lib/Analysis/ValueTracking.cpp 1949 if (auto *BO = dyn_cast<BinaryOperator>(Curr))
2250 const BinaryOperator *BO = dyn_cast<BinaryOperator>(V1);
2250 const BinaryOperator *BO = dyn_cast<BinaryOperator>(V1);
5315 static Optional<bool> isImpliedCondAndOr(const BinaryOperator *LHS,
5377 const BinaryOperator *LHSBO = dyn_cast<BinaryOperator>(LHS);
5377 const BinaryOperator *LHSBO = dyn_cast<BinaryOperator>(LHS);
5418 static void setLimitsForBinOp(const BinaryOperator &BO, APInt &Lower,
5698 if (auto *BO = dyn_cast<BinaryOperator>(V))
lib/AsmParser/LLParser.cpp 5735 if (NUW) cast<BinaryOperator>(Inst)->setHasNoUnsignedWrap(true);
5736 if (NSW) cast<BinaryOperator>(Inst)->setHasNoSignedWrap(true);
5760 if (Exact) cast<BinaryOperator>(Inst)->setIsExact(true);
6486 Inst = BinaryOperator::Create((Instruction::BinaryOps)Opc, LHS, RHS);
6503 Inst = BinaryOperator::Create((Instruction::BinaryOps)Opc, LHS, RHS);
lib/Bitcode/Reader/BitcodeReader.cpp 3897 I = BinaryOperator::Create((Instruction::BinaryOps)Opc, LHS, RHS);
3905 cast<BinaryOperator>(I)->setHasNoSignedWrap(true);
3907 cast<BinaryOperator>(I)->setHasNoUnsignedWrap(true);
3913 cast<BinaryOperator>(I)->setIsExact(true);
lib/CodeGen/CodeGenPrepare.cpp 367 bool optimizeShiftInst(BinaryOperator *BO);
391 bool replaceMathCmpWithIntrinsic(BinaryOperator *BO, CmpInst *Cmp,
1179 bool CodeGenPrepare::replaceMathCmpWithIntrinsic(BinaryOperator *BO,
1228 BinaryOperator *&Add) {
1249 Add = cast<BinaryOperator>(U);
1261 BinaryOperator *Add;
1314 BinaryOperator *Sub = nullptr;
1318 Sub = cast<BinaryOperator>(U);
1326 Sub = cast<BinaryOperator>(U);
1485 BinaryOperator::Create(Instruction::And, AndI->getOperand(0),
1522 SinkShiftAndTruncate(BinaryOperator *ShiftI, Instruction *User, ConstantInt *CI,
1523 DenseMap<BasicBlock *, BinaryOperator *> &InsertedShifts,
1562 BinaryOperator *&InsertedShift = InsertedShifts[TruncUserBB];
1570 InsertedShift = BinaryOperator::CreateAShr(ShiftI->getOperand(0), CI,
1573 InsertedShift = BinaryOperator::CreateLShr(ShiftI->getOperand(0), CI,
1611 static bool OptimizeExtractBits(BinaryOperator *ShiftI, ConstantInt *CI,
1617 DenseMap<BasicBlock *, BinaryOperator *> InsertedShifts;
1664 BinaryOperator *&InsertedShift = InsertedShifts[UserBB];
1671 InsertedShift = BinaryOperator::CreateAShr(ShiftI->getOperand(0), CI,
1674 InsertedShift = BinaryOperator::CreateLShr(ShiftI->getOperand(0), CI,
3738 const BinaryOperator *BinOp = dyn_cast<BinaryOperator>(Inst);
3738 const BinaryOperator *BinOp = dyn_cast<BinaryOperator>(Inst);
5898 bool CodeGenPrepare::optimizeShiftInst(BinaryOperator *Shift) {
5922 BinaryOperator::BinaryOps Opcode = Shift->getOpcode();
6474 return isa<BinaryOperator>(ToBePromoted);
7010 BinaryOperator *BinOp = dyn_cast<BinaryOperator>(I);
7010 BinaryOperator *BinOp = dyn_cast<BinaryOperator>(I);
7050 return optimizeShiftInst(cast<BinaryOperator>(I));
7195 BinaryOperator *LogicOp;
lib/CodeGen/InterleavedLoadCombinePass.cpp 902 static void computePolynomialBinOp(BinaryOperator &BO, Polynomial &Result) {
943 if (auto *BO = dyn_cast<BinaryOperator>(&V))
943 if (auto *BO = dyn_cast<BinaryOperator>(&V))
lib/CodeGen/SelectionDAG/FastISel.cpp 634 if (ISDOpcode == ISD::SDIV && isa<BinaryOperator>(I) &&
635 cast<BinaryOperator>(I)->isExact() && isPowerOf2_64(Imm)) {
641 if (ISDOpcode == ISD::UREM && isa<BinaryOperator>(I) &&
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp 2106 if (!BOp || !(isa<BinaryOperator>(BOp) || isa<CmpInst>(BOp)) ||
2262 if (const BinaryOperator *BOp = dyn_cast<BinaryOperator>(CondVal)) {
2262 if (const BinaryOperator *BOp = dyn_cast<BinaryOperator>(CondVal)) {
lib/ExecutionEngine/Interpreter/Execution.cpp 734 void Interpreter::visitBinaryOperator(BinaryOperator &I) {
1189 void Interpreter::visitShl(BinaryOperator &I) {
1216 void Interpreter::visitLShr(BinaryOperator &I) {
1243 void Interpreter::visitAShr(BinaryOperator &I) {
lib/ExecutionEngine/Interpreter/Interpreter.h 128 void visitBinaryOperator(BinaryOperator &I);
158 void visitShl(BinaryOperator &I);
159 void visitLShr(BinaryOperator &I);
160 void visitAShr(BinaryOperator &I);
lib/FuzzMutate/Operations.cpp 94 return BinaryOperator::Create(Op, Srcs[0], Srcs[1], "B", Inst);
lib/IR/Constants.cpp 3034 BinaryOperator *BO =
3035 BinaryOperator::Create((Instruction::BinaryOps)getOpcode(),
lib/IR/Instructions.cpp 557 AllocSize = BinaryOperator::CreateMul(ArraySize, AllocSize,
560 AllocSize = BinaryOperator::CreateMul(ArraySize, AllocSize,
2248 OperandTraits<BinaryOperator>::op_begin(this),
2249 OperandTraits<BinaryOperator>::operands(this),
2261 OperandTraits<BinaryOperator>::op_begin(this),
2262 OperandTraits<BinaryOperator>::operands(this),
2338 BinaryOperator *BinaryOperator::Create(BinaryOps Op, Value *S1, Value *S2,
2343 return new BinaryOperator(Op, S1, S2, S1->getType(), Name, InsertBefore);
2346 BinaryOperator *BinaryOperator::Create(BinaryOps Op, Value *S1, Value *S2,
2349 BinaryOperator *Res = Create(Op, S1, S2, Name);
2354 BinaryOperator *BinaryOperator::CreateNeg(Value *Op, const Twine &Name,
2357 return new BinaryOperator(Instruction::Sub,
2362 BinaryOperator *BinaryOperator::CreateNeg(Value *Op, const Twine &Name,
2365 return new BinaryOperator(Instruction::Sub,
2370 BinaryOperator *BinaryOperator::CreateNSWNeg(Value *Op, const Twine &Name,
2373 return BinaryOperator::CreateNSWSub(zero, Op, Name, InsertBefore);
2376 BinaryOperator *BinaryOperator::CreateNSWNeg(Value *Op, const Twine &Name,
2379 return BinaryOperator::CreateNSWSub(zero, Op, Name, InsertAtEnd);
2382 BinaryOperator *BinaryOperator::CreateNUWNeg(Value *Op, const Twine &Name,
2385 return BinaryOperator::CreateNUWSub(zero, Op, Name, InsertBefore);
2388 BinaryOperator *BinaryOperator::CreateNUWNeg(Value *Op, const Twine &Name,
2391 return BinaryOperator::CreateNUWSub(zero, Op, Name, InsertAtEnd);
2394 BinaryOperator *BinaryOperator::CreateFNeg(Value *Op, const Twine &Name,
2397 return new BinaryOperator(Instruction::FSub, zero, Op,
2401 BinaryOperator *BinaryOperator::CreateFNeg(Value *Op, const Twine &Name,
2404 return new BinaryOperator(Instruction::FSub, zero, Op,
2408 BinaryOperator *BinaryOperator::CreateNot(Value *Op, const Twine &Name,
2411 return new BinaryOperator(Instruction::Xor, Op, C,
2415 BinaryOperator *BinaryOperator::CreateNot(Value *Op, const Twine &Name,
2418 return new BinaryOperator(Instruction::Xor, Op, AllOnes,
4109 BinaryOperator *BinaryOperator::cloneImpl() const {
lib/IR/Verifier.cpp 453 void visitBinaryOperator(BinaryOperator &B);
3158 void Verifier::visitBinaryOperator(BinaryOperator &B) {
lib/Target/AArch64/AArch64FastISel.cpp 757 if (const auto *AI = dyn_cast<BinaryOperator>(Src))
757 if (const auto *AI = dyn_cast<BinaryOperator>(Src))
1197 if (const auto *SI = dyn_cast<BinaryOperator>(LHS))
1197 if (const auto *SI = dyn_cast<BinaryOperator>(LHS))
1232 if (const auto *SI = dyn_cast<BinaryOperator>(RHS))
1232 if (const auto *SI = dyn_cast<BinaryOperator>(RHS))
1277 if (const auto *SI = dyn_cast<BinaryOperator>(RHS)) {
1277 if (const auto *SI = dyn_cast<BinaryOperator>(RHS)) {
2338 if (const auto *AI = dyn_cast<BinaryOperator>(LHS))
2338 if (const auto *AI = dyn_cast<BinaryOperator>(LHS))
4938 if (cast<BinaryOperator>(I)->isExact()) {
lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp 87 bool isSigned(const BinaryOperator &I) const;
108 bool promoteUniformOpToI32(BinaryOperator &I) const;
151 bool replaceMulWithMul24(BinaryOperator &I) const;
154 Value* expandDivRem24(IRBuilder<> &Builder, BinaryOperator &I,
159 Value* expandDivRem32(IRBuilder<> &Builder, BinaryOperator &I,
177 bool visitFDiv(BinaryOperator &I);
180 bool visitBinaryOperator(BinaryOperator &I);
218 bool AMDGPUCodeGenPrepare::isSigned(const BinaryOperator &I) const {
283 bool AMDGPUCodeGenPrepare::promoteUniformOpToI32(BinaryOperator &I) const {
460 bool AMDGPUCodeGenPrepare::replaceMulWithMul24(BinaryOperator &I) const {
543 bool AMDGPUCodeGenPrepare::visitFDiv(BinaryOperator &FDiv) {
636 BinaryOperator &I,
740 BinaryOperator &I,
885 bool AMDGPUCodeGenPrepare::visitBinaryOperator(BinaryOperator &I) {
lib/Target/AMDGPU/AMDGPUPerfHintAnalysis.cpp 182 if (auto BO = dyn_cast<BinaryOperator>(V)) {
lib/Target/ARM/ARMCodeGenPrepare.cpp 808 return isa<BinaryOperator>(I) && isSupportedType(I) &&
lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp 635 auto *BO = dyn_cast<BinaryOperator>(IterV);
635 auto *BO = dyn_cast<BinaryOperator>(IterV);
1603 return B.CreateBinOp(cast<BinaryOperator>(T)->getOpcode(),
1629 BinaryOperator *BO = dyn_cast<BinaryOperator>(I);
1629 BinaryOperator *BO = dyn_cast<BinaryOperator>(I);
1687 BinaryOperator *BitOp = dyn_cast<BinaryOperator>(I->getOperand(0));
1687 BinaryOperator *BitOp = dyn_cast<BinaryOperator>(I->getOperand(0));
1716 BinaryOperator *BitOp1 = dyn_cast<BinaryOperator>(I);
1716 BinaryOperator *BitOp1 = dyn_cast<BinaryOperator>(I);
1719 BinaryOperator *BitOp2 = dyn_cast<BinaryOperator>(BitOp1->getOperand(0));
1719 BinaryOperator *BitOp2 = dyn_cast<BinaryOperator>(BitOp1->getOperand(0));
lib/Target/Hexagon/HexagonOptimizeSZextends.cpp 105 BinaryOperator *Ashr = dyn_cast<BinaryOperator>(&I);
105 BinaryOperator *Ashr = dyn_cast<BinaryOperator>(&I);
lib/Target/PowerPC/PPCTargetTransformInfo.cpp 432 } else if (isa<BinaryOperator>(J) &&
lib/Target/SystemZ/SystemZTDC.cpp 79 std::vector<BinaryOperator *> LogicOpsWorklist;
91 void convertLogicOp(BinaryOperator &I);
100 auto *LI = dyn_cast<BinaryOperator>(U);
100 auto *LI = dyn_cast<BinaryOperator>(U);
286 void SystemZTDCPass::convertLogicOp(BinaryOperator &I) {
330 BinaryOperator *Op = LogicOpsWorklist.back();
lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp 890 BinaryOperator *SetjmpTableSize = BinaryOperator::Create(
890 BinaryOperator *SetjmpTableSize = BinaryOperator::Create(
lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp 234 if (!matchAndOrChain(cast<BinaryOperator>(&I), MOps) || !MOps.FoundAnd1)
237 if (!matchAndOrChain(cast<BinaryOperator>(&I)->getOperand(0), MOps))
lib/Transforms/Coroutines/CoroFrame.cpp 943 isa<BinaryOperator>(&V) || isa<CmpInst>(&V) || isa<SelectInst>(&V);
lib/Transforms/IPO/GlobalOpt.cpp 925 LV = BinaryOperator::CreateNot(LV, "notinit", ICI);
1342 RunningOr = BinaryOperator::CreateOr(RunningOr, Cond, "tmp", CI);
lib/Transforms/InstCombine/InstCombineAddSub.cpp 769 static Value *checkForNegativeOperand(BinaryOperator &I,
826 static Instruction *foldNoWrapAdd(BinaryOperator &Add,
853 return BinaryOperator::CreateAdd(WideX, NewC);
860 return BinaryOperator::CreateAdd(WideX, NewC);
866 Instruction *InstCombiner::foldAddWithConstant(BinaryOperator &Add) {
880 return BinaryOperator::CreateSub(ConstantExpr::getAdd(Op00C, Op1C), X);
887 return BinaryOperator::CreateAdd(Builder.CreateNot(Y), X);
896 return BinaryOperator::CreateSub(SubOne(Op1C), X);
905 return BinaryOperator::CreateXor(Op0, ConstantInt::get(Add.getType(), *C2));
911 return BinaryOperator::CreateOr(Op0, Op1);
915 return BinaryOperator::CreateXor(Op0, Op1);
941 return BinaryOperator::CreateAnd(NotX, ConstantInt::get(Ty, 1));
1023 Value *InstCombiner::SimplifyAddWithRemainder(BinaryOperator &I) {
1060 static Instruction *canonicalizeLowbitMask(BinaryOperator &I,
1069 if (auto *BOp = dyn_cast<BinaryOperator>(NotMask)) {
1069 if (auto *BOp = dyn_cast<BinaryOperator>(NotMask)) {
1075 return BinaryOperator::CreateNot(NotMask, I.getName());
1078 static Instruction *foldToUnsignedSaturatedAdd(BinaryOperator &I) {
1102 BinaryOperator &I) {
1191 auto *NewAShr = BinaryOperator::CreateAShr(X, LowBitsToSkip,
1191 auto *NewAShr = BinaryOperator::CreateAShr(X, LowBitsToSkip,
1201 Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
1251 return BinaryOperator::CreateAShr(NewShl, ShAmt);
1259 return BinaryOperator::CreateSub(ConstantExpr::getAdd(XorRHS, CI),
1265 return BinaryOperator::CreateAdd(XorLHS,
1271 return BinaryOperator::CreateXor(LHS, RHS);
1275 auto *Shl = BinaryOperator::CreateShl(LHS, ConstantInt::get(Ty, 1));
1275 auto *Shl = BinaryOperator::CreateShl(LHS, ConstantInt::get(Ty, 1));
1285 return BinaryOperator::CreateNeg(Builder.CreateAdd(A, B));
1288 return BinaryOperator::CreateSub(RHS, A);
1295 return BinaryOperator::CreateSub(A, Builder.CreateZExt(B, Ty));
1299 return BinaryOperator::CreateSub(LHS, B);
1310 return BinaryOperator::CreateSub(A, B);
1317 return BinaryOperator::CreateOr(LHS, RHS);
1342 return BinaryOperator::CreateAnd(NewAdd, C2);
1379 return BinaryOperator::CreateOr(A, B);
1417 static Instruction *factorizeLerp(BinaryOperator &I,
1429 return BinaryOperator::CreateFAddFMF(Y, MulZ, &I);
1433 static Instruction *factorizeFAddFSub(BinaryOperator &I,
1471 return IsFMul ? BinaryOperator::CreateFMulFMF(XY, Z, &I)
1472 : BinaryOperator::CreateFDivFMF(XY, Z, &I);
1475 Instruction *InstCombiner::visitFAdd(BinaryOperator &I) {
1493 return BinaryOperator::CreateFSubFMF(Y, X, &I);
1501 return BinaryOperator::CreateFSubFMF(Z, XY, &I);
1510 return BinaryOperator::CreateFSubFMF(Z, XY, &I);
1672 Instruction *InstCombiner::visitSub(BinaryOperator &I) {
1688 BinaryOperator *Res = BinaryOperator::CreateAdd(Op0, V);
1688 BinaryOperator *Res = BinaryOperator::CreateAdd(Op0, V);
1690 if (const auto *BO = dyn_cast<BinaryOperator>(Op1)) {
1690 if (const auto *BO = dyn_cast<BinaryOperator>(Op1)) {
1704 return BinaryOperator::CreateXor(Op0, Op1);
1708 return BinaryOperator::CreateNot(Op1);
1713 return BinaryOperator::CreateSub(Y, X);
1717 return BinaryOperator::CreateAdd(Builder.CreateNot(Op1), X);
1721 return BinaryOperator::CreateAdd(Builder.CreateNot(X), Op0);
1725 return BinaryOperator::CreateAdd(
1749 return BinaryOperator::CreateAdd(X, AddOne(C));
1765 return BinaryOperator::CreateAdd(X, ConstantExpr::getSub(C, C2));
1769 return BinaryOperator::CreateSub(ConstantExpr::getSub(C, C2), X);
1789 Instruction *NewShift = BinaryOperator::CreateAShr(X, ShAmtOp);
1801 Instruction *NewShift = BinaryOperator::CreateLShr(X, ShAmtOp);
1827 return BinaryOperator::CreateXor(Op1, Op0);
1835 return BinaryOperator::CreateNeg(Y);
1839 return BinaryOperator::CreateNeg(Y);
1847 return BinaryOperator::CreateXor(A, B);
1856 return BinaryOperator::CreateNeg(Builder.CreateXor(A, B));
1864 return BinaryOperator::CreateAnd(A, B);
1873 return BinaryOperator::CreateNeg(Builder.CreateAnd(A, B));
1880 return BinaryOperator::CreateAnd(
1890 return BinaryOperator::CreateAdd(Op0,
1895 return BinaryOperator::CreateAnd(Op0,
1904 Instruction *BO = BinaryOperator::CreateSDiv(X, NegDivC);
1905 BO->setIsExact(cast<BinaryOperator>(Op1)->isExact());
1912 return BinaryOperator::CreateShl(XNeg, Y);
1920 BinaryOperator *Add = BinaryOperator::CreateAdd(Op0, Zext);
1920 BinaryOperator *Add = BinaryOperator::CreateAdd(Op0, Zext);
1929 return BinaryOperator::CreateAdd(Op0, Builder.CreateMul(A, B));
1936 return BinaryOperator::CreateAdd(Op0, NewMul);
1966 return BinaryOperator::CreateSub(Not, A);
1968 return BinaryOperator::CreateSub(A, Not);
2040 return BinaryOperator::CreateFMulFMF(X, ConstantExpr::getFNeg(C), &I);
2043 return BinaryOperator::CreateFDivFMF(X, ConstantExpr::getFNeg(C), &I);
2046 return BinaryOperator::CreateFDivFMF(ConstantExpr::getFNeg(C), X, &I);
2059 return BinaryOperator::CreateFMulFMF(Builder.CreateFNegFMF(X, &I), Y, &I);
2062 return BinaryOperator::CreateFDivFMF(Builder.CreateFNegFMF(X, &I), Y, &I);
2082 return BinaryOperator::CreateFSubFMF(Y, X, &I);
2090 Instruction *InstCombiner::visitFSub(BinaryOperator &I) {
2103 return BinaryOperator::CreateFNegFMF(Op1, &I);
2123 return BinaryOperator::CreateFAddFMF(Op0, NewSub, &I);
2136 return BinaryOperator::CreateFAddFMF(Op0, ConstantExpr::getFNeg(C), &I);
2140 return BinaryOperator::CreateFAddFMF(Op0, Y, &I);
2146 return BinaryOperator::CreateFAddFMF(Op0, Builder.CreateFPTrunc(Y, Ty), &I);
2150 return BinaryOperator::CreateFAddFMF(Op0, Builder.CreateFPExt(Y, Ty), &I);
2157 return BinaryOperator::CreateFAddFMF(Op0, FMul, &I);
2164 return BinaryOperator::CreateFAddFMF(Op0, FDiv, &I);
2174 return BinaryOperator::CreateFNegFMF(X, &I);
2179 return BinaryOperator::CreateFNegFMF(X, &I);
2184 return BinaryOperator::CreateFMulFMF(Op1, CSubOne, &I);
2189 return BinaryOperator::CreateFMulFMF(Op0, OneSubC, &I);
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp 82 static Value *SimplifyBSwap(BinaryOperator &I,
117 Instruction *InstCombiner::OptAndOp(BinaryOperator *Op,
120 BinaryOperator &TheAnd) {
152 return BinaryOperator::CreateXor(NewAnd, AndRHS);
1413 static Instruction *reassociateFCmps(BinaryOperator &BO,
1427 BinaryOperator *BO1;
1452 return BinaryOperator::Create(Opcode, NewFCmp, BO11);
1458 static Instruction *matchDeMorgansLaws(BinaryOperator &I,
1473 return BinaryOperator::CreateNot(AndOr);
1496 static Instruction *foldLogicCastConstant(BinaryOperator &Logic, CastInst *Cast,
1535 Instruction *InstCombiner::foldCastedBitwiseLogic(BinaryOperator &I) {
1601 static Instruction *foldAndToXor(BinaryOperator &I,
1613 return BinaryOperator::CreateXor(A, B);
1622 return BinaryOperator::CreateNot(Builder.CreateXor(A, B));
1627 static Instruction *foldOrToXor(BinaryOperator &I,
1640 return BinaryOperator::CreateNot(Builder.CreateXor(A, B));
1648 return BinaryOperator::CreateXor(A, B);
1681 Instruction *InstCombiner::narrowMaskedBinOp(BinaryOperator &And) {
1707 Instruction::BinaryOps Opc = cast<BinaryOperator>(Op0)->getOpcode();
1723 Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
1768 return BinaryOperator::CreateXor(And, NewC);
1783 return BinaryOperator::CreateOr(And, ConstantInt::get(I.getType(),
1791 BinaryOperator::BinaryOps BinOp = cast<BinaryOperator>(Op0)->getOpcode();
1791 BinaryOperator::BinaryOps BinOp = cast<BinaryOperator>(Op0)->getOpcode();
1796 return BinaryOperator::Create(BinOp, X, NewRHS);
1802 return BinaryOperator::Create(BinOp, NewLHS, Y);
1812 if (BinaryOperator *Op0I = dyn_cast<BinaryOperator>(Op0)) {
1812 if (BinaryOperator *Op0I = dyn_cast<BinaryOperator>(Op0)) {
1862 return BinaryOperator::CreateAnd(NewCast, C3);
1880 return BinaryOperator::CreateAnd(Op0, Builder.CreateNot(B));
1883 return BinaryOperator::CreateAnd(Op1, Builder.CreateNot(B));
1889 return BinaryOperator::CreateAnd(Op0, Builder.CreateNot(C));
1895 return BinaryOperator::CreateAnd(Op1, Builder.CreateNot(C));
1903 return BinaryOperator::CreateAnd(A, B);
1911 return BinaryOperator::CreateAnd(A, B);
1979 Instruction *InstCombiner::matchBSwap(BinaryOperator &Or) {
2037 BinaryOperator *Or0, *Or1;
2047 BinaryOperator::BinaryOps ShiftOpcode0 = Or0->getOpcode();
2048 BinaryOperator::BinaryOps ShiftOpcode1 = Or1->getOpcode();
2082 bool IsFshl = (!SubIsOnLHS && ShiftOpcode0 == BinaryOperator::Shl) ||
2083 (SubIsOnLHS && ShiftOpcode1 == BinaryOperator::Shl);
2448 Instruction *InstCombiner::visitOr(BinaryOperator &I) {
2491 return BinaryOperator::CreateXor(Or, ConstantInt::get(I.getType(), *CV));
2511 return BinaryOperator::CreateAnd(A,
2519 return BinaryOperator::CreateAnd(B,
2530 return BinaryOperator::CreateAnd(V2,
2540 return BinaryOperator::CreateOr(Builder.CreateAnd(X, C1), B);
2543 return BinaryOperator::CreateOr(Builder.CreateAnd(X, C2), A);
2547 return BinaryOperator::CreateXor(Builder.CreateAnd(X, C1), B);
2550 return BinaryOperator::CreateXor(Builder.CreateAnd(X, C2), A);
2581 return BinaryOperator::CreateOr(Op0, C);
2586 return BinaryOperator::CreateOr(Op1, C);
2590 return BinaryOperator::CreateOr(Op1, Builder.CreateAnd(A, C));
2607 return BinaryOperator::CreateOr(A, B);
2611 return BinaryOperator::CreateOr(A, B);
2615 return BinaryOperator::CreateOr(Not, Op0);
2619 return BinaryOperator::CreateOr(Not, Op0);
2626 if (BinaryOperator *B = dyn_cast<BinaryOperator>(A))
2626 if (BinaryOperator *B = dyn_cast<BinaryOperator>(A))
2633 return BinaryOperator::CreateOr(Not, Op0);
2696 return BinaryOperator::CreateOr(Inner, CI);
2737 static Instruction *foldXorToXor(BinaryOperator &I,
2792 return BinaryOperator::CreateNot(Builder.CreateXor(A, B));
2798 BinaryOperator &I) {
2907 static Instruction *visitMaskedMerge(BinaryOperator &I,
2922 return BinaryOperator::CreateXor(NewA, X);
2931 return BinaryOperator::CreateOr(LHS, RHS);
2943 static Instruction *sinkNotIntoXor(BinaryOperator &I,
2960 return BinaryOperator::CreateXor(NotX, Y, I.getName() + ".demorgan");
2966 Instruction *InstCombiner::visitXor(BinaryOperator &I) {
3001 return BinaryOperator::CreateOr(Op0, Op1);
3012 return BinaryOperator::CreateOr(X, NotY);
3018 return BinaryOperator::CreateAnd(X, NotY);
3025 BinaryOperator *NotVal;
3039 return BinaryOperator::CreateOr(NotX, NotY);
3040 return BinaryOperator::CreateAnd(NotX, NotY);
3047 return BinaryOperator::CreateAdd(Builder.CreateNot(X), Y);
3051 return BinaryOperator::CreateAShr(X, Y);
3062 return BinaryOperator::CreateLShr(ConstantExpr::getNot(C), Y);
3067 return BinaryOperator::CreateAShr(ConstantExpr::getNot(C), Y);
3071 return BinaryOperator::CreateSub(ConstantExpr::getNeg(AddOne(C)), X);
3081 return BinaryOperator::CreateXor(And, ConstantExpr::getNot(C1));
3086 return BinaryOperator::CreateXor(Or, ConstantExpr::getNot(C1));
3105 return BinaryOperator::CreateSub(NewC, X);
3110 return BinaryOperator::CreateAdd(X, NewC);
3126 if (BinaryOperator *Op0I = dyn_cast<BinaryOperator>(Op0)) {
3126 if (BinaryOperator *Op0I = dyn_cast<BinaryOperator>(Op0)) {
3131 BinaryOperator *E1;
3134 (E1 = dyn_cast<BinaryOperator>(Op0I->getOperand(0))) &&
3147 return BinaryOperator::CreateXor(Opnd0, FoldVal);
3160 return BinaryOperator::CreateAnd(X, Builder.CreateNot(Op0));
3164 return BinaryOperator::CreateAnd(X, Builder.CreateNot(Op1));
3169 return BinaryOperator::CreateAnd(Op0, Builder.CreateNot(X));
3177 return BinaryOperator::CreateAnd(Op1, Builder.CreateNot(X));
3183 return BinaryOperator::CreateXor(
3189 return BinaryOperator::CreateXor(
3195 return BinaryOperator::CreateOr(A, B);
3199 return BinaryOperator::CreateOr(A, B);
3205 return BinaryOperator::CreateNot(Builder.CreateAnd(A, B));
3233 auto *Add = cast<BinaryOperator>(Op0);
3233 auto *Add = cast<BinaryOperator>(Op0);
lib/Transforms/InstCombine/InstCombineCalls.cpp 1726 return BinaryOperator::Create(*Action.BinaryOp, II->getArgOperand(0),
1741 return BinaryOperator::Create(
1924 return BinaryOperator::CreateFDiv(ConstantFP::get(CI.getType(), 1.0),
1928 return BinaryOperator::CreateFMul(II->getArgOperand(0),
1979 return BinaryOperator::CreateShl(Op0, ShAmtC);
1984 return BinaryOperator::CreateLShr(Op1,
2093 return BinaryOperator::CreateNSW(SI->getBinaryOp(), Arg0, Arg1);
2095 return BinaryOperator::CreateNUW(SI->getBinaryOp(), Arg0, Arg1);
2186 Instruction *FNeg = BinaryOperator::CreateFNeg(NewCall);
2241 auto *FAdd = BinaryOperator::CreateFAdd(V, II->getArgOperand(2));
2241 auto *FAdd = BinaryOperator::CreateFAdd(V, II->getArgOperand(2));
2275 auto *FAdd = BinaryOperator::CreateFAdd(V, II->getArgOperand(2));
2275 auto *FAdd = BinaryOperator::CreateFAdd(V, II->getArgOperand(2));
2325 Instruction *FNeg = BinaryOperator::CreateFNeg(NewSin);
lib/Transforms/InstCombine/InstCombineCasts.cpp 38 if (BinaryOperator *I = dyn_cast<BinaryOperator>(Val)) {
38 if (BinaryOperator *I = dyn_cast<BinaryOperator>(Val)) {
189 Res = BinaryOperator::Create((Instruction::BinaryOps)Opc, LHS, RHS);
518 auto ShiftOpcode0 = cast<BinaryOperator>(Or0)->getOpcode();
519 auto ShiftOpcode1 = cast<BinaryOperator>(Or1)->getOpcode();
569 bool IsFshl = (!SubIsOnLHS && ShiftOpcode0 == BinaryOperator::Shl) ||
570 (SubIsOnLHS && ShiftOpcode1 == BinaryOperator::Shl);
585 BinaryOperator *BinOp;
603 return BinaryOperator::Create(BinOp->getOpcode(), NarrowC, TruncX);
609 return BinaryOperator::Create(BinOp->getOpcode(), TruncX, NarrowC);
615 return BinaryOperator::Create(BinOp->getOpcode(), X, NarrowOp1);
620 return BinaryOperator::Create(BinOp->getOpcode(), NarrowOp0, X);
802 return BinaryOperator::CreateAShr(A, ConstantInt::get(CI.getType(),
833 return BinaryOperator::Create(
1135 return BinaryOperator::CreateAnd(Res, C);
1163 return BinaryOperator::CreateAnd(A, ConstantInt::get(A->getType(),
1169 return BinaryOperator::CreateAnd(Trunc,
1178 BinaryOperator *SrcI = dyn_cast<BinaryOperator>(Src);
1178 BinaryOperator *SrcI = dyn_cast<BinaryOperator>(Src);
1191 BinaryOperator *Or = BinaryOperator::Create(Instruction::Or, LCast, RCast);
1191 BinaryOperator *Or = BinaryOperator::Create(Instruction::Or, LCast, RCast);
1209 return BinaryOperator::CreateAnd(X, ConstantExpr::getZExt(C, CI.getType()));
1217 return BinaryOperator::CreateXor(Builder.CreateAnd(X, ZC), ZC);
1398 return BinaryOperator::CreateAShr(Builder.CreateShl(Res, ShAmt, "sext"),
1410 return BinaryOperator::CreateAShr(Builder.CreateShl(X, ShAmt), ShAmt);
1440 return BinaryOperator::CreateAShr(A, ShAmtV);
1534 auto *BO = dyn_cast<BinaryOperator>(FPT.getOperand(0));
1534 auto *BO = dyn_cast<BinaryOperator>(FPT.getOperand(0));
1568 Instruction *RI = BinaryOperator::Create(BO->getOpcode(), LHS, RHS);
1582 return BinaryOperator::CreateFMulFMF(LHS, RHS, BO);
1595 return BinaryOperator::CreateFDivFMF(LHS, RHS, BO);
1629 if (isa<BinaryOperator>(Op))
1630 return BinaryOperator::CreateFNegFMF(InnerTrunc, Op);
2059 BinaryOperator *BO;
2076 return BinaryOperator::Create(BO->getOpcode(), X, CastedOp1);
2083 return BinaryOperator::Create(BO->getOpcode(), CastedOp0, X);
2095 return BinaryOperator::Create(BO->getOpcode(), CastedOp0, CastedC);
lib/Transforms/InstCombine/InstCombineCompares.cpp 337 return BinaryOperator::CreateOr(C1, C2);
357 return BinaryOperator::CreateAnd(C1, C2);
1377 } else if (isa<BinaryOperator>(Val) &&
1379 cast<BinaryOperator>(Val), SQ.getWithInstruction(Val),
1562 BinaryOperator *Xor,
1633 Instruction *InstCombiner::foldICmpAndShift(ICmpInst &Cmp, BinaryOperator *And,
1635 BinaryOperator *Shift = dyn_cast<BinaryOperator>(And->getOperand(0));
1635 BinaryOperator *Shift = dyn_cast<BinaryOperator>(And->getOperand(0));
1717 BinaryOperator *And,
1826 BinaryOperator *And,
1879 Instruction *InstCombiner::foldICmpOrConstant(ICmpInst &Cmp, BinaryOperator *Or,
1920 return BinaryOperator::Create(BOpc, CmpP, CmpQ);
1933 return BinaryOperator::Create(BOpc, Cmp12, Cmp34);
1941 BinaryOperator *Mul,
2024 BinaryOperator *Shl,
2164 BinaryOperator *Shr,
2257 BinaryOperator *SRem,
2296 BinaryOperator *UDiv,
2325 BinaryOperator *Div,
2495 BinaryOperator *Sub,
2557 BinaryOperator *Add,
2824 if (auto *BO = dyn_cast<BinaryOperator>(Cmp.getOperand(0))) {
2824 if (auto *BO = dyn_cast<BinaryOperator>(Cmp.getOperand(0))) {
2905 BinaryOperator *BO,
3672 BinaryOperator *BO0 = dyn_cast<BinaryOperator>(Op0);
3672 BinaryOperator *BO0 = dyn_cast<BinaryOperator>(Op0);
3673 BinaryOperator *BO1 = dyn_cast<BinaryOperator>(Op1);
3673 BinaryOperator *BO1 = dyn_cast<BinaryOperator>(Op1);
3897 BinaryOperator *SRem = nullptr;
4573 } else if (BinaryOperator *BO = dyn_cast<BinaryOperator>(U)) {
4573 } else if (BinaryOperator *BO = dyn_cast<BinaryOperator>(U)) {
4703 } else if (BinaryOperator *BO = dyn_cast<BinaryOperator>(U)) {
4703 } else if (BinaryOperator *BO = dyn_cast<BinaryOperator>(U)) {
4748 return BinaryOperator::CreateNot(Res);
5240 return BinaryOperator::CreateNot(A);
5249 return BinaryOperator::CreateNot(A);
5260 return BinaryOperator::CreateNot(Builder.CreateXor(A, B));
5264 return BinaryOperator::CreateXor(A, B);
5272 return BinaryOperator::CreateAnd(Builder.CreateNot(A), B);
5280 return BinaryOperator::CreateAnd(Builder.CreateNot(B), A);
5288 return BinaryOperator::CreateOr(Builder.CreateNot(A), B);
5296 return BinaryOperator::CreateOr(Builder.CreateNot(B), A);
lib/Transforms/InstCombine/InstCombineInternal.h 202 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(V))
202 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(V))
246 BinaryOperator::BinaryOps Opcode, Constant *In, bool IsRHSConstant) {
370 Instruction *visitAdd(BinaryOperator &I);
371 Instruction *visitFAdd(BinaryOperator &I);
373 Instruction *visitSub(BinaryOperator &I);
374 Instruction *visitFSub(BinaryOperator &I);
375 Instruction *visitMul(BinaryOperator &I);
376 Instruction *visitFMul(BinaryOperator &I);
377 Instruction *visitURem(BinaryOperator &I);
378 Instruction *visitSRem(BinaryOperator &I);
379 Instruction *visitFRem(BinaryOperator &I);
380 bool simplifyDivRemOfSelectWithZeroOp(BinaryOperator &I);
381 Instruction *commonRemTransforms(BinaryOperator &I);
382 Instruction *commonIRemTransforms(BinaryOperator &I);
383 Instruction *commonDivTransforms(BinaryOperator &I);
384 Instruction *commonIDivTransforms(BinaryOperator &I);
385 Instruction *visitUDiv(BinaryOperator &I);
386 Instruction *visitSDiv(BinaryOperator &I);
387 Instruction *visitFDiv(BinaryOperator &I);
389 Instruction *visitAnd(BinaryOperator &I);
390 Instruction *visitOr(BinaryOperator &I);
391 Instruction *visitXor(BinaryOperator &I);
392 Instruction *visitShl(BinaryOperator &I);
394 BinaryOperator *Sh0, const SimplifyQuery &SQ,
397 BinaryOperator &I);
399 BinaryOperator &OldAShr);
400 Instruction *visitAShr(BinaryOperator &I);
401 Instruction *visitLShr(BinaryOperator &I);
402 Instruction *commonShiftTransforms(BinaryOperator &I);
406 BinaryOperator &I);
585 bool willNotOverflow(BinaryOperator::BinaryOps Opcode, const Value *LHS,
598 Instruction *foldCastedBitwiseLogic(BinaryOperator &I);
600 Instruction *narrowMaskedBinOp(BinaryOperator &And);
601 Instruction *narrowMathIfNoOverflow(BinaryOperator &I);
621 Value *foldXorOfICmps(ICmpInst *LHS, ICmpInst *RHS, BinaryOperator &I);
794 bool SimplifyAssociativeOrCommutative(BinaryOperator &I);
803 Value *SimplifyUsingDistributiveLaws(BinaryOperator &I);
810 Value *SimplifyAddWithRemainder(BinaryOperator &I);
814 Value *SimplifySelectsFeedingBinaryOp(BinaryOperator &I, Value *LHS,
819 Value *tryFactorization(BinaryOperator &, Instruction::BinaryOps, Value *,
866 Instruction *foldVectorBinop(BinaryOperator &Inst);
880 Instruction *foldBinOpIntoSelectOrPhi(BinaryOperator &I);
882 Instruction *foldAddWithConstant(BinaryOperator &Add);
931 Instruction *foldICmpAndConstant(ICmpInst &Cmp, BinaryOperator *And,
933 Instruction *foldICmpXorConstant(ICmpInst &Cmp, BinaryOperator *Xor,
935 Instruction *foldICmpOrConstant(ICmpInst &Cmp, BinaryOperator *Or,
937 Instruction *foldICmpMulConstant(ICmpInst &Cmp, BinaryOperator *Mul,
939 Instruction *foldICmpShlConstant(ICmpInst &Cmp, BinaryOperator *Shl,
941 Instruction *foldICmpShrConstant(ICmpInst &Cmp, BinaryOperator *Shr,
943 Instruction *foldICmpSRemConstant(ICmpInst &Cmp, BinaryOperator *UDiv,
945 Instruction *foldICmpUDivConstant(ICmpInst &Cmp, BinaryOperator *UDiv,
947 Instruction *foldICmpDivConstant(ICmpInst &Cmp, BinaryOperator *Div,
949 Instruction *foldICmpSubConstant(ICmpInst &Cmp, BinaryOperator *Sub,
951 Instruction *foldICmpAddConstant(ICmpInst &Cmp, BinaryOperator *Add,
953 Instruction *foldICmpAndConstConst(ICmpInst &Cmp, BinaryOperator *And,
955 Instruction *foldICmpAndShift(ICmpInst &Cmp, BinaryOperator *And,
963 BinaryOperator *BO,
979 Instruction *OptAndOp(BinaryOperator *Op, ConstantInt *OpRHS,
980 ConstantInt *AndRHS, BinaryOperator &TheAnd);
989 Instruction *matchBSwap(BinaryOperator &Or);
lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp 1298 if (isa<BinaryOperator>(A) ||
lib/Transforms/InstCombine/InstCombineMulDivRem.cpp 69 BinaryOperator *I = dyn_cast<BinaryOperator>(V);
69 BinaryOperator *I = dyn_cast<BinaryOperator>(V);
132 static Value *foldMulSelectToNegate(BinaryOperator &I,
171 Instruction *InstCombiner::visitMul(BinaryOperator &I) {
188 BinaryOperator *BO = BinaryOperator::CreateNeg(Op0, I.getName());
188 BinaryOperator *BO = BinaryOperator::CreateNeg(Op0, I.getName());
204 BinaryOperator *Mul = cast<BinaryOperator>(I.getOperand(0));
204 BinaryOperator *Mul = cast<BinaryOperator>(I.getOperand(0));
205 BinaryOperator *BO = BinaryOperator::CreateMul(NewOp, Shl);
205 BinaryOperator *BO = BinaryOperator::CreateMul(NewOp, Shl);
217 BinaryOperator *Shl = BinaryOperator::CreateShl(NewOp, NewCst);
217 BinaryOperator *Shl = BinaryOperator::CreateShl(NewOp, NewCst);
250 BinaryOperator::CreateMul(Sub,
273 return BinaryOperator::CreateAdd(Builder.CreateMul(X, Op1), Mul);
281 return BinaryOperator::CreateMul(X, ConstantExpr::getNeg(Op1C));
285 auto *NewMul = BinaryOperator::CreateMul(X, Y);
285 auto *NewMul = BinaryOperator::CreateMul(X, Y);
296 return BinaryOperator::CreateNeg(Builder.CreateMul(X, Y));
302 BinaryOperator *Div = dyn_cast<BinaryOperator>(Op0);
302 BinaryOperator *Div = dyn_cast<BinaryOperator>(Op0);
306 Div = dyn_cast<BinaryOperator>(Op1);
319 return BinaryOperator::CreateNeg(X);
326 return BinaryOperator::CreateSub(X, Rem);
327 return BinaryOperator::CreateSub(Rem, X);
333 return BinaryOperator::CreateAnd(Op0, Op1);
339 BinaryOperator *BO = nullptr;
342 BO = BinaryOperator::CreateShl(Op1, Y);
345 BO = BinaryOperator::CreateShl(Op0, Y);
372 return BinaryOperator::CreateAnd(Builder.CreateAShr(X, *C), Op1);
374 return BinaryOperator::CreateAnd(Builder.CreateAShr(X, *C), Op0);
393 Instruction *InstCombiner::visitFMul(BinaryOperator &I) {
414 return BinaryOperator::CreateFNegFMF(Op0, &I);
419 return BinaryOperator::CreateFMulFMF(X, Y, &I);
424 return BinaryOperator::CreateFMulFMF(X, ConstantExpr::getFNeg(C), &I);
428 return BinaryOperator::CreateFMulFMF(X, X, &I);
443 return BinaryOperator::CreateFDivFMF(CC1, X, &I);
449 return BinaryOperator::CreateFMulFMF(X, CDivC1, &I);
455 return BinaryOperator::CreateFDivFMF(X, C1DivC, &I);
465 return BinaryOperator::CreateFAddFMF(XC, CC1, &I);
471 return BinaryOperator::CreateFSubFMF(CC1, XC, &I);
480 return BinaryOperator::CreateFDivFMF(NewFMul, Y, &I);
503 return BinaryOperator::CreateFDivFMF(XX, Y, &I);
509 return BinaryOperator::CreateFDivFMF(Y, XX, &I);
543 return BinaryOperator::CreateFMulFMF(XX, Y, &I);
548 return BinaryOperator::CreateFMulFMF(XX, Y, &I);
569 return BinaryOperator::CreateFSubFMF(LogXTimesY, Y, &I);
579 bool InstCombiner::simplifyDivRemOfSelectWithZeroOp(BinaryOperator &I) {
680 Instruction *InstCombiner::commonIDivTransforms(BinaryOperator &I) {
706 return BinaryOperator::Create(I.getOpcode(), X,
716 auto *NewDiv = BinaryOperator::Create(I.getOpcode(), X,
716 auto *NewDiv = BinaryOperator::Create(I.getOpcode(), X,
724 auto *Mul = BinaryOperator::Create(Instruction::Mul, X,
724 auto *Mul = BinaryOperator::Create(Instruction::Mul, X,
742 auto *BO = BinaryOperator::Create(I.getOpcode(), X,
742 auto *BO = BinaryOperator::Create(I.getOpcode(), X,
750 auto *Mul = BinaryOperator::Create(Instruction::Mul, X,
750 auto *Mul = BinaryOperator::Create(Instruction::Mul, X,
789 return BinaryOperator::Create(I.getOpcode(), X, Op1);
794 return BinaryOperator::CreateNSWShl(ConstantInt::get(Ty, 1), Y);
796 return BinaryOperator::CreateNUWShl(ConstantInt::get(Ty, 1), Y);
817 const BinaryOperator &I,
847 const BinaryOperator &I, InstCombiner &IC) {
851 BinaryOperator *LShr = BinaryOperator::CreateLShr(Op0, C1);
851 BinaryOperator *LShr = BinaryOperator::CreateLShr(Op0, C1);
859 static Instruction *foldUDivShl(Value *Op0, Value *Op1, const BinaryOperator &I,
875 BinaryOperator *LShr = BinaryOperator::CreateLShr(Op0, N);
875 BinaryOperator *LShr = BinaryOperator::CreateLShr(Op0, N);
885 static size_t visitUDivOperand(Value *Op0, Value *Op1, const BinaryOperator &I,
919 static Instruction *narrowUDivURem(BinaryOperator &I,
954 Instruction *InstCombiner::visitUDiv(BinaryOperator &I) {
975 BinaryOperator *BO = BinaryOperator::CreateUDiv(
975 BinaryOperator *BO = BinaryOperator::CreateUDiv(
1008 return BinaryOperator::CreateUDiv(B, X);
1011 return BinaryOperator::CreateUDiv(A, X);
1048 Instruction *InstCombiner::visitSDiv(BinaryOperator &I) {
1066 return BinaryOperator::CreateNeg(Op0);
1077 return BinaryOperator::CreateExactAShr(Op0, ShAmt, I.getName());
1103 Instruction *BO = BinaryOperator::CreateSDiv(X, NegC);
1112 return BinaryOperator::CreateNSWNeg(
1121 auto *BO = BinaryOperator::CreateUDiv(Op0, Op1, I.getName());
1121 auto *BO = BinaryOperator::CreateUDiv(Op0, Op1, I.getName());
1131 auto *BO = BinaryOperator::CreateUDiv(Op0, Op1, I.getName());
1131 auto *BO = BinaryOperator::CreateUDiv(Op0, Op1, I.getName());
1141 static Instruction *foldFDivConstantDivisor(BinaryOperator &I) {
1149 return BinaryOperator::CreateFDivFMF(X, ConstantExpr::getFNeg(C), &I);
1166 return BinaryOperator::CreateFMulFMF(I.getOperand(0), RecipC, &I);
1170 static Instruction *foldFDivConstantDividend(BinaryOperator &I) {
1178 return BinaryOperator::CreateFDivFMF(ConstantExpr::getFNeg(C), X, &I);
1199 return BinaryOperator::CreateFDivFMF(NewC, X, &I);
1202 Instruction *InstCombiner::visitFDiv(BinaryOperator &I) {
1234 return BinaryOperator::CreateFDivFMF(X, YZ, &I);
1240 return BinaryOperator::CreateFDivFMF(YZ, X, &I);
1305 Instruction *InstCombiner::commonIRemTransforms(BinaryOperator &I) {
1345 Instruction *InstCombiner::visitURem(BinaryOperator &I) {
1367 return BinaryOperator::CreateAnd(Op0, Add);
1394 Instruction *InstCombiner::visitSRem(BinaryOperator &I) {
1420 return BinaryOperator::CreateNSWNeg(Builder.CreateSRem(X, Y));
1428 return BinaryOperator::CreateURem(Op0, Op1, I.getName());
1472 Instruction *InstCombiner::visitFRem(BinaryOperator &I) {
lib/Transforms/InstCombine/InstCombinePHI.cpp 363 BinaryOperator *BinOp = cast<BinaryOperator>(FirstInst);
363 BinaryOperator *BinOp = cast<BinaryOperator>(FirstInst);
364 BinaryOperator *NewBinOp =
365 BinaryOperator::Create(BinOp->getOpcode(), LHSVal, RHSVal);
754 } else if (isa<BinaryOperator>(FirstInst) || isa<CmpInst>(FirstInst)) {
813 if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(FirstInst)) {
813 if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(FirstInst)) {
814 BinOp = BinaryOperator::Create(BinOp->getOpcode(), PhiVal, ConstantOp);
1168 (isa<BinaryOperator>(PHIUser) || isa<GetElementPtrInst>(PHIUser)) &&
lib/Transforms/InstCombine/InstCombineSelect.cpp 78 BinaryOperator *BO;
243 static unsigned getSelectFoldableOperands(BinaryOperator *I) {
263 static APInt getSelectFoldableConstant(BinaryOperator *I) {
344 return BinaryOperator::CreateFNegFMF(NewSel, cast<BinaryOperator>(TI));
344 return BinaryOperator::CreateFNegFMF(NewSel, cast<BinaryOperator>(TI));
353 (!isa<BinaryOperator>(TI) && !isa<GetElementPtrInst>(TI)) ||
398 if (auto *BO = dyn_cast<BinaryOperator>(TI)) {
398 if (auto *BO = dyn_cast<BinaryOperator>(TI)) {
399 BinaryOperator *NewBO = BinaryOperator::Create(BO->getOpcode(), Op0, Op1);
399 BinaryOperator *NewBO = BinaryOperator::Create(BO->getOpcode(), Op0, Op1);
428 if (auto *TVI = dyn_cast<BinaryOperator>(TrueVal)) {
428 if (auto *TVI = dyn_cast<BinaryOperator>(TrueVal)) {
449 BinaryOperator *BO = BinaryOperator::Create(TVI->getOpcode(),
449 BinaryOperator *BO = BinaryOperator::Create(TVI->getOpcode(),
459 if (auto *FVI = dyn_cast<BinaryOperator>(FalseVal)) {
459 if (auto *FVI = dyn_cast<BinaryOperator>(FalseVal)) {
480 BinaryOperator *BO = BinaryOperator::Create(FVI->getOpcode(),
480 BinaryOperator *BO = BinaryOperator::Create(FVI->getOpcode(),
780 BinaryOperator *BO = cast<BinaryOperator>(FVal);
780 BinaryOperator *BO = cast<BinaryOperator>(FVal);
1111 if (auto *BO = dyn_cast<BinaryOperator>(V)) {
1111 if (auto *BO = dyn_cast<BinaryOperator>(V)) {
1722 BinaryOperator::CreateFAdd(SubOp->getOperand(0), NewSel);
1729 return BinaryOperator::CreateAdd(SubOp->getOperand(0), NewSel);
1993 return BinaryOperator::CreateNUW(BinaryOperator::Add, NewMinMax,
1993 return BinaryOperator::CreateNUW(BinaryOperator::Add, NewMinMax,
2006 return BinaryOperator::CreateNSW(BinaryOperator::Add, NewMinMax,
2006 return BinaryOperator::CreateNSW(BinaryOperator::Add, NewMinMax,
2022 BinaryOperator *AddSub;
2152 auto ShiftOpcode0 = cast<BinaryOperator>(Or0)->getOpcode();
2153 auto ShiftOpcode1 = cast<BinaryOperator>(Or1)->getOpcode();
2183 bool IsFshl = (ShAmt == SA0 && ShiftOpcode0 == BinaryOperator::Shl) ||
2184 (ShAmt == SA1 && ShiftOpcode1 == BinaryOperator::Shl);
2243 return BinaryOperator::CreateOr(CondVal, FalseVal);
2248 return BinaryOperator::CreateAnd(NotCond, FalseVal);
2252 return BinaryOperator::CreateAnd(CondVal, TrueVal);
2257 return BinaryOperator::CreateOr(NotCond, TrueVal);
2263 return BinaryOperator::CreateOr(CondVal, FalseVal);
2265 return BinaryOperator::CreateAnd(CondVal, TrueVal);
2270 return BinaryOperator::CreateAnd(TrueVal, FalseVal);
2272 return BinaryOperator::CreateOr(TrueVal, FalseVal);
2489 return BinaryOperator::CreateNot(NewMinMax);
2586 BinaryOperator *TrueBO;
2606 BinaryOperator *FalseBO;
lib/Transforms/InstCombine/InstCombineShifts.cpp 32 BinaryOperator *Sh0, const SimplifyQuery &SQ,
116 BinaryOperator *NewShift = BinaryOperator::Create(ShiftOpcode, X, NewShAmt);
116 BinaryOperator *NewShift = BinaryOperator::Create(ShiftOpcode, X, NewShAmt);
176 dropRedundantMaskingOfLeftShiftInput(BinaryOperator *OuterShift,
276 auto *NewShift = BinaryOperator::Create(OuterShift->getOpcode(), X,
276 auto *NewShift = BinaryOperator::Create(OuterShift->getOpcode(), X,
283 return BinaryOperator::Create(Instruction::And, NewShift, NewMask);
286 Instruction *InstCombiner::commonShiftTransforms(BinaryOperator &I) {
294 return BinaryOperator::Create(I.getOpcode(), Op0, NewExt);
322 return BinaryOperator::Create(
468 static Value *foldShiftedShift(BinaryOperator *InnerShift, unsigned OuterShAmt,
564 return foldShiftedShift(cast<BinaryOperator>(I), NumBits, isLeftShift,
588 static bool canShiftBinOpWithConstantRHS(BinaryOperator &Shift,
589 BinaryOperator *BO) {
603 BinaryOperator &I) {
679 if (BinaryOperator *Op0BO = dyn_cast<BinaryOperator>(Op0)) {
679 if (BinaryOperator *Op0BO = dyn_cast<BinaryOperator>(Op0)) {
705 return BinaryOperator::CreateAnd(X, Mask);
719 return BinaryOperator::Create(Op0BO->getOpcode(), YS, XM);
740 return BinaryOperator::CreateAnd(X, Mask);
754 return BinaryOperator::Create(Op0BO->getOpcode(), XM, YS);
774 return BinaryOperator::Create(Op0BO->getOpcode(), NewShift,
790 return BinaryOperator::CreateSub(NewRHS, NewShift);
803 BinaryOperator *TBO;
822 BinaryOperator *FBO;
845 Instruction *InstCombiner::visitShl(BinaryOperator &I) {
882 return BinaryOperator::CreateAnd(X, ConstantInt::get(Ty, Mask));
893 auto *NewShl = BinaryOperator::CreateShl(X, ShiftDiff);
893 auto *NewShl = BinaryOperator::CreateShl(X, ShiftDiff);
901 auto *NewShr = BinaryOperator::Create(
901 auto *NewShr = BinaryOperator::Create(
902 cast<BinaryOperator>(Op0)->getOpcode(), X, ShiftDiff);
913 return BinaryOperator::CreateShl(X, ConstantInt::get(Ty, AmtSum));
936 return BinaryOperator::CreateAnd(Mask, X);
945 return BinaryOperator::CreateShl(ConstantExpr::getShl(C2, C1), X);
949 return BinaryOperator::CreateMul(X, ConstantExpr::getShl(C2, C1));
961 return BinaryOperator::CreateLShr(
967 Instruction *InstCombiner::visitLShr(BinaryOperator &I) {
1004 if (cast<BinaryOperator>(Op0)->hasNoUnsignedWrap()) {
1006 auto *NewLShr = BinaryOperator::CreateLShr(X, ShiftDiff);
1006 auto *NewLShr = BinaryOperator::CreateLShr(X, ShiftDiff);
1013 return BinaryOperator::CreateAnd(NewLShr, ConstantInt::get(Ty, Mask));
1018 if (cast<BinaryOperator>(Op0)->hasNoUnsignedWrap()) {
1020 auto *NewShl = BinaryOperator::CreateShl(X, ShiftDiff);
1020 auto *NewShl = BinaryOperator::CreateShl(X, ShiftDiff);
1027 return BinaryOperator::CreateAnd(NewShl, ConstantInt::get(Ty, Mask));
1032 return BinaryOperator::CreateAnd(X, ConstantInt::get(Ty, Mask));
1074 return BinaryOperator::CreateLShr(X, ConstantInt::get(Ty, AmtSum));
1090 return BinaryOperator::CreateAnd(Mask, X);
1098 BinaryOperator &OldAShr) {
1156 BinaryOperator::Create(OldAShr.getOpcode(), X, NumLowBitsToSkip);
1165 Instruction *InstCombiner::visitAShr(BinaryOperator &I) {
1200 auto *NewAShr = BinaryOperator::CreateAShr(X, ShiftDiff);
1200 auto *NewAShr = BinaryOperator::CreateAShr(X, ShiftDiff);
1207 auto *NewShl = BinaryOperator::Create(Instruction::Shl, X, ShiftDiff);
1207 auto *NewShl = BinaryOperator::Create(Instruction::Shl, X, ShiftDiff);
1219 return BinaryOperator::CreateAShr(X, ConstantInt::get(Ty, AmtSum));
1244 return BinaryOperator::CreateLShr(Op0, Op1);
lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp 264 BinaryOperator::CreateOr(I->getOperand(0), I->getOperand(1),
277 Instruction *And = BinaryOperator::CreateAnd(I->getOperand(0), AndC);
301 Instruction *NewAnd = BinaryOperator::CreateAnd(I->getOperand(0), AndC);
306 Instruction *NewXor = BinaryOperator::CreateXor(NewAnd, XorC);
441 BinaryOperator &BinOP = *cast<BinaryOperator>(I);
441 BinaryOperator &BinOP = *cast<BinaryOperator>(I);
526 Instruction *NewVal = BinaryOperator::CreateLShr(
569 BinaryOperator *LShr = BinaryOperator::CreateLShr(I->getOperand(0),
569 BinaryOperator *LShr = BinaryOperator::CreateLShr(I->getOperand(0),
571 LShr->setIsExact(cast<BinaryOperator>(I)->isExact());
679 NewVal = BinaryOperator::CreateLShr(II->getArgOperand(0),
682 NewVal = BinaryOperator::CreateShl(II->getArgOperand(0),
946 BinaryOperator *New;
949 New = BinaryOperator::CreateShl(VarX, Amt);
950 BinaryOperator *Orig = cast<BinaryOperator>(Shl);
950 BinaryOperator *Orig = cast<BinaryOperator>(Shl);
955 New = isLshr ? BinaryOperator::CreateLShr(VarX, Amt) :
956 BinaryOperator::CreateAShr(VarX, Amt);
957 if (cast<BinaryOperator>(Shr)->isExact())
1711 BinaryOperator *BO;
lib/Transforms/InstCombine/InstCombineVectorOps.cpp 111 !(isa<BinaryOperator>(PHIUser)) || !cheapToScalarize(PHIUser, true))
128 BinaryOperator *B0 = cast<BinaryOperator>(PHIUser);
128 BinaryOperator *B0 = cast<BinaryOperator>(PHIUser);
135 BinaryOperator::CreateWithCopiedFlags(B0->getOpcode(),
376 BinaryOperator *BO;
382 return BinaryOperator::CreateWithCopiedFlags(BO->getOpcode(), E0, E1, BO);
1235 BinaryOperator *BO = cast<BinaryOperator>(I);
1235 BinaryOperator *BO = cast<BinaryOperator>(I);
1237 BinaryOperator *New =
1238 BinaryOperator::Create(cast<BinaryOperator>(I)->getOpcode(),
1238 BinaryOperator::Create(cast<BinaryOperator>(I)->getOpcode(),
1430 BinaryOperator::BinaryOps Opcode;
1433 BinopElts(BinaryOperator::BinaryOps Opc = (BinaryOperator::BinaryOps)0,
1443 static BinopElts getAlternateBinop(BinaryOperator *BO, const DataLayout &DL) {
1487 auto *BO = cast<BinaryOperator>(Op0IsBinop ? Op0 : Op1);
1487 auto *BO = cast<BinaryOperator>(Op0IsBinop ? Op0 : Op1);
1488 BinaryOperator::BinaryOps BOpcode = BO->getOpcode();
1510 Instruction *NewBO = BinaryOperator::Create(BOpcode, X, NewC);
1575 BinaryOperator *B0, *B1;
1593 BinaryOperator::BinaryOps Opc0 = B0->getOpcode();
1594 BinaryOperator::BinaryOps Opc1 = B1->getOpcode();
1617 BinaryOperator::BinaryOps BOpc = Opc0;
1664 Instruction *NewBO = ConstantsAreOp1 ? BinaryOperator::Create(BOpc, V, NewC) :
1665 BinaryOperator::Create(BOpc, NewC, V);
lib/Transforms/InstCombine/InstructionCombining.cpp 203 static bool maintainNoSignedWrap(BinaryOperator &I, Value *B, Value *C) {
226 static bool hasNoUnsignedWrap(BinaryOperator &I) {
231 static bool hasNoSignedWrap(BinaryOperator &I) {
239 static void ClearSubclassDataAfterReassociation(BinaryOperator &I) {
255 static bool simplifyAssocCastAssoc(BinaryOperator *BinOp1) {
270 auto *BinOp2 = dyn_cast<BinaryOperator>(Cast->getOperand(0));
270 auto *BinOp2 = dyn_cast<BinaryOperator>(Cast->getOperand(0));
313 bool InstCombiner::SimplifyAssociativeOrCommutative(BinaryOperator &I) {
325 BinaryOperator *Op0 = dyn_cast<BinaryOperator>(I.getOperand(0));
325 BinaryOperator *Op0 = dyn_cast<BinaryOperator>(I.getOperand(0));
326 BinaryOperator *Op1 = dyn_cast<BinaryOperator>(I.getOperand(1));
326 BinaryOperator *Op1 = dyn_cast<BinaryOperator>(I.getOperand(1));
441 BinaryOperator *NewBO = (IsNUW && Opcode == Instruction::Add) ?
442 BinaryOperator::CreateNUW(Opcode, A, B) :
443 BinaryOperator::Create(Opcode, A, B);
522 getBinOpsForFactorization(Instruction::BinaryOps TopOpcode, BinaryOperator *Op,
541 Value *InstCombiner::tryFactorization(BinaryOperator &I,
598 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(SimplifiedInst)) {
598 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(SimplifiedInst)) {
646 Value *InstCombiner::SimplifyUsingDistributiveLaws(BinaryOperator &I) {
648 BinaryOperator *Op0 = dyn_cast<BinaryOperator>(LHS);
648 BinaryOperator *Op0 = dyn_cast<BinaryOperator>(LHS);
649 BinaryOperator *Op1 = dyn_cast<BinaryOperator>(RHS);
649 BinaryOperator *Op1 = dyn_cast<BinaryOperator>(RHS);
760 Value *InstCombiner::SimplifySelectsFeedingBinaryOp(BinaryOperator &I,
848 auto *BO = cast<BinaryOperator>(&I);
848 auto *BO = cast<BinaryOperator>(&I);
907 static Value *foldOperationIntoPhiValue(BinaryOperator *I, Value *InV,
1045 } else if (auto *BO = dyn_cast<BinaryOperator>(&I)) {
1045 } else if (auto *BO = dyn_cast<BinaryOperator>(&I)) {
1074 Instruction *InstCombiner::foldBinOpIntoSelectOrPhi(BinaryOperator &I) {
1224 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(Op)) {
1224 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(Op)) {
1373 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(Ancestor)) {
1373 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(Ancestor)) {
1402 Instruction *InstCombiner::foldVectorBinop(BinaryOperator &Inst) {
1405 BinaryOperator::BinaryOps Opcode = Inst.getOpcode();
1427 if (auto *BO = dyn_cast<BinaryOperator>(NewBO0))
1427 if (auto *BO = dyn_cast<BinaryOperator>(NewBO0))
1430 if (auto *BO = dyn_cast<BinaryOperator>(NewBO1))
1430 if (auto *BO = dyn_cast<BinaryOperator>(NewBO1))
1443 if (auto *BO = dyn_cast<BinaryOperator>(XY))
1443 if (auto *BO = dyn_cast<BinaryOperator>(XY))
1477 Instruction *NewBO = BinaryOperator::Create(Opcode, V1, V2);
1565 Instruction *InstCombiner::narrowMathIfNoOverflow(BinaryOperator &BO) {
1609 if (auto *NewBinOp = dyn_cast<BinaryOperator>(NarrowBO)) {
1609 if (auto *NewBinOp = dyn_cast<BinaryOperator>(NarrowBO)) {
2717 return BinaryOperator::Create(BinOp, LHS, RHS);
lib/Transforms/Instrumentation/AddressSanitizer.cpp 1459 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(I)) {
1459 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(I)) {
lib/Transforms/Instrumentation/ControlHeightReduction.cpp 496 return isa<BinaryOperator>(I) || isa<CastInst>(I) || isa<SelectInst>(I) ||
lib/Transforms/Instrumentation/DataFlowSanitizer.cpp 441 void visitBinaryOperator(BinaryOperator &BO);
1406 void DFSanVisitor::visitBinaryOperator(BinaryOperator &BO) {
lib/Transforms/Instrumentation/MemorySanitizer.cpp 1939 void visitAnd(BinaryOperator &I) {
1961 void visitOr(BinaryOperator &I) {
2135 void handleMulByConstant(BinaryOperator &I, Constant *ConstArg,
2170 void visitMul(BinaryOperator &I) {
2181 void visitFAdd(BinaryOperator &I) { handleShadowOr(I); }
2182 void visitFSub(BinaryOperator &I) { handleShadowOr(I); }
2183 void visitFMul(BinaryOperator &I) { handleShadowOr(I); }
2184 void visitAdd(BinaryOperator &I) { handleShadowOr(I); }
2185 void visitSub(BinaryOperator &I) { handleShadowOr(I); }
2186 void visitXor(BinaryOperator &I) { handleShadowOr(I); }
2196 void visitUDiv(BinaryOperator &I) { handleIntegerDiv(I); }
2197 void visitSDiv(BinaryOperator &I) { handleIntegerDiv(I); }
2198 void visitURem(BinaryOperator &I) { handleIntegerDiv(I); }
2199 void visitSRem(BinaryOperator &I) { handleIntegerDiv(I); }
2203 void visitFDiv(BinaryOperator &I) { handleShadowOr(I); }
2204 void visitFRem(BinaryOperator &I) { handleShadowOr(I); }
2377 void handleShift(BinaryOperator &I) {
2391 void visitShl(BinaryOperator &I) { handleShift(I); }
2392 void visitAShr(BinaryOperator &I) { handleShift(I); }
2393 void visitLShr(BinaryOperator &I) { handleShift(I); }
lib/Transforms/Instrumentation/PoisonChecking.cpp 188 if (isa<BinaryOperator>(I) && !I.getType()->isVectorTy())
lib/Transforms/Instrumentation/SanitizerCoverage.cpp 199 ArrayRef<BinaryOperator *> DivTraceTargets);
597 SmallVector<BinaryOperator *, 8> DivTraceTargets;
621 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(&Inst))
621 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(&Inst))
784 Function &, ArrayRef<BinaryOperator *> DivTraceTargets) {
lib/Transforms/Scalar/AlignmentFromAssumptions.cpp 221 BinaryOperator *CmpBO = dyn_cast<BinaryOperator>(CmpLHS);
221 BinaryOperator *CmpBO = dyn_cast<BinaryOperator>(CmpLHS);
lib/Transforms/Scalar/ConstantHoisting.cpp 751 Mat = BinaryOperator::Create(Instruction::Add, Base, Offset,
lib/Transforms/Scalar/CorrelatedValuePropagation.cpp 491 static bool processBinOp(BinaryOperator *BinOp, LazyValueInfo *LVI);
514 if (auto *BO = dyn_cast<BinaryOperator>(NewOp))
514 if (auto *BO = dyn_cast<BinaryOperator>(NewOp))
522 BinaryOperator *BinOp = BinaryOperator::Create(
522 BinaryOperator *BinOp = BinaryOperator::Create(
532 if (auto *BO = dyn_cast<BinaryOperator>(BinOp))
532 if (auto *BO = dyn_cast<BinaryOperator>(BinOp))
607 static bool hasPositiveOperands(BinaryOperator *SDI, LazyValueInfo *LVI) {
619 static bool processUDivOrURem(BinaryOperator *Instr, LazyValueInfo *LVI) {
650 if (auto *BinOp = dyn_cast<BinaryOperator>(BO))
650 if (auto *BinOp = dyn_cast<BinaryOperator>(BO))
659 static bool processSRem(BinaryOperator *SDI, LazyValueInfo *LVI) {
664 auto *BO = BinaryOperator::CreateURem(SDI->getOperand(0), SDI->getOperand(1),
664 auto *BO = BinaryOperator::CreateURem(SDI->getOperand(0), SDI->getOperand(1),
681 static bool processSDiv(BinaryOperator *SDI, LazyValueInfo *LVI) {
686 auto *BO = BinaryOperator::CreateUDiv(SDI->getOperand(0), SDI->getOperand(1),
686 auto *BO = BinaryOperator::CreateUDiv(SDI->getOperand(0), SDI->getOperand(1),
699 static bool processAShr(BinaryOperator *SDI, LazyValueInfo *LVI) {
709 auto *BO = BinaryOperator::CreateLShr(SDI->getOperand(0), SDI->getOperand(1),
709 auto *BO = BinaryOperator::CreateLShr(SDI->getOperand(0), SDI->getOperand(1),
740 static bool processBinOp(BinaryOperator *BinOp, LazyValueInfo *LVI) {
783 static bool processAnd(BinaryOperator *BinOp, LazyValueInfo *LVI) {
861 BBChanged |= processSRem(cast<BinaryOperator>(II), LVI);
864 BBChanged |= processSDiv(cast<BinaryOperator>(II), LVI);
868 BBChanged |= processUDivOrURem(cast<BinaryOperator>(II), LVI);
871 BBChanged |= processAShr(cast<BinaryOperator>(II), LVI);
880 BBChanged |= processBinOp(cast<BinaryOperator>(II), LVI);
883 BBChanged |= processAnd(cast<BinaryOperator>(II), LVI);
lib/Transforms/Scalar/DivRemPairs.cpp 205 Instruction *RealRem = E.isSigned() ? BinaryOperator::CreateSRem(X, Y)
206 : BinaryOperator::CreateURem(X, Y);
265 Instruction *Mul = BinaryOperator::CreateMul(DivInst, Y);
266 Instruction *Sub = BinaryOperator::CreateSub(X, Mul);
lib/Transforms/Scalar/EarlyCSE.cpp 112 isa<BinaryOperator>(Inst) || isa<GetElementPtrInst>(Inst) ||
168 if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(Inst)) {
168 if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(Inst)) {
277 if (BinaryOperator *LHSBinOp = dyn_cast<BinaryOperator>(LHSI)) {
277 if (BinaryOperator *LHSBinOp = dyn_cast<BinaryOperator>(LHSI)) {
283 BinaryOperator *RHSBinOp = cast<BinaryOperator>(RHSI);
283 BinaryOperator *RHSBinOp = cast<BinaryOperator>(RHSI);
821 if (BinaryOperator *BOp = dyn_cast<BinaryOperator>(I))
821 if (BinaryOperator *BOp = dyn_cast<BinaryOperator>(I))
854 for (auto &Op : cast<BinaryOperator>(Curr)->operands())
lib/Transforms/Scalar/GuardWidening.cpp 102 return cast<BinaryOperator>(Cond)->getOperand(0);
279 WidenableCondition = cast<BinaryOperator>(Cond)->getOperand(1);
282 Result = BinaryOperator::CreateAnd(Result, WidenableCondition,
589 Result = BinaryOperator::CreateAnd(RC.getCheckInst(), Result, "",
607 Cond1 = BinaryOperator::CreateNot(Cond1, "inverted", InsertPt);
608 Result = BinaryOperator::CreateAnd(Cond0, Cond1, "wide.chk", InsertPt);
lib/Transforms/Scalar/IndVarSimplify.cpp 320 auto *Incr = dyn_cast<BinaryOperator>(PN->getIncomingValue(BackEdge));
320 auto *Incr = dyn_cast<BinaryOperator>(PN->getIncomingValue(BackEdge));
463 BinaryOperator::CreateAdd(NewPHI, ConstantInt::get(Int32Ty, IncValue),
1130 auto *NarrowBO = cast<BinaryOperator>(NarrowUse);
1130 auto *NarrowBO = cast<BinaryOperator>(NarrowUse);
1131 auto *WideBO = BinaryOperator::Create(NarrowBO->getOpcode(), LHS, RHS,
1131 auto *WideBO = BinaryOperator::Create(NarrowBO->getOpcode(), LHS, RHS,
1221 auto *NarrowBO = cast<BinaryOperator>(NarrowUse);
1221 auto *NarrowBO = cast<BinaryOperator>(NarrowUse);
1222 auto *WideBO = BinaryOperator::Create(NarrowBO->getOpcode(), LHS, RHS,
1222 auto *WideBO = BinaryOperator::Create(NarrowBO->getOpcode(), LHS, RHS,
1503 auto *NarrowBO = cast<BinaryOperator>(NarrowUse);
1503 auto *NarrowBO = cast<BinaryOperator>(NarrowUse);
1504 auto *WideBO = BinaryOperator::Create(NarrowBO->getOpcode(), LHS, RHS,
1504 auto *WideBO = BinaryOperator::Create(NarrowBO->getOpcode(), LHS, RHS,
2464 if (auto *BO = dyn_cast<BinaryOperator>(IncVar)) {
2464 if (auto *BO = dyn_cast<BinaryOperator>(IncVar)) {
lib/Transforms/Scalar/JumpThreading.cpp 746 } else if (BinaryOperator *BO = dyn_cast<BinaryOperator>(I)) {
746 } else if (BinaryOperator *BO = dyn_cast<BinaryOperator>(I)) {
1232 return ProcessBranchOnXOR(cast<BinaryOperator>(CondInst));
1796 bool JumpThreadingPass::ProcessBranchOnXOR(BinaryOperator *BO) {
lib/Transforms/Scalar/LICM.cpp 871 auto ReciprocalDivisor = BinaryOperator::CreateFDiv(One, Divisor);
877 BinaryOperator::CreateFMul(I.getOperand(0), ReciprocalDivisor);
1037 isa<UnaryOperator>(I) || isa<BinaryOperator>(I) ||
lib/Transforms/Scalar/LoopIdiomRecognize.cpp 1313 BinaryOperator *SubOneOp;
1315 if ((SubOneOp = dyn_cast<BinaryOperator>(DefX2->getOperand(0))))
1319 SubOneOp = dyn_cast<BinaryOperator>(DefX2->getOperand(1));
lib/Transforms/Scalar/LoopRerollPass.cpp 540 if (auto *BO = dyn_cast<BinaryOperator>(User)) {
540 if (auto *BO = dyn_cast<BinaryOperator>(User)) {
763 BinaryOperator *BO = dyn_cast<BinaryOperator>(U);
763 BinaryOperator *BO = dyn_cast<BinaryOperator>(U);
790 if (auto *BO = dyn_cast<BinaryOperator>(I)) {
790 if (auto *BO = dyn_cast<BinaryOperator>(I)) {
lib/Transforms/Scalar/LoopStrengthReduce.cpp 2142 BinaryOperator *Incr =
2143 dyn_cast<BinaryOperator>(PH->getIncomingValue(Latch));
2169 BinaryOperator *NewIncr =
2170 BinaryOperator::Create(Incr->getOpcode() == Instruction::Add ?
lib/Transforms/Scalar/LoopUnswitch.cpp 448 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(Cond))
448 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(Cond))
lib/Transforms/Scalar/LowerExpectIntrinsic.cpp 131 BinaryOperator *BinOp = dyn_cast<BinaryOperator>(V);
131 BinaryOperator *BinOp = dyn_cast<BinaryOperator>(V);
lib/Transforms/Scalar/NaryReassociate.cpp 289 return tryReassociateBinaryOp(cast<BinaryOperator>(I));
436 Instruction *NaryReassociatePass::tryReassociateBinaryOp(BinaryOperator *I) {
449 BinaryOperator *I) {
474 BinaryOperator *I) {
484 NewI = BinaryOperator::CreateAdd(LHS, RHS, "", I);
487 NewI = BinaryOperator::CreateMul(LHS, RHS, "", I);
496 bool NaryReassociatePass::matchTernaryOp(BinaryOperator *I, Value *V,
509 const SCEV *NaryReassociatePass::getBinarySCEV(BinaryOperator *I,
lib/Transforms/Scalar/NewGVN.cpp 2578 return isa<BinaryOperator>(I) || isa<SelectInst>(I) || isa<CmpInst>(I) ||
lib/Transforms/Scalar/Reassociate.cpp 147 static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode) {
151 return cast<BinaryOperator>(I);
155 static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode1,
161 return cast<BinaryOperator>(I);
229 cast<BinaryOperator>(I)->swapOperands();
232 static BinaryOperator *CreateAdd(Value *S1, Value *S2, const Twine &Name,
235 return BinaryOperator::CreateAdd(S1, S2, Name, InsertBefore);
237 BinaryOperator *Res =
238 BinaryOperator::CreateFAdd(S1, S2, Name, InsertBefore);
244 static BinaryOperator *CreateMul(Value *S1, Value *S2, const Twine &Name,
247 return BinaryOperator::CreateMul(S1, S2, Name, InsertBefore);
249 BinaryOperator *Res =
250 BinaryOperator::CreateFMul(S1, S2, Name, InsertBefore);
256 static BinaryOperator *CreateNeg(Value *S1, const Twine &Name,
259 return BinaryOperator::CreateNeg(S1, Name, InsertBefore);
261 BinaryOperator *Res = BinaryOperator::CreateFNeg(S1, Name, InsertBefore);
261 BinaryOperator *Res = BinaryOperator::CreateFNeg(S1, Name, InsertBefore);
268 static BinaryOperator *LowerNegateToMultiply(Instruction *Neg) {
272 unsigned OpNo = isa<BinaryOperator>(Neg) ? 1 : 0;
277 BinaryOperator *Res = CreateMul(Neg->getOperand(OpNo), NegOne, "", Neg, Neg);
509 if (BinaryOperator *BO = isReassociableOp(Op, Opcode)) {
634 void ReassociatePass::RewriteExprTree(BinaryOperator *I,
649 SmallVector<BinaryOperator*, 8> NodesToRewrite;
651 BinaryOperator *Op = I;
670 BinaryOperator *ExpressionChanged = nullptr;
699 BinaryOperator *BO = isReassociableOp(OldLHS, Opcode);
705 BinaryOperator *BO = isReassociableOp(OldRHS, Opcode);
730 BinaryOperator *BO = isReassociableOp(Op->getOperand(1), Opcode);
744 BinaryOperator *BO = isReassociableOp(Op->getOperand(0), Opcode);
757 BinaryOperator *NewOp;
760 NewOp = BinaryOperator::Create(Instruction::BinaryOps(Opcode),
800 ExpressionChanged = cast<BinaryOperator>(*ExpressionChanged->user_begin());
830 if (BinaryOperator *I =
916 BinaryOperator *NewNeg = CreateNeg(V, V->getName() + ".neg", BI, BI);
952 static BinaryOperator *BreakUpSubtract(Instruction *Sub,
960 BinaryOperator *New = CreateAdd(Sub->getOperand(0), NegVal, "", Sub, Sub);
975 static BinaryOperator *ConvertShiftToMul(Instruction *Shl) {
979 BinaryOperator *Mul =
980 BinaryOperator::CreateMul(Shl->getOperand(0), MulCst, "", Shl);
991 bool NSW = cast<BinaryOperator>(Shl)->hasNoSignedWrap();
992 bool NUW = cast<BinaryOperator>(Shl)->hasNoUnsignedWrap();
1042 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul, Instruction::FMul);
1117 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul, Instruction::FMul);
1189 Instruction *I = BinaryOperator::CreateAnd(
1532 BinaryOperator *BOp =
1598 ? BinaryOperator::CreateAdd(MaxOccVal, MaxOccVal)
1599 : BinaryOperator::CreateFAdd(MaxOccVal, MaxOccVal);
1604 BinaryOperator *BOp =
1803 Value *ReassociatePass::OptimizeMul(BinaryOperator *I,
1833 Value *ReassociatePass::OptimizeExpression(BinaryOperator *I,
2073 if (!isa<UnaryOperator>(I) && !isa<BinaryOperator>(I))
2130 if (BinaryOperator *Tmp = dyn_cast<BinaryOperator>(U))
2130 if (BinaryOperator *Tmp = dyn_cast<BinaryOperator>(U))
2148 Value *Op = isa<BinaryOperator>(I) ? I->getOperand(1) :
2157 if (BinaryOperator *Tmp = dyn_cast<BinaryOperator>(U))
2157 if (BinaryOperator *Tmp = dyn_cast<BinaryOperator>(U))
2169 BinaryOperator *BO = cast<BinaryOperator>(I);
2169 BinaryOperator *BO = cast<BinaryOperator>(I);
2196 void ReassociatePass::ReassociateExpression(BinaryOperator *I) {
lib/Transforms/Scalar/Scalarizer.cpp 142 BinarySplitter(BinaryOperator &bo) : BO(bo) {}
149 BinaryOperator &BO;
189 bool visitBinaryOperator(BinaryOperator &BO);
594 bool ScalarizerVisitor::visitBinaryOperator(BinaryOperator &BO) {
lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp 267 APInt findInEitherOperand(BinaryOperator *BO, bool SignExtended,
319 bool CanTraceInto(bool SignExtended, bool ZeroExtended, BinaryOperator *BO,
485 BinaryOperator *BO,
548 APInt ConstantOffsetExtractor::findInEitherOperand(BinaryOperator *BO,
585 } else if (BinaryOperator *BO = dyn_cast<BinaryOperator>(V)) {
585 } else if (BinaryOperator *BO = dyn_cast<BinaryOperator>(V)) {
666 BinaryOperator *BO = cast<BinaryOperator>(U);
666 BinaryOperator *BO = cast<BinaryOperator>(U);
672 BinaryOperator *NewBO = nullptr;
674 NewBO = BinaryOperator::Create(BO->getOpcode(), NextInChain, TheOther,
677 NewBO = BinaryOperator::Create(BO->getOpcode(), TheOther, NextInChain,
689 BinaryOperator *BO = cast<BinaryOperator>(UserChain[ChainIndex]);
689 BinaryOperator *BO = cast<BinaryOperator>(UserChain[ChainIndex]);
707 BinaryOperator::BinaryOps NewOp = BO->getOpcode();
725 BinaryOperator *NewBO;
727 NewBO = BinaryOperator::Create(NewOp, NextInChain, TheOther, "", IP);
729 NewBO = BinaryOperator::Create(NewOp, TheOther, NextInChain, "", IP);
1270 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(FirstOffsetDef)) {
1270 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(FirstOffsetDef)) {
lib/Transforms/Scalar/StructurizeCFG.cpp 422 return BinaryOperator::CreateNot(Condition, "", Parent->getTerminator());
427 return BinaryOperator::CreateNot(Condition,
lib/Transforms/Utils/Evaluator.cpp 398 } else if (BinaryOperator *BO = dyn_cast<BinaryOperator>(CurInst)) {
398 } else if (BinaryOperator *BO = dyn_cast<BinaryOperator>(CurInst)) {
lib/Transforms/Utils/IntegerDivision.cpp 375 bool llvm::expandRemainder(BinaryOperator *Rem) {
404 BinaryOperator *BO = dyn_cast<BinaryOperator>(Builder.GetInsertPoint());
404 BinaryOperator *BO = dyn_cast<BinaryOperator>(Builder.GetInsertPoint());
417 if (BinaryOperator *UDiv = dyn_cast<BinaryOperator>(Builder.GetInsertPoint())) {
417 if (BinaryOperator *UDiv = dyn_cast<BinaryOperator>(Builder.GetInsertPoint())) {
433 bool llvm::expandDivision(BinaryOperator *Div) {
463 BinaryOperator *BO = dyn_cast<BinaryOperator>(Builder.GetInsertPoint());
463 BinaryOperator *BO = dyn_cast<BinaryOperator>(Builder.GetInsertPoint());
485 bool llvm::expandRemainderUpTo32Bits(BinaryOperator *Rem) {
526 return expandRemainder(cast<BinaryOperator>(ExtRem));
534 bool llvm::expandRemainderUpTo64Bits(BinaryOperator *Rem) {
574 return expandRemainder(cast<BinaryOperator>(ExtRem));
583 bool llvm::expandDivisionUpTo32Bits(BinaryOperator *Div) {
623 return expandDivision(cast<BinaryOperator>(ExtDiv));
631 bool llvm::expandDivisionUpTo64Bits(BinaryOperator *Div) {
672 return expandDivision(cast<BinaryOperator>(ExtDiv));
lib/Transforms/Utils/Local.cpp 1685 } else if (auto *BI = dyn_cast<BinaryOperator>(&I)) {
1685 } else if (auto *BI = dyn_cast<BinaryOperator>(&I)) {
lib/Transforms/Utils/LoopVersioning.cpp 78 RuntimeCheck = BinaryOperator::Create(Instruction::Or, MemRuntimeCheck,
lib/Transforms/Utils/LowerSwitch.cpp 364 Instruction* Add = BinaryOperator::CreateAdd(Val, NegLo,
lib/Transforms/Utils/PredicateInfo.cpp 361 ConditionsToProcess.push_back(cast<BinaryOperator>(Operand)->getOperand(0));
362 ConditionsToProcess.push_back(cast<BinaryOperator>(Operand)->getOperand(1));
377 } else if (auto *BinOp = dyn_cast<BinaryOperator>(Cond)) {
377 } else if (auto *BinOp = dyn_cast<BinaryOperator>(Cond)) {
428 auto *BinOp = cast<BinaryOperator>(BI->getCondition());
428 auto *BinOp = cast<BinaryOperator>(BI->getCondition());
445 } else if (auto *BinOp = dyn_cast<BinaryOperator>(Cond)) {
445 } else if (auto *BinOp = dyn_cast<BinaryOperator>(Cond)) {
lib/Transforms/Utils/SimplifyCFG.cpp 2364 (isa<BinaryOperator>(PN->getIncomingValue(0)) ||
2365 isa<BinaryOperator>(PN->getIncomingValue(1)) ||
2366 isa<BinaryOperator>(IfCond)) &&
2533 if (!isa<BinaryOperator>(Inst) && !isa<CmpInst>(Inst))
2610 if (!Cond || (!isa<CmpInst>(Cond) && !isa<BinaryOperator>(Cond)) ||
3011 if (!isa<BinaryOperator>(I) && !isa<GetElementPtrInst>(I))
5280 Value *InvertedTableCmp = BinaryOperator::CreateXor(
lib/Transforms/Utils/SimplifyIndVar.cpp 89 void simplifyIVRemainder(BinaryOperator *Rem, Value *IVOperand,
91 void replaceRemWithNumerator(BinaryOperator *Rem);
92 void replaceRemWithNumeratorOrZero(BinaryOperator *Rem);
93 void replaceSRemWithURem(BinaryOperator *Rem);
94 bool eliminateSDiv(BinaryOperator *SDiv);
95 bool strengthenOverflowingOperation(BinaryOperator *OBO, Value *IVOperand);
96 bool strengthenRightShift(BinaryOperator *BO, Value *IVOperand);
126 if (!isa<BinaryOperator>(IVOperand)
292 bool SimplifyIndvar::eliminateSDiv(BinaryOperator *SDiv) {
304 auto *UDiv = BinaryOperator::Create(
304 auto *UDiv = BinaryOperator::Create(
305 BinaryOperator::UDiv, SDiv->getOperand(0), SDiv->getOperand(1),
320 void SimplifyIndvar::replaceSRemWithURem(BinaryOperator *Rem) {
322 auto *URem = BinaryOperator::Create(BinaryOperator::URem, N, D,
322 auto *URem = BinaryOperator::Create(BinaryOperator::URem, N, D,
322 auto *URem = BinaryOperator::Create(BinaryOperator::URem, N, D,
332 void SimplifyIndvar::replaceRemWithNumerator(BinaryOperator *Rem) {
341 void SimplifyIndvar::replaceRemWithNumeratorOrZero(BinaryOperator *Rem) {
356 void SimplifyIndvar::simplifyIVRemainder(BinaryOperator *Rem, Value *IVOperand,
450 BinaryOperator *NewResult = BinaryOperator::Create(
450 BinaryOperator *NewResult = BinaryOperator::Create(
487 BinaryOperator *BO = BinaryOperator::Create(
487 BinaryOperator *BO = BinaryOperator::Create(
622 if (BinaryOperator *Bin = dyn_cast<BinaryOperator>(UseInst)) {
622 if (BinaryOperator *Bin = dyn_cast<BinaryOperator>(UseInst)) {
729 bool SimplifyIndvar::strengthenOverflowingOperation(BinaryOperator *BO,
764 bool SimplifyIndvar::strengthenRightShift(BinaryOperator *BO,
777 BinaryOperator *Shr = cast<BinaryOperator>(U);
777 BinaryOperator *Shr = cast<BinaryOperator>(U);
906 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(UseInst)) {
906 if (BinaryOperator *BO = dyn_cast<BinaryOperator>(UseInst)) {
lib/Transforms/Vectorize/LoadStoreVectorizer.cpp 455 Safe = cast<BinaryOperator>(OpB)->hasNoSignedWrap();
457 Safe = cast<BinaryOperator>(OpB)->hasNoUnsignedWrap();
lib/Transforms/Vectorize/LoopVectorize.cpp 3323 if (auto *BO = dyn_cast<BinaryOperator>(I)) {
3323 if (auto *BO = dyn_cast<BinaryOperator>(I)) {
3330 cast<BinaryOperator>(NewI)->copyIRFlags(I, /*IncludeWrapFlags=*/false);
lib/Transforms/Vectorize/SLPVectorizer.cpp 370 bool IsBinOp = isa<BinaryOperator>(VL[BaseIndex]);
379 if (IsBinOp && isa<BinaryOperator>(VL[Cnt])) {
2591 if (isa<BinaryOperator>(VL0) && VL0->isCommutative()) {
2778 if (isa<BinaryOperator>(VL0)) {
3118 unsigned OpIdx = isa<BinaryOperator>(I) ? 1 : 0;
3309 ZextLoad = cast<BinaryOperator>(ZextLoad)->getOperand(0);
4961 isa<CmpInst>(I) || isa<SelectInst>(I) || isa<BinaryOperator>(I)) {
5639 if (!isa<BinaryOperator>(I) && !isa<CmpInst>(I))
5654 auto *A = dyn_cast<BinaryOperator>(Op0);
5654 auto *A = dyn_cast<BinaryOperator>(Op0);
5655 auto *B = dyn_cast<BinaryOperator>(Op1);
5655 auto *B = dyn_cast<BinaryOperator>(Op1);
5658 auto *B0 = dyn_cast<BinaryOperator>(B->getOperand(0));
5658 auto *B0 = dyn_cast<BinaryOperator>(B->getOperand(0));
5659 auto *B1 = dyn_cast<BinaryOperator>(B->getOperand(1));
5659 auto *B1 = dyn_cast<BinaryOperator>(B->getOperand(1));
5668 auto *A0 = dyn_cast<BinaryOperator>(A->getOperand(0));
5668 auto *A0 = dyn_cast<BinaryOperator>(A->getOperand(0));
5669 auto *A1 = dyn_cast<BinaryOperator>(A->getOperand(1));
5669 auto *A1 = dyn_cast<BinaryOperator>(A->getOperand(1));
6141 return OperationData(cast<BinaryOperator>(V)->getOpcode(), LHS, RHS,
6761 auto *BI = dyn_cast<BinaryOperator>(Inst);
6761 auto *BI = dyn_cast<BinaryOperator>(Inst);
6816 if (!isa<BinaryOperator>(I))
tools/clang/lib/CodeGen/CGExprScalar.cpp 3278 static Value* buildFMulAdd(llvm::BinaryOperator *MulOp, Value *Addend,
3326 if (auto *LHSBinOp = dyn_cast<llvm::BinaryOperator>(op.LHS)) {
3326 if (auto *LHSBinOp = dyn_cast<llvm::BinaryOperator>(op.LHS)) {
3331 if (auto *RHSBinOp = dyn_cast<llvm::BinaryOperator>(op.RHS)) {
3331 if (auto *RHSBinOp = dyn_cast<llvm::BinaryOperator>(op.RHS)) {
tools/lldb/source/Expression/IRInterpreter.cpp 710 const BinaryOperator *bin_op = dyn_cast<BinaryOperator>(inst);
710 const BinaryOperator *bin_op = dyn_cast<BinaryOperator>(inst);
tools/llvm-stress/llvm-stress.cpp 410 PT->push_back(BinaryOperator::Create(Op, Val0, Val1, "B", Term));
tools/polly/include/polly/CodeGen/BlockGenerators.h 735 void copyBinaryInst(ScopStmt &Stmt, BinaryOperator *Inst,
tools/polly/include/polly/CodeGen/IslExprBuilder.h 231 llvm::Value *createBinOp(llvm::BinaryOperator::BinaryOps Opc,
tools/polly/lib/Analysis/ScopBuilder.cpp 456 } else if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(Condition)) {
456 } else if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(Condition)) {
2651 static MemoryAccess::ReductionType getReductionType(const BinaryOperator *BinOp,
2733 getReductionType(dyn_cast<BinaryOperator>(Load->user_back()), Load);
3096 auto *BinOp = dyn_cast<BinaryOperator>(Store->getValueOperand());
3096 auto *BinOp = dyn_cast<BinaryOperator>(Store->getValueOperand());
tools/polly/lib/Analysis/ScopDetection.cpp 563 if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(Condition)) {
563 if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(Condition)) {
tools/polly/lib/CodeGen/BlockGenerators.cpp 1173 void VectorBlockGenerator::copyBinaryInst(ScopStmt &Stmt, BinaryOperator *Inst,
1322 if (auto *Binary = dyn_cast<BinaryOperator>(Inst)) {
1322 if (auto *Binary = dyn_cast<BinaryOperator>(Inst)) {
1589 Instruction *LoopPHIInc = BinaryOperator::CreateAdd(
tools/polly/lib/CodeGen/IslExprBuilder.cpp 99 Value *IslExprBuilder::createBinOp(BinaryOperator::BinaryOps Opc, Value *LHS,
tools/polly/lib/Support/SCEVValidator.cpp 683 } else if (auto *BinOp = dyn_cast<BinaryOperator>(V)) {
683 } else if (auto *BinOp = dyn_cast<BinaryOperator>(V)) {
tools/polly/lib/Support/ScopHelper.cpp 324 Inst = BinaryOperator::Create((Instruction::BinaryOps)Inst->getOpcode(),
unittests/Analysis/AliasAnalysisTest.cpp 179 auto *Add1 = BinaryOperator::CreateAdd(Value, Value, "add", BB);
179 auto *Add1 = BinaryOperator::CreateAdd(Value, Value, "add", BB);
unittests/Analysis/ScalarEvolutionTest.cpp 355 Muls[0] = BinaryOperator::CreateMul(Acc[0], Acc[0], "", LoopBB);
356 NextAcc[0] = BinaryOperator::CreateAdd(Muls[0], Acc[4], "", LoopBB);
357 Muls[1] = BinaryOperator::CreateMul(Acc[1], Acc[1], "", LoopBB);
358 NextAcc[1] = BinaryOperator::CreateAdd(Muls[1], Acc[5], "", LoopBB);
359 Muls[2] = BinaryOperator::CreateMul(Acc[2], Acc[2], "", LoopBB);
360 NextAcc[2] = BinaryOperator::CreateAdd(Muls[2], Acc[6], "", LoopBB);
361 Muls[3] = BinaryOperator::CreateMul(Acc[3], Acc[3], "", LoopBB);
362 NextAcc[3] = BinaryOperator::CreateAdd(Muls[3], Acc[7], "", LoopBB);
364 Muls[4] = BinaryOperator::CreateMul(Acc[4], Acc[4], "", LoopBB);
365 NextAcc[4] = BinaryOperator::CreateAdd(Muls[4], Acc[0], "", LoopBB);
366 Muls[5] = BinaryOperator::CreateMul(Acc[5], Acc[5], "", LoopBB);
367 NextAcc[5] = BinaryOperator::CreateAdd(Muls[5], Acc[1], "", LoopBB);
368 Muls[6] = BinaryOperator::CreateMul(Acc[6], Acc[6], "", LoopBB);
369 NextAcc[6] = BinaryOperator::CreateAdd(Muls[6], Acc[2], "", LoopBB);
370 Muls[7] = BinaryOperator::CreateMul(Acc[7], Acc[7], "", LoopBB);
371 NextAcc[7] = BinaryOperator::CreateAdd(Muls[7], Acc[3], "", LoopBB);
386 Acc[0] = BinaryOperator::CreateAdd(Acc[0], Acc[1], "", ExitBB);
387 Acc[1] = BinaryOperator::CreateAdd(Acc[2], Acc[3], "", ExitBB);
388 Acc[2] = BinaryOperator::CreateAdd(Acc[4], Acc[5], "", ExitBB);
389 Acc[3] = BinaryOperator::CreateAdd(Acc[6], Acc[7], "", ExitBB);
390 Acc[0] = BinaryOperator::CreateAdd(Acc[0], Acc[1], "", ExitBB);
391 Acc[1] = BinaryOperator::CreateAdd(Acc[2], Acc[3], "", ExitBB);
392 Acc[0] = BinaryOperator::CreateAdd(Acc[0], Acc[1], "", ExitBB);
423 auto *MulA = BinaryOperator::CreateMul(X, Y, "", EntryBB);
423 auto *MulA = BinaryOperator::CreateMul(X, Y, "", EntryBB);
424 auto *MulB = BinaryOperator::CreateMul(Y, X, "", EntryBB);
424 auto *MulB = BinaryOperator::CreateMul(Y, X, "", EntryBB);
452 Instruction *Mul1 = BinaryOperator::CreateMul(Trunc, A2, "", EntryBB);
453 Instruction *Add1 = BinaryOperator::CreateAdd(Mul1, Trunc, "", EntryBB);
454 Mul1 = BinaryOperator::CreateMul(Add1, Trunc, "", EntryBB);
455 Instruction *Add2 = BinaryOperator::CreateAdd(Mul1, Add1, "", EntryBB);
461 Mul1 = BinaryOperator::CreateMul(Add2, Add1, "", EntryBB);
463 Add2 = BinaryOperator::CreateAdd(Mul1, Add1, "", EntryBB);
705 auto *Dec = BinaryOperator::CreateNSWAdd(
705 auto *Dec = BinaryOperator::CreateNSWAdd(
1019 auto *Shl = BinaryOperator::CreateShl(Phi, Int64_32, "", Br);
1019 auto *Shl = BinaryOperator::CreateShl(Phi, Int64_32, "", Br);
1020 auto *AShr = BinaryOperator::CreateExactAShr(Shl, Int64_32, "", Br);
1020 auto *AShr = BinaryOperator::CreateExactAShr(Shl, Int64_32, "", Br);
1021 auto *Add = BinaryOperator::CreateAdd(AShr, MinInt64, "", Br);
1021 auto *Add = BinaryOperator::CreateAdd(AShr, MinInt64, "", Br);
1076 auto *Shl = BinaryOperator::CreateShl(Phi, Int32_16, "", Br);
1076 auto *Shl = BinaryOperator::CreateShl(Phi, Int32_16, "", Br);
1077 auto *AShr = BinaryOperator::CreateExactAShr(Shl, Int32_16, "", Br);
1077 auto *AShr = BinaryOperator::CreateExactAShr(Shl, Int32_16, "", Br);
1078 auto *Add = BinaryOperator::CreateAdd(AShr, MinInt32, "", Br);
1078 auto *Add = BinaryOperator::CreateAdd(AShr, MinInt32, "", Br);
1559 auto *NextBinOp = dyn_cast<BinaryOperator>(Next);
1559 auto *NextBinOp = dyn_cast<BinaryOperator>(Next);
1660 BinaryOperator *And = cast<BinaryOperator>(*Load->user_begin());
1660 BinaryOperator *And = cast<BinaryOperator>(*Load->user_begin());
unittests/IR/AsmWriterTest.cpp 28 std::unique_ptr<BinaryOperator> Add(BinaryOperator::CreateAdd(Undef, Undef));
28 std::unique_ptr<BinaryOperator> Add(BinaryOperator::CreateAdd(Undef, Undef));
unittests/IR/BasicBlockTest.cpp 51 auto *Sum = BinaryOperator::CreateAdd(P1, P2, "sum", BI);
51 auto *Sum = BinaryOperator::CreateAdd(P1, P2, "sum", BI);
unittests/IR/InstructionsTest.cpp 1053 BinaryOperator *FAdd = BinaryOperator::CreateFAdd(One, One);
1053 BinaryOperator *FAdd = BinaryOperator::CreateFAdd(One, One);
unittests/IR/ValueHandleTest.cpp 342 std::unique_ptr<BinaryOperator> BitcastUser(BinaryOperator::CreateAdd(
342 std::unique_ptr<BinaryOperator> BitcastUser(BinaryOperator::CreateAdd(
unittests/IR/ValueMapTest.cpp 27 std::unique_ptr<BinaryOperator> AddV;
32 AddV(BinaryOperator::CreateAdd(ConstantV, ConstantV)) {}
unittests/Transforms/Utils/CloningTest.cpp 38 T *clone(T *V1) {
38 T *clone(T *V1) {
42 return cast<T>(V2);
70 BinaryOperator *Add = BinaryOperator::Create(Instruction::Add, V, V);
70 BinaryOperator *Add = BinaryOperator::Create(Instruction::Add, V, V);
71 BinaryOperator *Sub = BinaryOperator::Create(Instruction::Sub, V, V);
71 BinaryOperator *Sub = BinaryOperator::Create(Instruction::Sub, V, V);
72 BinaryOperator *Mul = BinaryOperator::Create(Instruction::Mul, V, V);
72 BinaryOperator *Mul = BinaryOperator::Create(Instruction::Mul, V, V);
74 BinaryOperator *AddClone = this->clone(Add);
75 BinaryOperator *SubClone = this->clone(Sub);
76 BinaryOperator *MulClone = this->clone(Mul);
154 BinaryOperator *SDiv = BinaryOperator::Create(Instruction::SDiv, V, V);
154 BinaryOperator *SDiv = BinaryOperator::Create(Instruction::SDiv, V, V);
unittests/Transforms/Utils/IntegerDivisionTest.cpp 45 expandDivision(cast<BinaryOperator>(Div));
75 expandDivision(cast<BinaryOperator>(Div));
105 expandRemainder(cast<BinaryOperator>(Rem));
135 expandRemainder(cast<BinaryOperator>(Rem));
166 expandDivision(cast<BinaryOperator>(Div));
196 expandDivision(cast<BinaryOperator>(Div));
226 expandRemainder(cast<BinaryOperator>(Rem));
256 expandRemainder(cast<BinaryOperator>(Rem));
usr/include/c++/7.4.0/bits/unique_ptr.h 68 default_delete(const default_delete<_Up>&) noexcept { }
72 operator()(_Tp* __ptr) const
74 static_assert(!is_void<_Tp>::value,
76 static_assert(sizeof(_Tp)>0,
122 using type = _Up*;
137 using pointer = typename _Ptr<_Tp, _Dp>::type;
161 typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type;
163 __uniq_ptr_impl<_Tp, _Dp> _M_t;
166 using pointer = typename __uniq_ptr_impl<_Tp, _Dp>::pointer;
167 using element_type = _Tp;
usr/include/c++/7.4.0/type_traits 215 : public __is_void_helper<typename remove_cv<_Tp>::type>::type
381 : public __is_pointer_helper<typename remove_cv<_Tp>::type>::type
581 : public __or_<is_lvalue_reference<_Tp>,
582 is_rvalue_reference<_Tp>>::type
601 : public __not_<__or_<is_function<_Tp>, is_reference<_Tp>,
601 : public __not_<__or_<is_function<_Tp>, is_reference<_Tp>,
602 is_void<_Tp>>>::type
638 : public __or_<is_object<_Tp>, is_reference<_Tp>>::type
638 : public __or_<is_object<_Tp>, is_reference<_Tp>>::type
1554 { typedef _Tp type; };
1558 { typedef _Tp type; };
1563 { typedef _Tp type; };
1574 remove_const<typename remove_volatile<_Tp>::type>::type type;
1645 { typedef _Tp& type; };
1650 : public __add_lvalue_reference_helper<_Tp>
1983 { typedef _Up type; };
utils/unittest/googletest/include/gtest/gtest-printers.h 407 T* p, ::std::ostream* os) {
416 if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {