[PATCH] D59391: [X86] Add post-isel pseudos for rotate by immediate using SHLD/SHRD

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 10:41:58 PDT 2019


andreadb added a comment.

In D59391#1432572 <https://reviews.llvm.org/D59391#1432572>, @RKSimon wrote:

> I've been toying with the idea of using a pseudo for all SHLD/SHRD cases so we can make it easier to select between that and the expanded shift pattern depending on scheduler-model/register-pressure etc. instead of trying to make the decision in DAG with the feature bits. I don't know if this could be a first step towards this? @andreadb Any thoughts?




In D59391#1432572 <https://reviews.llvm.org/D59391#1432572>, @RKSimon wrote:

> I've been toying with the idea of using a pseudo for all SHLD/SHRD cases so we can make it easier to select between that and the expanded shift pattern depending on scheduler-model/register-pressure etc. instead of trying to make the decision in DAG with the feature bits. I don't know if this could be a first step towards this? @andreadb Any thoughts?


I agree that this could definitely be a first step towards implementing scheduler-driven peephole optimizations.

That being said, this is easier said than done. Coming up with a good (and generic) framework and a decent cost model for doing this is not simple at all... But it is definitely an interesting project: we could start with a simple prototype pass which is then evolve over time. Just an idea.

To start, it would be nice to have a pass that checks if it is profitable to convert a SHLD/SHRD based on the feedback of a simple cost model which internally takes into account potential increases/decreases in register pressure as well as potential perf gains. Something similar in principle to what we already do in passes like `TwoAddressInstruction`, where heuristics are used to identify cases where it is profitabile to commute/convert instructions (for example: based for example on the number of users of a definition/intervening instructions/etc.).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59391/new/

https://reviews.llvm.org/D59391





More information about the llvm-commits mailing list