mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
a99d809eec
This essentially reverts some of the SimplifyLibcalls part changes of D45736 [SimplifyLibcalls] Replace locked IO with unlocked IO. C11 7.21.5.2 The fflush function > If stream is a null pointer, the fflush function performs this flushing action on all streams for which the behavior is defined above. i.e. fopen'ed FILE* is inherently captured. POSIX.1-2017 getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked - stdio with explicit client locking > These functions can safely be used in a multi-threaded program if and only if they are called while the invoking thread owns the ( FILE *) object, as is the case after a successful call to the flockfile() or ftrylockfile() functions. After a thread fopen'ed a FILE*, when it is calling foobar() which is now replaced by foobar_unlocked(), if another thread is concurrently calling fflush(0), the behavior is undefined. C11 7.22.4.4 The exit function > Next, all open streams with unwritten buffered data are flushed, all open streams are closed, and all files created by the tmpfile function are removed. The replacement is only feasible if the program is single threaded, or exit or fflush(0) is never called. See also http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180528/556615.html for how the replacement makes libc interceptors difficult to implement. dalias: in a worst case, it's unbounded data corruption because of concurrent access to pointers without synchronization. f->wpos or rpos could get outside of the buffer, thread A could do f->wpos += j after knowing j is in bounds, while thread B also changes it concurrently. This can produce exploitable conditions depending on libc internals. Revert the SimplifyLibcalls part change because the cons obviously overweigh the pros. Even when the replacement is feasible, the benefit is indemonstrable, more so in an application instead of an artificial glibc benchmark. Theoretically the replacement could be beneficial when calling getc_unlocked/putc_unlocked in a loop, but then it is better using a blocked IO operation and the user is likely aware of that. The function attribute inference is still useful and thus kept. Reviewed By: xbolva00 Differential Revision: https://reviews.llvm.org/D75933 |
||
---|---|---|
.. | ||
ADCE | ||
AddDiscriminators | ||
AggressiveInstCombine | ||
AlignmentFromAssumptions | ||
ArgumentPromotion | ||
AtomicExpand | ||
Attributor | ||
BDCE | ||
BlockExtractor | ||
BranchFolding | ||
CalledValuePropagation | ||
CallSiteSplitting | ||
CanonicalizeAliases | ||
CodeExtractor | ||
CodeGenPrepare | ||
ConstantHoisting | ||
ConstantMerge | ||
ConstProp | ||
Coroutines | ||
CorrelatedValuePropagation | ||
CrossDSOCFI | ||
DCE | ||
DeadArgElim | ||
DeadStoreElimination | ||
DivRemPairs | ||
EarlyCSE | ||
EliminateAvailableExternally | ||
EntryExitInstrumenter | ||
ExpandMemCmp | ||
Float2Int | ||
ForcedFunctionAttrs | ||
FunctionAttrs | ||
FunctionImport | ||
GCOVProfiling | ||
GlobalDCE | ||
GlobalMerge | ||
GlobalOpt | ||
GlobalSplit | ||
GuardWidening | ||
GVN | ||
GVNHoist | ||
GVNSink | ||
HardwareLoops | ||
HotColdSplit | ||
IndirectBrExpand | ||
IndVarSimplify | ||
InferAddressSpaces | ||
InferFunctionAttrs | ||
Inline | ||
InstCombine | ||
InstMerge | ||
InstNamer | ||
InstSimplify | ||
InterleavedAccess | ||
Internalize | ||
IPConstantProp | ||
IRCE | ||
JumpThreading | ||
LCSSA | ||
LICM | ||
LoadStoreVectorizer | ||
LoopDataPrefetch | ||
LoopDeletion | ||
LoopDistribute | ||
LoopFusion | ||
LoopIdiom | ||
LoopInstSimplify | ||
LoopInterchange | ||
LoopLoadElim | ||
LoopPredication | ||
LoopReroll | ||
LoopRotate | ||
LoopSimplify | ||
LoopSimplifyCFG | ||
LoopStrengthReduce | ||
LoopTransformWarning | ||
LoopUnroll | ||
LoopUnrollAndJam | ||
LoopUnswitch | ||
LoopVectorize | ||
LoopVersioning | ||
LoopVersioningLICM | ||
LowerAtomic | ||
LowerConstantIntrinsics | ||
LowerExpectIntrinsic | ||
LowerGuardIntrinsic | ||
LowerInvoke | ||
LowerMatrixIntrinsics | ||
LowerSwitch | ||
LowerTypeTests | ||
LowerWidenableCondition | ||
MakeGuardsExplicit | ||
Mem2Reg | ||
MemCpyOpt | ||
MergeFunc | ||
MergeICmps | ||
MetaRenamer | ||
NameAnonGlobals | ||
NaryReassociate | ||
NewGVN | ||
ObjCARC | ||
OpenMP | ||
PartiallyInlineLibCalls | ||
PGOProfile | ||
PhaseOrdering | ||
PlaceSafepoints | ||
PreISelIntrinsicLowering | ||
PruneEH | ||
Reassociate | ||
Reg2Mem | ||
RewriteStatepointsForGC | ||
SafeStack | ||
SampleProfile | ||
ScalarizeMaskedMemIntrin/X86 | ||
Scalarizer | ||
SCCP | ||
SeparateConstOffsetFromGEP | ||
SimpleLoopUnswitch | ||
SimplifyCFG | ||
Sink | ||
SLPVectorizer | ||
SpeculateAroundPHIs | ||
SpeculativeExecution | ||
SROA | ||
StraightLineStrengthReduce | ||
StripDeadPrototypes | ||
StripSymbols | ||
StructurizeCFG | ||
SyntheticCountsPropagation | ||
TailCallElim | ||
ThinLTOBitcodeWriter | ||
TypePromotion/ARM | ||
Util | ||
VectorCombine/X86 | ||
WholeProgramDevirt |