[llvm] 623cf3d - Mark getc_unlocked as unavailable by default
Ryan Prichard via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 5 16:36:08 PDT 2021
Author: Ryan Prichard
Date: 2021-08-05T16:35:02-07:00
New Revision: 623cf3dfdf3e202b99e4d0529c37eb7ef2474860
URL: https://github.com/llvm/llvm-project/commit/623cf3dfdf3e202b99e4d0529c37eb7ef2474860
DIFF: https://github.com/llvm/llvm-project/commit/623cf3dfdf3e202b99e4d0529c37eb7ef2474860.diff
LOG: Mark getc_unlocked as unavailable by default
Before D45736, getc_unlocked was available by default, but turned off
for non-Cygwin/non-MinGW Windows. D45736 then added 9 more unlocked
functions, which were unavailable by default, but it also:
* left getc_unlocked enabled by default,
* removed the disabling line for Windows, and
* added code to enable getc_unlocked for GNU, Android, and OSX.
For consistency, make getc_unlocked unavailable by default. Maybe this
was the intent of D45736 anyway.
Reviewed By: MaskRay, efriedma
Differential Revision: https://reviews.llvm.org/D107527
Added:
Modified:
llvm/lib/Analysis/TargetLibraryInfo.cpp
llvm/test/Transforms/InferFunctionAttrs/annotate.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index 8eb1a4929269d..cfd9aff505620 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -123,6 +123,7 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
// Set IO unlocked variants as unavailable
// Set them as available per system below
+ TLI.setUnavailable(LibFunc_getc_unlocked);
TLI.setUnavailable(LibFunc_getchar_unlocked);
TLI.setUnavailable(LibFunc_putc_unlocked);
TLI.setUnavailable(LibFunc_putchar_unlocked);
diff --git a/llvm/test/Transforms/InferFunctionAttrs/annotate.ll b/llvm/test/Transforms/InferFunctionAttrs/annotate.ll
index 31656e2bb2942..80fb3ecf1bd6b 100644
--- a/llvm/test/Transforms/InferFunctionAttrs/annotate.ll
+++ b/llvm/test/Transforms/InferFunctionAttrs/annotate.ll
@@ -509,7 +509,9 @@ declare i64 @fwrite(i8*, i64, i64, %opaque*)
; CHECK: declare noundef i32 @getc(%opaque* nocapture noundef) [[NOFREE_NOUNWIND]]
declare i32 @getc(%opaque*)
-; CHECK: declare noundef i32 @getc_unlocked(%opaque* nocapture noundef) [[NOFREE_NOUNWIND]]
+; CHECK-KNOWN: declare noundef i32 @getc_unlocked(%opaque* nocapture noundef) [[NOFREE_NOUNWIND]]
+; CHECK-UNKNOWN: declare i32 @getc_unlocked(%opaque*)
+; CHECK-UNKNOWN-NOT: #{{.*}}
declare i32 @getc_unlocked(%opaque*)
; CHECK: declare noundef i32 @getchar() [[NOFREE_NOUNWIND]]
More information about the llvm-commits
mailing list