[llvm-dev] "Replace locked IO with unlocked IO" optimizations

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] "Replace locked IO with unlocked IO" optimizations

Chris Lattner via llvm-dev
Hello,

Please check this patch:

as Eli noted, other opinions are highly welcomed..

Thanks

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] "Replace locked IO with unlocked IO" optimizations

Chris Lattner via llvm-dev
It's probably worth going into a little more detail... a lot of people read llvmdev, and most of them won't click the link or follow the whole discussion.

The transform in question is replacing "fputc(...)" with "fputc_unlocked(...)" when we can prove the FILE* doesn't escape.  The question is whether it's safe for the compiler to emit a call to fputc_unlocked() on Linux, given it's a non-standard extension.  The bit I'm most worried about is some user defining a function named fputc_unlocked; it isn't a reserved name according to the C standard, so there's no way to ensure we're actually calling the glibc fputc_unlocked.

Suggestions welcome.

-Eli

On 5/8/2018 4:59 PM, Dávid Bolvanský via llvm-dev wrote:
Hello,

Please check this patch:

as Eli noted, other opinions are highly welcomed..

Thanks


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] "Replace locked IO with unlocked IO" optimizations

Chris Lattner via llvm-dev


On 05/08/2018 07:13 PM, Friedman, Eli via llvm-dev wrote:
It's probably worth going into a little more detail... a lot of people read llvmdev, and most of them won't click the link or follow the whole discussion.

The transform in question is replacing "fputc(...)" with "fputc_unlocked(...)" when we can prove the FILE* doesn't escape.  The question is whether it's safe for the compiler to emit a call to fputc_unlocked() on Linux, given it's a non-standard extension.  The bit I'm most worried about is some user defining a function named fputc_unlocked; it isn't a reserved name according to the C standard, so there's no way to ensure we're actually calling the glibc fputc_unlocked.

Don't we generally assume the availability of glibc extensions when -gnu is in the triple?

 -Hal


Suggestions welcome.

-Eli

On 5/8/2018 4:59 PM, Dávid Bolvanský via llvm-dev wrote:
Hello,

Please check this patch:

as Eli noted, other opinions are highly welcomed..

Thanks


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] "Replace locked IO with unlocked IO" optimizations

Chris Lattner via llvm-dev
So make them available in TLI under the condition T.isGNUEnvironment() would be quite enough?

Currently the patch contains the condition 
"if (T.isOSLinux() || (T.isAndroid() && !T.isAndroidVersionLT(28))) {"

Android P's bionic has them too. But not sure how the ideal condition would like.

Thanks

2018-05-09 2:23 GMT+02:00 Hal Finkel <[hidden email]>:


On 05/08/2018 07:13 PM, Friedman, Eli via llvm-dev wrote:
It's probably worth going into a little more detail... a lot of people read llvmdev, and most of them won't click the link or follow the whole discussion.

The transform in question is replacing "fputc(...)" with "fputc_unlocked(...)" when we can prove the FILE* doesn't escape.  The question is whether it's safe for the compiler to emit a call to fputc_unlocked() on Linux, given it's a non-standard extension.  The bit I'm most worried about is some user defining a function named fputc_unlocked; it isn't a reserved name according to the C standard, so there's no way to ensure we're actually calling the glibc fputc_unlocked.

Don't we generally assume the availability of glibc extensions when -gnu is in the triple?

 -Hal


Suggestions welcome.

-Eli

On 5/8/2018 4:59 PM, Dávid Bolvanský via llvm-dev wrote:
Hello,

Please check this patch:

as Eli noted, other opinions are highly welcomed..

Thanks


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev