[PATCH] D66607: [InstCombine] matchThreeWayIntCompare(): commutativity awareness

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 05:06:48 PDT 2019


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:2575-2576
+      // x sgt C-1  <-->  x sge C  <-->  not(x slt C)
+      auto FlippedStrictness =
+          getFlippedStrictnessPredicateAndConstant(PredB, cast<Constant>(RHS2));
+      if (!FlippedStrictness)
----------------
I had not seen this API before. The header comment doesn't make sense:
  For predicate of kind "is X or equal to 0"...

(what does zero constant have to do with this?)

...and I don't like the name either, but that's independent of this patch. :)


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:2588-2590
+  if (MatchPat0())
     return true;
   return false;
----------------
Simplify?
  return MatchPat0();
But then, do we need the lambda at all?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66607/new/

https://reviews.llvm.org/D66607





More information about the llvm-commits mailing list