[llvm] r325628 - [InstCombine] remove unneeded operand swap: NFCI

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 13:52:46 PST 2018


Author: spatel
Date: Tue Feb 20 13:52:46 2018
New Revision: 325628

URL: http://llvm.org/viewvc/llvm-project?rev=325628&view=rev
Log:
[InstCombine] remove unneeded operand swap: NFCI

FMul is commutative, so complexity-based canonicalization should always 
take care of the swap via SimplifyAssociativeOrCommutative(). 

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp?rev=325628&r1=325627&r2=325628&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp Tue Feb 20 13:52:46 2018
@@ -549,9 +549,6 @@ Instruction *InstCombiner::visitFMul(Bin
   if (Value *V = SimplifyVectorOp(I))
     return replaceInstUsesWith(I, V);
 
-  if (isa<Constant>(Op0))
-    std::swap(Op0, Op1);
-
   if (Value *V = SimplifyFMulInst(Op0, Op1, I.getFastMathFlags(),
                                   SQ.getWithInstruction(&I)))
     return replaceInstUsesWith(I, V);




More information about the llvm-commits mailing list