/// This tries to simplify binary operations by factorizing out common terms
/// (e. g. "(A*B)+(A*C)" -> "A*(B+C)").
- Value *tryFactorization(InstCombiner::BuilderTy *, BinaryOperator &,
- Instruction::BinaryOps, Value *, Value *, Value *,
- Value *);
+ Value *tryFactorization(BinaryOperator &, Instruction::BinaryOps, Value *,
+ Value *, Value *, Value *);
/// Match a select chain which produces one of three values based on whether
/// the LHS is less than, equal to, or greater than RHS respectively.
/// This tries to simplify binary operations by factorizing out common terms
/// (e. g. "(A*B)+(A*C)" -> "A*(B+C)").
-Value *InstCombiner::tryFactorization(InstCombiner::BuilderTy *Builder,
- BinaryOperator &I,
+Value *InstCombiner::tryFactorization(BinaryOperator &I,
Instruction::BinaryOps InnerOpcode,
Value *A, Value *B, Value *C, Value *D) {
assert(A && B && C && D && "All values must be provided");
// The instruction has the form "(A op' B) op (C op' D)". Try to factorize
// a common term.
if (Op0 && Op1 && LHSOpcode == RHSOpcode)
- if (Value *V = tryFactorization(Builder, I, LHSOpcode, A, B, C, D))
+ if (Value *V = tryFactorization(I, LHSOpcode, A, B, C, D))
return V;
// The instruction has the form "(A op' B) op (C)". Try to factorize common
if (Op0)
if (Value *Ident = getIdentityValue(LHSOpcode, RHS))
if (Value *V =
- tryFactorization(Builder, I, LHSOpcode, A, B, RHS, Ident))
+ tryFactorization(I, LHSOpcode, A, B, RHS, Ident))
return V;
// The instruction has the form "(B) op (C op' D)". Try to factorize common
if (Op1)
if (Value *Ident = getIdentityValue(RHSOpcode, LHS))
if (Value *V =
- tryFactorization(Builder, I, RHSOpcode, LHS, Ident, C, D))
+ tryFactorization(I, RHSOpcode, LHS, Ident, C, D))
return V;
}