[PATCH] D19087: [x86, ppc] prefer comparisons against zero for and+cmp sequences

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 14 07:44:27 PDT 2016


hfinkel added a comment.

In http://reviews.llvm.org/D19087#401119, @spatel wrote:

> In http://reviews.llvm.org/D19087#400599, @hfinkel wrote:
>
> > This certainly a good pattern to catch, but I'm not sure that CGP is the right place for this. We generally have things in CGP to work-around the fact that SDAG/ISel is basic-block local. This kind of thing seems much more natural as a something that should be in DAGCombine.
>
>
> Yes, I initially thought I'd do this as a DAGCombine, but then I realized that we'd need "isKnownToBeAPowerOfTwo()", and I don't see an SDNode equivalent for the IR version. I'm not sure where we draw the line between CGP and DAGCombine, but duplicating isKnownToBeAPowerOfTwo() scared me away.


Why? How do we select the instructions anyway? For x86 or ppc, would we not want to limit the applicability to constants? It needs to be a constant for rlwinm I'd imagine, and bt too?. For constants, we can check this with existing functionality.


http://reviews.llvm.org/D19087





More information about the llvm-commits mailing list