[PATCH] Add an instcombine rule to optimize max(~a, ~b) to ~min(a, b) when profitable

David Majnemer david.majnemer at gmail.com
Mon Feb 23 00:29:02 PST 2015


================
Comment at: lib/Transforms/InstCombine/InstCombineInternal.h:85
@@ +84,3 @@
+/// This happens in cases where the ~ can be eliminated.  If WillInvertAllUses
+/// is true, work under the assumption that the caller intends remove all uses
+/// of V and only keep uses of ~V.
----------------
I think you are missing a "to" between "intends" and "remove".

================
Comment at: lib/Transforms/InstCombine/InstCombineInternal.h:88
@@ +87,3 @@
+///
+static inline bool IsFreeToInvert(Value *V, bool WillInvertAllUses) {
+  // ~(~(X)) -> X.
----------------
Is `WillInvertAllUses` ever different from `V->hasOneUse()`?  If not, I think it would be nicer to have this function not take the extra argument and just compute the predicate locally.

http://reviews.llvm.org/D7821

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list