mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
52513fd902
Fix cache invalidation by not guarding the dereferenced pointer cache erasure by SeenBlocks. SeenBlocks is only populated when actually caching a value in the block, which doesn't necessarily have to happen just because dereferenced pointers were calculated. ----- Related to D69686. As noted there, LVI currently behaves differently for integer and pointer values: For integers, the block value is always valid inside the basic block, while for pointers it is only valid at the end of the basic block. I believe the integer behavior is the correct one, and CVP relies on it via its getConstantRange() uses. The reason for the special pointer behavior is that LVI checks whether a pointer is dereferenced in a given basic block and marks it as non-null in that case. Of course, this information is valid only after the dereferencing instruction, or in conservative approximation, at the end of the block. This patch changes the treatment of dereferencability: Instead of including it inside the block value, we instead treat it as something similar to an assume (it essentially is a non-nullness assume) and incorporate this information in intersectAssumeOrGuardBlockValueConstantRange() if the context instruction is the terminator of the basic block. This happens either when determining an edge-value internally in LVI, or when a terminator was explicitly passed to getValueAt(). The latter case makes this change not fully NFC, because we can now fold terminator icmps based on the dereferencability information in the same block. This is the reason why I changed one JumpThreading test (it would optimize the condition away without the change). Of course, we do not want to recompute dereferencability on each intersectAssume call, so we need a new cache for this. The dereferencability analysis requires walking the entire basic block and computing underlying objects of all memory operands. This was previously done separately for each queried pointer value. In the new implementation (both because this makes the caching simpler, and because it is faster), I instead only walk the full BB once and cache all the dereferenced pointers. So the traversal is now performed only once per BB, instead of once per queried pointer value. I think the overall model now makes more sense than before, and there will be no more pitfalls due to differing integer/pointer behavior. Differential Revision: https://reviews.llvm.org/D69914 |
||
---|---|---|
.. | ||
ADCE | ||
AddDiscriminators | ||
AggressiveInstCombine | ||
AlignmentFromAssumptions | ||
ArgumentPromotion | ||
AtomicExpand | ||
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 | ||
LowerSwitch | ||
LowerTypeTests | ||
LowerWidenableCondition | ||
MakeGuardsExplicit | ||
Mem2Reg | ||
MemCpyOpt | ||
MergeFunc | ||
MergeICmps | ||
MetaRenamer | ||
NameAnonGlobals | ||
NaryReassociate | ||
NewGVN | ||
ObjCARC | ||
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 | ||
Util | ||
WholeProgramDevirt |