[llvm-dev] Codegen pass configs dependent on function attributes?

Amara Emerson via llvm-dev llvm-dev at lists.llvm.org
Tue May 12 18:42:32 PDT 2020


Yes, per TU selection sounds like a reasonable compromise. I’ll look into that.

Cheers,
Amara

> On May 12, 2020, at 6:21 PM, Chen, Yuanfang <Yuanfang.Chen at sony.com> wrote:
> 
> This looks like per-function codegen pipeline. If there are existing cases of doing this, we could refer to these to implement it in an intuitive way. Overall, I think it is a bit overreaching and brings more downsides than benefits. If we do this per-TU during linking stage, could we read Module metadata and pass the flag to TargetPassConfig through TargetMachine::Options?
> 
> ________________________________________
> From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Amara Emerson via llvm-dev <llvm-dev at lists.llvm.org>
> Sent: Tuesday, May 12, 2020 12:17 AM
> To: Quentin Colombet
> Cc: LLVM Developers' List; Matt Arsenault
> Subject: Re: [llvm-dev] Codegen pass configs dependent on function      attributes?
> 
> I’ve put up a patch here: https://reviews.llvm.org/D79769 that adds a unified pipeline that targets can opt-into. It has some similarities with forcing fallbacks, but uses a different mechanism to do so to preserve the abort behavior. It therefore requires that every GISel pass needs to explicitly check whether the GISel selector is being requested rather than just using the FailedISel property.
> 
> Cheers,
> Amara
> 
> On May 5, 2020, at 6:56 PM, Quentin Colombet <qcolombet at apple.com<mailto:qcolombet at apple.com>> wrote:
> 
> Hi Amara,
> 
> I’ve done that internally for testing purposes and basically the existing GISel pipeline with fallbacks just did what I wanted.
> In other words, I always used the GISel pipeline but I added an attribute that triggered a fallback to SDISel for the functions I wanted to compile with SDISel. I had to disable the global-isel-abort thing though. That said, that should be easily fixable.
> 
> For the record, I was doing the attribute check in lowerFormalArgument IIRC. I.e., something that is called for every single function at the beginning of the GISel pipeline.
> 
> Cheers,
> -Quentin
> 
> On May 5, 2020, at 2:48 PM, Amara Emerson <aemerson at apple.com<mailto:aemerson at apple.com>> wrote:
> 
> Hi all.
> 
> I’m trying to get GlobalISel to work better with LTO. At the moment if you enable it via -fglobal-isel, it only adds the -mllvm -global-isel and related options to the cc1 invocation. With LTO, that doesn’t work as we need to encode codegen options into the bitcode, usually via function attributes.
> 
> Does anyone have any ideas on how to achieve this? The only way I can see it working is if we have a unified codegen pipeline for both GISel and SelectionDAG. Then use a function attribute to tell the GISel passes to skip and leave it to FastISel/SelectionDAG which runs afterwards. Likewise, FastISel/SelectionDAG would need to skip the function if it was marked for GISel compilation and we didn’t trigger a fallback.
> 
> Amara
> 
> 



More information about the llvm-dev mailing list