[llvm-commits] [llvm] r120026 - /llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
Duncan Sands
baldrick at free.fr
Tue Nov 23 07:28:14 PST 2010
Author: baldrick
Date: Tue Nov 23 09:28:14 2010
New Revision: 120026
URL: http://llvm.org/viewvc/llvm-project?rev=120026&view=rev
Log:
Propagate LeftDistributes and RightDistributes into their only uses.
Stylistic improvement suggested by Frits van Bommel.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=120026&r1=120025&r2=120026&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Tue Nov 23 09:28:14 2010
@@ -304,14 +304,11 @@
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 @@
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)) {
More information about the llvm-commits
mailing list