[llvm] r345050 - [InstCombine] use 'match' to simplify code

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 23 09:54:28 PDT 2018


Author: spatel
Date: Tue Oct 23 09:54:28 2018
New Revision: 345050

URL: http://llvm.org/viewvc/llvm-project?rev=345050&view=rev
Log:
[InstCombine] use 'match' to simplify code

There's probably some vector-with-undef-element pattern
that shows an improvement, so this is probably not quite
'NFC'.

This is the last step towards removing the fake binop 
queries for not/neg. Ie, there are no more uses of those
functions in trunk. Fneg should follow.

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=345050&r1=345049&r2=345050&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h Tue Oct 23 09:54:28 2018
@@ -141,7 +141,7 @@ static inline Constant *SubOne(Constant
 /// uses of V and only keep uses of ~V.
 static inline bool IsFreeToInvert(Value *V, bool WillInvertAllUses) {
   // ~(~(X)) -> X.
-  if (BinaryOperator::isNot(V))
+  if (match(V, m_Not(m_Value())))
     return true;
 
   // Constants can be considered to be not'ed values.




More information about the llvm-commits mailing list