[llvm] r325263 - [InstCombine] use m_OneUse to reduce code; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 08:30:10 PST 2018


Author: spatel
Date: Thu Feb 15 08:30:10 2018
New Revision: 325263

URL: http://llvm.org/viewvc/llvm-project?rev=325263&view=rev
Log:
[InstCombine] use m_OneUse to reduce code; NFC

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=325263&r1=325262&r2=325263&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp Thu Feb 15 08:30:10 2018
@@ -1429,7 +1429,7 @@ Instruction *InstCombiner::visitFDiv(Bin
     Value *NewInst = nullptr;
     Instruction *SimpR = nullptr;
 
-    if (Op0->hasOneUse() && match(Op0, m_FDiv(m_Value(X), m_Value(Y)))) {
+    if (match(Op0, m_OneUse(m_FDiv(m_Value(X), m_Value(Y))))) {
       // (X/Y) / Z => X / (Y*Z)
       if (!isa<Constant>(Y) || !isa<Constant>(Op1)) {
         NewInst = Builder.CreateFMul(Y, Op1);
@@ -1440,7 +1440,7 @@ Instruction *InstCombiner::visitFDiv(Bin
         }
         SimpR = BinaryOperator::CreateFDiv(X, NewInst);
       }
-    } else if (Op1->hasOneUse() && match(Op1, m_FDiv(m_Value(X), m_Value(Y)))) {
+    } else if (match(Op1, m_OneUse(m_FDiv(m_Value(X), m_Value(Y))))) {
       // Z / (X/Y) => Z*Y / X
       if (!isa<Constant>(Y) || !isa<Constant>(Op0)) {
         NewInst = Builder.CreateFMul(Op0, Y);




More information about the llvm-commits mailing list