1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/test/Transforms
Nikita Popov 52513fd902 Reapply [LVI] Normalize pointer behavior
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
2019-11-08 20:13:55 +01:00
..
ADCE
AddDiscriminators
AggressiveInstCombine [NFC] run specific pass instead of whole -O3 pipeline for popcount recoginzation testcase. 2019-10-11 05:30:18 +00:00
AlignmentFromAssumptions [AlignmentFromAssumptions] getNewAlignmentDiff(): use getURemExpr() 2019-08-23 02:17:04 +00:00
ArgumentPromotion
AtomicExpand AMDGPU: Select global atomicrmw fadd 2019-11-06 16:06:38 -08:00
BDCE
BlockExtractor [BlockExtractor] Avoid assert with wrong line format 2019-08-20 14:46:02 +00:00
BranchFolding
CalledValuePropagation
CallSiteSplitting
CanonicalizeAliases
CodeExtractor
CodeGenPrepare Reapply r374743 with a fix for the ocaml binding 2019-10-14 16:15:14 +00:00
ConstantHoisting
ConstantMerge
ConstProp [ConstantFold] fix inconsistent handling of extractelement with undef index (PR42689) 2019-10-13 17:34:08 +00:00
Coroutines [coroutine] Fixes "cannot move instruction since its users are not dominated by CoroBegin" problem. 2019-08-15 00:48:51 +00:00
CorrelatedValuePropagation [ConstantRange][LVI] Use overflow flags from sub to constrain the range 2019-11-07 16:18:03 +03:00
CrossDSOCFI
DCE [FPEnv] Strict FP tests should use the requisite function attributes. 2019-10-04 17:03:46 +00:00
DeadArgElim
DeadStoreElimination
DivRemPairs [DivRemPairs] Don't assert that we won't ever get expanded-form rem pairs in different BB's (PR43500) 2019-09-29 15:25:24 +00:00
EarlyCSE [IR] Fix mayReadFromMemory() for writeonly calls 2019-10-21 06:52:08 +00:00
EliminateAvailableExternally
EntryExitInstrumenter Reland "[ARM] push LR before __gnu_mcount_nc" 2019-08-16 23:30:16 +00:00
ExpandMemCmp [X86] Make memcmp vector lowering handle arbitrary expansions 2019-10-30 09:12:57 +02:00
Float2Int [Float2Int] avoid crashing on unreachable code (PR38502) 2019-09-19 16:31:17 +00:00
ForcedFunctionAttrs
FunctionAttrs [Attributor][NFCI] Distinguish optional and required dependences 2019-11-02 15:26:22 -05:00
FunctionImport Reland "Change the X86 datalayout to add three address spaces 2019-09-10 23:15:38 +00:00
GCOVProfiling
GlobalDCE Reland: Dead Virtual Function Elimination 2019-10-17 09:58:57 +00:00
GlobalMerge
GlobalOpt [GlobalOpt] prevent crashing on large integer types (PR42932) 2019-08-09 12:43:25 +00:00
GlobalSplit
GuardWidening [WC] Fix a subtle bug in our definition of widenable branch 2019-11-06 14:16:34 -08:00
GVN [GVN] Propagate simple equalities from assumes within the tail of the block 2019-09-03 17:31:19 +00:00
GVNHoist
GVNSink
HardwareLoops Recommit "[HardwareLoops] Optimisation remarks" 2019-11-05 09:06:22 +00:00
HotColdSplit Invalidate assumption cache before outlining. 2019-10-04 22:46:42 +00:00
IndirectBrExpand
IndVarSimplify [LoopPred] Enable new transformation by default 2019-11-06 15:41:57 -08:00
InferAddressSpaces AMDGPU: Add intrinsics for address space identification 2019-09-05 02:20:39 +00:00
InferFunctionAttrs NoFree argument attribute. 2019-11-02 19:40:48 +01:00
Inline Recommit "[CodeView] Add option to disable inline line tables." 2019-11-04 09:15:26 -08:00
InstCombine [InstCombine] Don't transform bitcasts between x86_mmx and v1i64 into insertelement/extractelement 2019-11-07 15:14:13 -08:00
InstMerge [MergedLoadStoreMotion] Sink stores to BB with more than 2 predecessors 2019-09-05 17:00:32 +00:00
InstNamer
InstSimplify [InstSimplify] use FMF to improve fcmp+select fold 2019-11-04 08:29:56 -05:00
InterleavedAccess
Internalize Reland: Dead Virtual Function Elimination 2019-10-17 09:58:57 +00:00
IPConstantProp [AbstractCallSite][FIX] Correct faulty assertion 2019-11-02 01:22:41 -05:00
IRCE [SCEV] Add smin support to getRangeRef 2019-09-12 21:32:27 +00:00
JumpThreading Reapply [LVI] Normalize pointer behavior 2019-11-08 20:13:55 +01:00
LCSSA
LICM [LICM] Support hosting of dynamic allocas out of loops 2019-11-08 08:19:48 -08:00
LoadStoreVectorizer
LoopDataPrefetch
LoopDeletion
LoopDistribute
LoopFusion [LoopFusion] Add ability to fuse guarded loops 2019-09-26 21:42:45 +00:00
LoopIdiom Revert BCmp Loop Idiom recognition transform (PR43870) 2019-11-02 12:48:03 +03:00
LoopInstSimplify [LoopPassManager + MemorySSA] Only enable use of MemorySSA for LPMs known to preserve it. 2019-08-21 17:00:57 +00:00
LoopInterchange [LoopInterchange] Properly move condition, induction increment and ops to latch. 2019-09-11 08:23:23 +00:00
LoopLoadElim
LoopPredication
LoopReroll
LoopRotate [LoopPassManager + MemorySSA] Only enable use of MemorySSA for LPMs known to preserve it. 2019-08-21 17:00:57 +00:00
LoopSimplify
LoopSimplifyCFG
LoopStrengthReduce
LoopTransformWarning
LoopUnroll [LoopPred] Enable new transformation by default 2019-11-06 15:41:57 -08:00
LoopUnrollAndJam
LoopUnswitch
LoopVectorize [LV] Apply sink-after & interleave-groups as VPlan transformations (NFCI) 2019-11-08 15:25:14 +02:00
LoopVersioning
LoopVersioningLICM
LowerAtomic
LowerConstantIntrinsics Reapply r374743 with a fix for the ocaml binding 2019-10-14 16:15:14 +00:00
LowerExpectIntrinsic Reland "clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM" 2019-09-11 16:19:50 +00:00
LowerGuardIntrinsic
LowerInvoke
LowerSwitch
LowerTypeTests LowerTypeTests: Rename local functions to avoid collisions with identically named functions in ThinLTO modules. 2019-10-03 23:42:44 +00:00
LowerWidenableCondition
MakeGuardsExplicit
Mem2Reg
MemCpyOpt [MemCpyOpt] Fixing Incorrect Code Motion while Handling Aggregate Type Values 2019-10-21 10:00:34 +00:00
MergeFunc [IR] Add Freeze instruction 2019-11-05 15:54:56 +09:00
MergeICmps
MetaRenamer
NameAnonGlobals
NaryReassociate
NewGVN [NewGVN] Check that call has an access. 2019-10-15 17:25:36 +00:00
ObjCARC [ObjC][ARC] Ignore lifetime markers between *ReturnValue calls 2019-11-05 06:39:22 -08:00
PartiallyInlineLibCalls
PGOProfile [PGO] Don't group COMDAT variables for compiler generated profile variables in ELF 2019-09-30 18:11:22 +00:00
PhaseOrdering [NFC][PhaseOrdering] Add end-to-end tests for the 'two shifts by sext' problem 2019-09-27 19:32:43 +00:00
PlaceSafepoints
PreISelIntrinsicLowering
PruneEH
Reassociate [Reassoc] Small fix to support unary FNeg in NegateValue(...) 2019-08-23 15:49:38 +00:00
Reg2Mem
RewriteStatepointsForGC
SafeStack
SampleProfile Keep import function list for inlinee profile update 2019-11-06 18:36:00 -08:00
ScalarizeMaskedMemIntrin/X86
Scalarizer [Intrinsic] Add the llvm.umul.fix.sat intrinsic 2019-09-07 12:16:14 +00:00
SCCP
SeparateConstOffsetFromGEP
SimpleLoopUnswitch [MemorySSA] Update for partial unswitch. 2019-10-14 23:52:39 +00:00
SimplifyCFG [WC] Fix a subtle bug in our definition of widenable branch 2019-11-06 14:16:34 -08:00
Sink
SLPVectorizer [SLP] allow forming 2-way reduction patterns 2019-11-07 06:08:42 -05:00
SpeculateAroundPHIs Ignore indirect branches from callbr. 2019-08-14 16:44:07 +00:00
SpeculativeExecution
SROA Revert [SROA] Reuse existing lifetime markers if possible 2019-10-15 04:32:07 +00:00
StraightLineStrengthReduce
StripDeadPrototypes
StripSymbols
StructurizeCFG
SyntheticCountsPropagation
TailCallElim
ThinLTOBitcodeWriter cfi-icall: Allow the jump table to be optionally made non-canonical. 2019-08-09 22:31:59 +00:00
Util Handle successor's PHI node correctly when flattening CFG merges two if-regions 2019-09-26 15:20:17 +00:00
WholeProgramDevirt