diff options
author | Duncan Sands <baldrick@free.fr> | 2010-11-23 15:28:14 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2010-11-23 15:28:14 +0000 |
commit | e104f1bccbf828dcbe4e82709c8ca97d8bf018d5 (patch) | |
tree | 3c500884c8442ff08ac36879c5e17518ffc216e6 /lib/Transforms | |
parent | c2b1c0b85d09aa69a625c1baacab0a310b4be552 (diff) | |
download | external_llvm-e104f1bccbf828dcbe4e82709c8ca97d8bf018d5.zip external_llvm-e104f1bccbf828dcbe4e82709c8ca97d8bf018d5.tar.gz external_llvm-e104f1bccbf828dcbe4e82709c8ca97d8bf018d5.tar.bz2 |
Propagate LeftDistributes and RightDistributes into their only uses.
Stylistic improvement suggested by Frits van Bommel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120026 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/InstCombine/InstructionCombining.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp index 9a203f8..22651e3 100644 --- a/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -304,14 +304,11 @@ Instruction *InstCombiner::SimplifyDistributed(BinaryOperator &I) { Instruction::BinaryOps OuterOpcode = I.getOpcode(); // op Instruction::BinaryOps InnerOpcode = Op0->getOpcode(); // op' - // Does "X op' (Y op Z)" always equal "(X op' Y) op (X op' Z)"? - bool LeftDistributes = LeftDistributesOverRight(InnerOpcode, OuterOpcode); - // Does "(X op Y) op' Z" always equal "(X op' Z) op (Y op' Z)"? - bool RightDistributes = RightDistributesOverLeft(OuterOpcode, InnerOpcode); // Does "X op' Y" always equal "Y op' X"? bool InnerCommutative = Instruction::isCommutative(InnerOpcode); - if (LeftDistributes) + // Does "X op' (Y op Z)" always equal "(X op' Y) op (X op' Z)"? + if (LeftDistributesOverRight(InnerOpcode, OuterOpcode)) // Does the instruction have the form "(A op' B) op (A op' D)" or, in the // commutative case, "(A op' B) op (C op' A)"? if (A == C || (InnerCommutative && A == D)) { @@ -328,7 +325,8 @@ Instruction *InstCombiner::SimplifyDistributed(BinaryOperator &I) { return BinaryOperator::Create(InnerOpcode, A, RHS); } - if (RightDistributes) + // Does "(X op Y) op' Z" always equal "(X op' Z) op (Y op' Z)"? + if (RightDistributesOverLeft(OuterOpcode, InnerOpcode)) // Does the instruction have the form "(A op' B) op (C op' B)" or, in the // commutative case, "(A op' B) op (B op' D)"? if (B == D || (InnerCommutative && B == C)) { |