summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2010-11-23 15:28:14 +0000
committerDuncan Sands <baldrick@free.fr>2010-11-23 15:28:14 +0000
commit60813f96e0d49bb525816802af245b1db12c4fed (patch)
tree0c56bd32eaa4905598ea61054c2c217f0aec4dad /llvm/lib/Transforms
parent22df741687da8f826612167ef08deac32627bb04 (diff)
downloadbcm5719-llvm-60813f96e0d49bb525816802af245b1db12c4fed.tar.gz
bcm5719-llvm-60813f96e0d49bb525816802af245b1db12c4fed.zip
Propagate LeftDistributes and RightDistributes into their only uses.
Stylistic improvement suggested by Frits van Bommel. llvm-svn: 120026
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstructionCombining.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 9a203f8512e..22651e30f38 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/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)) {
OpenPOWER on IntegriCloud