[PATCH] D33585: [InstSimplify] Use commutable matchers to shorten some code

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 26 09:36:47 PDT 2017


spatel added a comment.

Looks like good clean-up, but we only have 2 existing tests for these folds. There should be 4 commuted variants?

It's an independent change, but if we used m_APInt here, the code would be cleaner still and automatically work with splat vectors. You could make the additional commuted tests use vector types to serve double-duty if you want to add coverage for both of those changes.

Side note regarding commutation: just above here, simplifyAndOrOfICmps() calls simplifyPossiblyCastedAndOrOfICmps() with the params swapped to handle commutation, but some of the folds under there (ConstantRange checks at least) don't need to be commuted. Barring an inlining and analysis miracle, we're probably doing extra work for no reason on those, so untangling that would save compile-time.


https://reviews.llvm.org/D33585





More information about the llvm-commits mailing list