[llvm] r306885 - [InstCombine] Replace an unnecessary use of a matcher with just an isa and a cast. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 30 14:09:34 PDT 2017


Author: ctopper
Date: Fri Jun 30 14:09:34 2017
New Revision: 306885

URL: http://llvm.org/viewvc/llvm-project?rev=306885&view=rev
Log:
[InstCombine] Replace an unnecessary use of a matcher with just an isa and a cast. NFC

We aren't looking through any levels of IR here so I don't think we need the power of a matcher or the temporary variable it requires.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h?rev=306885&r1=306884&r2=306885&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h Fri Jun 30 14:09:34 2017
@@ -131,11 +131,10 @@ static inline bool IsFreeToInvert(Value
     return true;
 
   // A vector of constant integers can be inverted easily.
-  Constant *CV;
-  if (V->getType()->isVectorTy() && match(V, PatternMatch::m_Constant(CV))) {
+  if (V->getType()->isVectorTy() && isa<Constant>(V)) {
     unsigned NumElts = V->getType()->getVectorNumElements();
     for (unsigned i = 0; i != NumElts; ++i) {
-      Constant *Elt = CV->getAggregateElement(i);
+      Constant *Elt = cast<Constant>(V)->getAggregateElement(i);
       if (!Elt)
         return false;
 




More information about the llvm-commits mailing list