[PATCH] D48278: [SelectionDAG] Fold redundant masking operations of shifted value

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 9 07:05:57 PDT 2018


spatel added a comment.

In https://reviews.llvm.org/D48278#1155560, @dnsampaio wrote:

> It reduces the number of computation operations, from 3 to 2, and the number of constants kept int constants for performing the masking, from 2 to 1.
>  I don't see how it increases the latency. If you are going to perform the masking and the shift anyway.


Ah, I see that now. But I'm not convinced this is the right approach. Why are we waiting to optimize this in the backend? This is a universally good optimization, so it should be in IR:
https://rise4fun.com/Alive/O04

I'm not sure exactly where that optimization belongs. Ie, is it EarlyCSE, GVN, somewhere else, or is it its own pass? But I don't see any benefit in waiting to do this in the DAG.


https://reviews.llvm.org/D48278





More information about the llvm-commits mailing list