]> granicus.if.org Git - llvm/commitdiff
[InstCombine] Replace an unnecessary use of a matcher with just an isa and a cast...
authorCraig Topper <craig.topper@intel.com>
Fri, 30 Jun 2017 21:09:34 +0000 (21:09 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 30 Jun 2017 21:09:34 +0000 (21:09 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306885 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineInternal.h

index 1b0fe84dd4dda5cf5e2b996cbeea62d71edcb415..87f11467b95e2ae6476f5ab6495b3b57852370e7 100644 (file)
@@ -131,11 +131,10 @@ static inline bool IsFreeToInvert(Value *V, bool WillInvertAllUses) {
     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;