Hi all, For GlobalISel, we’re exploring options for implementing inlining optimizations for memcpy and friends. However, looking around the existing implementation, I don’t see anything that would particularly be problematic for us to do it at the IR level. The existing TLI hooks to specify how certain memcpy calls should be lowered doesn’t have anything too SelectionDAG specific, and an IR lowering pass could be shared in future between SDAG and GISel. Does anyone see issues with this? Thanks, Amara
On Thu, Jun 20, 2019 at 6:42 AM Amara Emerson via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Hi all, > > For GlobalISel, we’re exploring options for implementing inlining optimizations for memcpy and friends. However, looking around the existing implementation, I don’t see anything that would particularly be problematic for us to do it at the IR level. > > The existing TLI hooks to specify how certain memcpy calls should be lowered doesn’t have anything too SelectionDAG specific, and an IR lowering pass could be shared in future between SDAG and GISel. Does anyone see issues with this?Sounds similar to https://reviews.llvm.org/D60318 It should be done *really* late in the middle-end pipeline though.> Thanks, > AmaraRoman.> _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Looks like there are a lot of opinions where memcpy expansion/inlining needs to happen: (late) IR, or if it is a backend problem, see also for example https://reviews.llvm.org/D35035. Complicating factor here is that efficient memcpy lowering is crucial for performance and code-size (and they occur a lot). Either way, I agree that the TLI hooks are not SelectionDAG specific, they can be used in an IR lowering pass. Cheers, Sjoerd. ________________________________ From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Roman Lebedev via llvm-dev <llvm-dev at lists.llvm.org> Sent: 20 June 2019 08:04 To: Amara Emerson Cc: llvm-dev Subject: Re: [llvm-dev] RFC: Memcpy inlining in IR On Thu, Jun 20, 2019 at 6:42 AM Amara Emerson via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Hi all, > > For GlobalISel, we’re exploring options for implementing inlining optimizations for memcpy and friends. However, looking around the existing implementation, I don’t see anything that would particularly be problematic for us to do it at the IR level. > > The existing TLI hooks to specify how certain memcpy calls should be lowered doesn’t have anything too SelectionDAG specific, and an IR lowering pass could be shared in future between SDAG and GISel. Does anyone see issues with this?Sounds similar to https://reviews.llvm.org/D60318 It should be done *really* late in the middle-end pipeline though.> Thanks, > AmaraRoman.> _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev_______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190620/b3838e92/attachment-0001.html>
> On Jun 19, 2019, at 11:41 PM, Amara Emerson via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi all, > > For GlobalISel, we’re exploring options for implementing inlining optimizations for memcpy and friends. However, looking around the existing implementation, I don’t see anything that would particularly be problematic for us to do it at the IR level. > > The existing TLI hooks to specify how certain memcpy calls should be lowered doesn’t have anything too SelectionDAG specific, and an IR lowering pass could be shared in future between SDAG and GISel. Does anyone see issues with this? > > Thanks, > AmaraWe already have lib/Transforms/Utils/LowerMemIntrinsics.cpp, there just isn’t a general pass that expands these for targets. AMDGPU already always use this for memcpy handling. -Matt
> On Jun 20, 2019, at 3:54 PM, Matt Arsenault <arsenm2 at gmail.com> wrote: > > > >> On Jun 19, 2019, at 11:41 PM, Amara Emerson via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> Hi all, >> >> For GlobalISel, we’re exploring options for implementing inlining optimizations for memcpy and friends. However, looking around the existing implementation, I don’t see anything that would particularly be problematic for us to do it at the IR level. >> >> The existing TLI hooks to specify how certain memcpy calls should be lowered doesn’t have anything too SelectionDAG specific, and an IR lowering pass could be shared in future between SDAG and GISel. Does anyone see issues with this? >> >> Thanks, >> Amara > > We already have lib/Transforms/Utils/LowerMemIntrinsics.cpp, there just isn’t a general pass that expands these for targets. AMDGPU already always use this for memcpy handling. > > > -Matt >Sure, that might end up sharing some code but the key thing is to use the TLI hooks to implement the same optimizations that SelectionDAG currently does. Amara