[PATCH] D41136: [EarlyCSE] recognize commuted and swapped variants of min/max as equivalent (PR35642)

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 12:52:52 PST 2017


hfinkel accepted this revision.
hfinkel added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Transforms/Scalar/EarlyCSE.cpp:151
+  SelectPatternFlavor SPF = matchSelectPattern(Inst, A, B).Flavor;
+  // TODO: We should also detect abs and FP min/max.
+  if (SPF == SPF_SMIN || SPF == SPF_SMAX ||
----------------
Is there anything to do to address this TODO except for removing this check, the corresponding check below, and, to be good, adding a few test cases?

I don't want this artificially restricted, but I'm fine enabling the others in a follow-up commit (so that we can revert separately if necessary). This LGTM, but please do take care of the other cases in a follow-up commit, or add a comment explaining why that's non-trivial.


https://reviews.llvm.org/D41136





More information about the llvm-commits mailing list