[llvm] [InstCombine] Improve `(icmp pred (and X, Y), ...)` fold. (PR #66787)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 06:28:17 PST 2023


================
@@ -233,56 +233,116 @@ class LLVM_LIBRARY_VISIBILITY InstCombiner {
                                                 PatternMatch::m_Value()));
   }
 
-  /// Return true if the specified value is free to invert (apply ~ to).
-  /// This happens in cases where the ~ can be eliminated.  If WillInvertAllUses
-  /// is true, work under the assumption that the caller intends to remove all
-  /// uses of V and only keep uses of ~V.
-  ///
-  /// See also: canFreelyInvertAllUsersOf()
-  static bool isFreeToInvert(Value *V, bool WillInvertAllUses,
-                             unsigned Depth = 0) {
+  /// Return nonnull value if V is free to invert (with condition) regarding
+  /// WillInvertAllUses.
+  /// If Builder is nonnull, it will return a simplified ~V
+  /// If builder is null, it will return an arbitrary nonnull value (not
----------------
nikic wrote:

builder -> Builder for consistency with previous sentence.

https://github.com/llvm/llvm-project/pull/66787


More information about the llvm-commits mailing list