[PATCH] D41373: [GISel][RFC]: GlobalISel Combiner prototype

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 18:05:46 PST 2018

dsanders added inline comments.

Comment at: include/llvm/CodeGen/GlobalISel/MIPatternMatch.h:13-14
Just a little nit: These guards should follow the convention

Comment at: include/llvm/CodeGen/GlobalISel/PreLegalizeCombiner.h:35
+class PreLegalizeCombiner : public MachineFunctionPass {
aditya_nandakumar wrote:
> aditya_nandakumar wrote:
> > aemerson wrote:
> > > aditya_nandakumar wrote:
> > > > qcolombet wrote:
> > > > > The relationship between PreLegalizeCombiner and GICombiner looks strange to me.
> > > > > In particular, before looking at the actual implementation of runOnMachineFunction, there is nothing showing that this pass uses GICombiner.
> > > > > 
> > > > > I would have expected something like GICombiner is a pass and PreLegalizeCombiner inherit from it and only set its custom PreLegalizeCombinerInfo thing.
> > > > I went with the "has a" relationship with the GICombiner. Pretty much what the GICombiner does right now is the driving of the combines which felt like it belonged in a utility. Right now, there should be little/no difference to switch to each pass inheriting the GICombiner and I can do that if required.
> > > I agree with Quentin that it seems having a generic GICombiner to inherit from seems clearer from a design point of view.
> > Thanks. I will update that shortly.
> The one downside I see to making it based on inheritance is that, things like MachineFunction is not available during creation of the CombinerInfo (pass construction). Passes would need to initialize the legalizerInfo during the runOnMachineFunction call instead if we go this route.
You should be able to retrieve it from MI.getParent().getParent().getSubtarget().getLegalizerInfo() or something like that


More information about the llvm-commits mailing list