[PATCH] D37195: [InstCombine] Teach canEvaluateTruncated and EvaluateInDifferentType to handle expression tree with multi-used nodes.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 08:00:23 PDT 2017


spatel added a comment.

In https://reviews.llvm.org/D37195#860696, @aaboud wrote:

> So, how do you wish to proceed from here?
>  Do you think that such optimization should be moved to separate new pass? Though it will be doing very similar thing as InstCombine, just will catch more cases that it does today?
>
> Please, share with me your opinion on this optimization.


Not sure if the question is for me, but since I raised the doubt...yes, a separate pass that just does evaluation in a narrower type (a subset of demanded bits analysis?) seems like a reasonable thing to implement. Another option is to extend BDCE since that's also using demanded bits. Either way, that would let us lift this task out of instcombine where it is likely costing more than is necessary because instcombine runs so many times. Note that I raised a similar vector possibility for myself in https://reviews.llvm.org/D37236 (vector demanded elements).

That patch does suggest another option. As you've noted, we already do demanded bits analysis (and it even has some allowance for multiple uses) in instcombine, so why doesn't that work? The big fix is to extract that whole thing out of instcombine as its own pass so we can better control it, but (yet another) quick fix is to adjust demanded bits to catch these cases?

As I said, I don't have enough experience to say what's best. Post to llvm-dev to get more opinions?


https://reviews.llvm.org/D37195





More information about the llvm-commits mailing list