[PATCH] D44626: [InstCombine] Fold (A OR B) AND B code sequence over Phi node

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 28 07:20:42 PDT 2018


spatel added a subscriber: fhahn.
spatel added a comment.

In https://reviews.llvm.org/D44626#1080274, @efriedma wrote:

> I'm still not sure this is really as general as it could be, but I guess it's okay.


I think what this patch really wants to ask/do is: "Does this binop simplify with the incoming value of the phi to 1 of the binop operands? If yes, substitute that value into the phi."

If you look at it that way, then it should be some add-on to the existing foldOpIntoPhi() - and that's probably a smaller and more general patch.

That substitution analysis seems to fall into the gray area -- or not gray depending on your viewpoint :) -- of whether this belongs in (New)GVN or instcombine. (cc @fhahn).


https://reviews.llvm.org/D44626





More information about the llvm-commits mailing list