[InstCombine] remove unneeded operand swap: NFCI
authorSanjay Patel <spatel@rotateright.com>
Tue, 20 Feb 2018 21:52:46 +0000 (21:52 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 20 Feb 2018 21:52:46 +0000 (21:52 +0000)
FMul is commutative, so complexity-based canonicalization should always
take care of the swap via SimplifyAssociativeOrCommutative().

llvm-svn: 325628

llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp

index 7e402eb..cb42d24 100644 (file)
@@ -549,9 +549,6 @@ Instruction *InstCombiner::visitFMul(BinaryOperator &I) {
   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);