[PATCH] D30537: [DAGCombiner] allow transforming (select Cond, C +/- 1, C) to (add(ext Cond), C)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 17:06:41 PST 2017


spatel added a comment.

In https://reviews.llvm.org/D30537#691206, @efriedma wrote:

> Okay.  Given that, why do we want to do this?  Does it allow some useful refactoring of other code?


I haven't looked much at anything besides x86, but yes, at least for that target, we can eliminate custom code and plug the holes that are visible in this patch and probably others. My main motivation is that by putting this fold into the common DAGCombiner code any target will be able to pick it up easily. And that will help ease the restoration for the InstCombine that we currently only have half of:
https://reviews.llvm.org/rL75531
https://reviews.llvm.org/rL159230
...so the ultimate goal is to standardize the patterns in IR (we'll always canonicalize to select when possible) and then have a standard way to transform selects to math/logic here in codegen.


https://reviews.llvm.org/D30537





More information about the llvm-commits mailing list