[PATCH] D45736: [SimplifyLibcalls] Replace locked IO with unlocked IO

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 17 15:31:07 PDT 2018


xbolva00 added a comment.

In https://reviews.llvm.org/D45736#1070330, @lebedev.ri wrote:

> In https://reviews.llvm.org/D45736#1070328, @xbolva00 wrote:
>
> > In https://reviews.llvm.org/D45736#1070249, @lebedev.ri wrote:
> >
> > > > to gain better speed
> > >
> > > Out of curiosity, what are the motivational cases, benchmarks?
> > >
> > > > if we know, that there is no fork or pthread_create calls in the current module.
> > >
> > > I'm not sure this is sufficient.
> > >  I'll be super surprised if this could be done outside of a LTO build with no dynamic linking.
> >
> >
> > Motivation? I tried to "getchar and putchar" 2 MB file and using unlocked variants I got time difference around 0,1 s.
> >
> > I believe there are more reasons to apply such optimizations, if possible. If we can have faster IO code, why not?
> >
> > Why not sufficient?
> >  Can you explain it more?
>
>
>
>
> > Static function can be called only from module and if there is no fork or pthread_create, why we cant say that all static functions are not called from multiple threads/processes?
>
> And what about said static function being [indirectly] called from some non-static function?




In https://reviews.llvm.org/D45736#1070330, @lebedev.ri wrote:

> In https://reviews.llvm.org/D45736#1070328, @xbolva00 wrote:
>
> > In https://reviews.llvm.org/D45736#1070249, @lebedev.ri wrote:
> >
> > > > to gain better speed
> > >
> > > Out of curiosity, what are the motivational cases, benchmarks?
> > >
> > > > if we know, that there is no fork or pthread_create calls in the current module.
> > >
> > > I'm not sure this is sufficient.
> > >  I'll be super surprised if this could be done outside of a LTO build with no dynamic linking.
> >
> >
> > Motivation? I tried to "getchar and putchar" 2 MB file and using unlocked variants I got time difference around 0,1 s.
> >
> > I believe there are more reasons to apply such optimizations, if possible. If we can have faster IO code, why not?
> >
> > Why not sufficient?
> >  Can you explain it more?
>
>
>
>
> > Static function can be called only from module and if there is no fork or pthread_create, why we cant say that all static functions are not called from multiple threads/processes?
>
> And what about said static function being [indirectly] called from some non-static function?


Ah sure. So maybe somehow check if module has only static functions (+main)? Or iterate over non static functions in module and check if our static function is called from them?


Repository:
  rL LLVM

https://reviews.llvm.org/D45736





More information about the llvm-commits mailing list