[llvm-commits] [llvm] r120051 - in /llvm/trunk/lib/Transforms/InstCombine: InstCombine.h InstCombineAddSub.cpp InstCombineAndOrXor.cpp InstructionCombining.cpp

Duncan Sands baldrick at free.fr
Tue Nov 23 12:42:39 PST 2010


Author: baldrick
Date: Tue Nov 23 14:42:39 2010
New Revision: 120051

URL: http://llvm.org/viewvc/llvm-project?rev=120051&view=rev
Log:
Rename SimplifyDistributed to the more meaningfull name SimplifyByFactorizing.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombine.h
    llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombine.h?rev=120051&r1=120050&r2=120051&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombine.h (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombine.h Tue Nov 23 14:42:39 2010
@@ -290,11 +290,11 @@
   /// operators which are associative or commutative.
   bool SimplifyAssociativeOrCommutative(BinaryOperator &I);
 
-  /// SimplifyDistributed - This tries to simplify binary operations which some
-  /// other binary operation distributes over (eg "A*B+A*C" -> "A*(B+C)" since
-  /// addition is distributed over by multiplication).  Returns the result of
-  /// the simplification, or null if no simplification was performed.
-  Instruction *SimplifyDistributed(BinaryOperator &I);
+  /// SimplifyByFactorizing - This tries to simplify binary operations which
+  /// some other binary operation distributes over by factorizing out a common
+  /// term (eg "(A*B)+(A*C)" -> "A*(B+C)").  Returns the simplified value, or
+  /// null if no simplification was performed.
+  Instruction *SimplifyByFactorizing(BinaryOperator &I);
 
   /// SimplifyDemandedUseBits - Attempts to replace V with a simpler value
   /// based on the demanded bits.

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp?rev=120051&r1=120050&r2=120051&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp Tue Nov 23 14:42:39 2010
@@ -91,7 +91,7 @@
                                  I.hasNoUnsignedWrap(), TD))
     return ReplaceInstUsesWith(I, V);
 
-  if (Instruction *NV = SimplifyDistributed(I)) // (A*B)+(A*C) -> A*(B+C)
+  if (Instruction *NV = SimplifyByFactorizing(I)) // (A*B)+(A*C) -> A*(B+C)
     return NV;
   
   if (Constant *RHSC = dyn_cast<Constant>(RHS)) {
@@ -550,7 +550,7 @@
   if (Op0 == Op1)                        // sub X, X  -> 0
     return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
 
-  if (Instruction *NV = SimplifyDistributed(I)) // (A*B)-(A*C) -> A*(B-C)
+  if (Instruction *NV = SimplifyByFactorizing(I)) // (A*B)-(A*C) -> A*(B-C)
     return NV;
   
   // If this is a 'B = x-(-A)', change to B = x+A.  This preserves NSW/NUW.

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=120051&r1=120050&r2=120051&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Tue Nov 23 14:42:39 2010
@@ -984,7 +984,7 @@
   if (Value *V = SimplifyAndInst(Op0, Op1, TD))
     return ReplaceInstUsesWith(I, V);
 
-  if (Instruction *NV = SimplifyDistributed(I)) // (A|B)&(A|C) -> A|(B&C)
+  if (Instruction *NV = SimplifyByFactorizing(I)) // (A|B)&(A|C) -> A|(B&C)
     return NV;
 
   // See if we can simplify any instructions used by the instruction whose sole 
@@ -1695,7 +1695,7 @@
   if (Value *V = SimplifyOrInst(Op0, Op1, TD))
     return ReplaceInstUsesWith(I, V);
 
-  if (Instruction *NV = SimplifyDistributed(I)) // (A&B)|(A&C) -> A&(B|C)
+  if (Instruction *NV = SimplifyByFactorizing(I)) // (A&B)|(A&C) -> A&(B|C)
     return NV;
 
   // See if we can simplify any instructions used by the instruction whose sole 
@@ -1966,7 +1966,7 @@
   if (Value *V = SimplifyXorInst(Op0, Op1, TD))
     return ReplaceInstUsesWith(I, V);
 
-  if (Instruction *NV = SimplifyDistributed(I)) // (A&B)^(A&C) -> A&(B^C)
+  if (Instruction *NV = SimplifyByFactorizing(I)) // (A&B)^(A&C) -> A&(B^C)
     return NV;
 
   // See if we can simplify any instructions used by the instruction whose sole 

Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=120051&r1=120050&r2=120051&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Tue Nov 23 14:42:39 2010
@@ -288,11 +288,11 @@
   return false;
 }
 
-/// SimplifyDistributed - This tries to simplify binary operations which some
-/// other binary operation distributes over (eg "A*B+A*C" -> "A*(B+C)" since
-/// addition is distributed over by multiplication).  Returns the result of
-/// the simplification, or null if no simplification was performed.
-Instruction *InstCombiner::SimplifyDistributed(BinaryOperator &I) {
+/// SimplifyByFactorizing - This tries to simplify binary operations which
+/// some other binary operation distributes over by factorizing out a common
+/// term (eg "(A*B)+(A*C)" -> "A*(B+C)").  Returns the simplified value, or
+/// null if no simplification was performed.
+Instruction *InstCombiner::SimplifyByFactorizing(BinaryOperator &I) {
   BinaryOperator *Op0 = dyn_cast<BinaryOperator>(I.getOperand(0));
   BinaryOperator *Op1 = dyn_cast<BinaryOperator>(I.getOperand(1));
   if (!Op0 || !Op1 || Op0->getOpcode() != Op1->getOpcode())





More information about the llvm-commits mailing list