[llvm-dev] Running GlobaISel passes after SelectionDAG instruction selection

Quentin Colombet via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 8 16:54:42 PST 2016

Hi Tom,

> On Nov 7, 2016, at 9:28 AM, Tom Stellard <tom at stellard.net> wrote:
> Hi,
> I've been experimenting with global isel over the last few weeks and it
> is such a vast improvement over the SelectionDAG for the AMDGPU target
> that I would really like to begin using it as soon as possible.
> Given the lack of a replacement for SelectionDAG's legalizer / combiner,

Could you elaborate on what is missing for the legalizer?
As always, we welcome contribution or PR to help guide the development of the framework.

And yeah, the combiner part is missing :).

> and how much work this will be to implement, I think the fastest path to
> doing this would be to run some of the GlobalISel passes after SelectionDAG
> instruction selection.
> What I would like to do is modify the AMDGPU target to select SelectionDAG
> nodes to generic opcodes, and then run the InstructionSelector pass on
> the resulting MachineFunction.
> I would start by doing this with loads/stores and then move on to other
> opcodes one at a time.
> These changes will be a big improvement to AMDGPU, because it will allow
> us to replace our SIFixSGPRCopies pass which is essentially just another
> instruction selector that re-selects instructions based on their register
> classes and also let us do a much better job of matching addressing modes,
> which is very important for the AMDGPU target.
> I already have a working prototype where I run SelectionDAG ISel and
> then the InstructionSelector pass right afterwards, but I think to
> make this approach work long-term,

When you say long-term what do you have in mind?
Put differently, I would recommend you help improving the framework instead of having this a supported solution. Indeed, the plan is still to kill SDISel :).

Right now, we are not investing a lot of ressources into the investigation of how do we do combines. If you are interested in that aspect, let me know I will share my vision on those.


> we will need to agree that this is a
> supported use case of GlobalISel, and we will also need to start
> building the GlobalISel code by default.
> What do people think about this?
> Thanks,
> Tom

More information about the llvm-dev mailing list