Joan Lluch via llvm-dev
2019-Aug-08 17:00 UTC
[llvm-dev] Suboptimal code generated by clang+llc in quite a common scenario (?)
Hi Tim and Alex Thanks for your replies. So just to make it clear for me: does this imply that there’s indeed no way on the current version to tell the compiler or Clang to optimize this? Thanks, Joan> On 8 Aug 2019, at 18:30, Tim Northover via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > On Thu, 8 Aug 2019 at 17:08, Alex Brachet-Mialot via llvm-dev > <llvm-dev at lists.llvm.org> wrote: >> This might not be the workaround you want because it is only available in C, but you can use restrict to allow such optimizations. > > It also doesn't work in Clang unfortunately. We can only represent > restrict on function arguments at the moment. > > Cheers. > > Tim. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Jakub (Kuba) Kuderski via llvm-dev
2019-Aug-08 17:23 UTC
[llvm-dev] Suboptimal code generated by clang+llc in quite a common scenario (?)
You can add __builtin_assume(scscx == pp); if that's your invariant -- this causes the loads to be gone using the clang from trunk. On Thu, Aug 8, 2019 at 1:01 PM Joan Lluch via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi Tim and Alex > > Thanks for your replies. > > So just to make it clear for me: does this imply that there’s indeed no > way on the current version to tell the compiler or Clang to optimize this? > > Thanks, > > Joan > > > > On 8 Aug 2019, at 18:30, Tim Northover via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > > > On Thu, 8 Aug 2019 at 17:08, Alex Brachet-Mialot via llvm-dev > > <llvm-dev at lists.llvm.org> wrote: > >> This might not be the workaround you want because it is only available > in C, but you can use restrict to allow such optimizations. > > > > It also doesn't work in Clang unfortunately. We can only represent > > restrict on function arguments at the moment. > > > > Cheers. > > > > Tim. > > _______________________________________________ > > 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 >-- Jakub Kuderski -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190808/c0a0d60e/attachment.html>
Danila Malyutin via llvm-dev
2019-Aug-08 17:36 UTC
[llvm-dev] Suboptimal code generated by clang+llc in quite a common scenario (?)
Making the pointer const appears to be enough too. -- Danila From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Jakub (Kuba) Kuderski via llvm-dev Sent: Thursday, August 8, 2019 20:23 To: Joan Lluch <joan.lluch at icloud.com> Cc: LLVM Developers Mailing List <llvm-dev at lists.llvm.org> Subject: Re: [llvm-dev] Suboptimal code generated by clang+llc in quite a common scenario (?) You can add __builtin_assume(scscx == pp); if that's your invariant -- this causes the loads to be gone using the clang from trunk. On Thu, Aug 8, 2019 at 1:01 PM Joan Lluch via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: Hi Tim and Alex Thanks for your replies. So just to make it clear for me: does this imply that there’s indeed no way on the current version to tell the compiler or Clang to optimize this? Thanks, Joan> On 8 Aug 2019, at 18:30, Tim Northover via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: > > On Thu, 8 Aug 2019 at 17:08, Alex Brachet-Mialot via llvm-dev > <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: >> This might not be the workaround you want because it is only available in C, but you can use restrict to allow such optimizations. > > It also doesn't work in Clang unfortunately. We can only represent > restrict on function arguments at the moment. > > Cheers. > > Tim. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwMFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=YgdxWMcdqQPlU9EdetI-xI79G7ouw9_Us0dFsZnFQYU&m=wwHq5oHa8SkVrpiVZOhRVJztKIpoy6lA4dVIgZ70jws&s=tLIcNvILK8UgA7qYfPU1FDvZiiahtkYhkDi6ZRcgDb0&e=>_______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwMFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=YgdxWMcdqQPlU9EdetI-xI79G7ouw9_Us0dFsZnFQYU&m=wwHq5oHa8SkVrpiVZOhRVJztKIpoy6lA4dVIgZ70jws&s=tLIcNvILK8UgA7qYfPU1FDvZiiahtkYhkDi6ZRcgDb0&e=> -- Jakub Kuderski -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190808/41dfd9ff/attachment.html>