1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
llvm-mirror/test/Transforms
Chandler Carruth 5fe29694c7 [SROA] Fix PR32902 by more carefully propagating !nonnull metadata.
This is based heavily on the work done ni D34285. I mostly wanted to do
test cleanup for the author to save them some time, but I had a really
hard time understanding why it was so hard to write better test cases
for these issues.

The problem is that because SROA does a second rewrite of the loads and
because we *don't* propagate !nonnull for non-pointer loads, we first
introduced invalid !nonnull metadata and then stripped it back off just
in time to avoid most ways of this PR manifesting. Moving to the more
careful utility only fixes this by changing the predicate to look at the
new load's type rather than the target type. However, that *does* fix
the bug, and the utility is much nicer including adding range metadata
to model the nonnull property after a conversion to an integer.

However, we have bigger problems because we don't actually propagate
*range* metadata, and the utility to do this extracted from instcombine
isn't really in good shape to do this currently. It *only* handles the
case of copying range metadata from an integer load to a pointer load.
It doesn't even handle the trivial cases of propagating from one integer
load to another when they are the same width! This utility will need to
be beefed up prior to using in this location to get the metadata to
fully survive.

And even then, we need to go and teach things to turn the range metadata
into an assume the way we do with nonnull so that when we *promote* an
integer we don't lose the information.

All of this will require a new test case that looks kind-of like
`preserve-nonnull.ll` does here but focuses on range metadata. It will
also likely require more testing because it needs to correctly handle
changes to the integer width, especially as SROA actively tries to
change the integer width!

Last but not least, I'm a little worried about hooking the range
metadata up here because the instcombine logic for converting from
a range metadata *to* a nonnull metadata node seems broken in the face
of non-zero address spaces where null is not mapped to the integer `0`.
So that probably needs to get fixed with test cases both in SROA and in
instcombine to cover it.

But this *does* extract the core PR fix from D34285 of preventing the
!nonnull metadata from being propagated in a broken state just long
enough to feed into promotion and crash value tracking.

On D34285 there is some discussion of zero-extend handling because it
isn't necessary. First, the new load size covers all of the non-undef
(ie, possibly initialized) bits. This may even extend past the original
alloca if loading those bits could produce valid data. The only way its
valid for us to zero-extend an integer load in SROA is if the original
code had a zero extend or those bits were undef. And we get to assume
things like undef *never* satifies nonnull, so non undef bits can
participate here. No need to special case the zero-extend handling, it
just falls out correctly.

The original credit goes to Ariel Ben-Yehuda! I'm mostly landing this to
save a few rounds of trivial edits fixing style issues and test case
formulation.

Differental Revision: D34285

llvm-svn: 306379
2017-06-27 08:32:03 +00:00
..
ADCE
AddDiscriminators [AddDiscriminators] Assign discriminators to MemIntrinsic calls. 2017-04-11 19:07:30 +00:00
AlignmentFromAssumptions
ArgumentPromotion [ArgPromotion] Add a testcase for PR32917 2017-05-05 08:40:24 +00:00
AtomicExpand Add address space mangling to lifetime intrinsics 2017-04-10 20:18:21 +00:00
BBVectorize Replace hardcoded intrinsic list with speculatable attribute. 2017-05-03 02:26:10 +00:00
BDCE [Analysis] Support bitreverse in -demanded-bits pass 2017-04-13 16:44:25 +00:00
BranchFolding
CodeExtractor [PartialInlining] Support shrinkwrap life_range markers 2017-06-11 20:46:05 +00:00
CodeGenPrepare [x86] set the datalayout to match the RUN line triple; NFC 2017-06-21 17:06:24 +00:00
ConstantHoisting [ConstHoisting] Add BFI in constanthoisting pass and select the best insertion 2017-04-21 15:50:16 +00:00
ConstantMerge
ConstProp [X86] Replace 'REQUIRES: x86' in tests with 'REQUIRES: x86-registered-target' which seems to be the correct way to make them run on an x86 build. 2017-06-04 08:21:58 +00:00
Coroutines [coroutines] PR33271: Remove stray coro.save intrinsics during CoroSplit 2017-06-02 02:18:36 +00:00
CorrelatedValuePropagation [LVI] Teach LVI to reason about ORs of icmps similar to how it reasons about ANDs of icmps 2017-06-23 01:08:16 +00:00
CountingFunctionInserter
CrossDSOCFI [cfi] CFI-ICall for ThinLTO. 2017-06-16 00:18:29 +00:00
DCE [InstSimplify] Don't constant fold or DCE calls that are marked nobuiltin 2017-06-09 23:18:11 +00:00
DeadArgElim Replace hardcoded intrinsic list with speculatable attribute. 2017-05-03 02:26:10 +00:00
DeadStoreElimination Add address space mangling to lifetime intrinsics 2017-04-10 20:18:21 +00:00
EarlyCSE [EarlyCSE] Make PhiToCheck in removeMSSA() a set. 2017-06-14 19:29:53 +00:00
EliminateAvailableExternally
Float2Int
ForcedFunctionAttrs
FunctionAttrs Support arbitrary address space pointers in masked gather/scatter intrinsics. 2017-05-03 12:28:54 +00:00
FunctionImport Revert r295861, "[ModuleSummaryAnalysis] Don't crash when referencing unnamed globals." 2017-05-03 00:18:48 +00:00
GCOVProfiling
GlobalDCE [PM] Teach the PGO instrumentation pasess to run GlobalDCE before 2017-05-25 07:15:09 +00:00
GlobalMerge Align definition of DW_OP_plus with DWARF spec [3/3] 2017-06-14 13:14:38 +00:00
GlobalOpt [GlobalOpt] Correctly update metadata when localizing a global. 2017-04-27 18:39:08 +00:00
GlobalSplit
GuardWidening
GVN [GVN] Recommit the patch "Add phi-translate support in scalarpre". 2017-06-26 18:16:10 +00:00
GVNHoist Disable GVN Hoist due to still more bugs being found in it. There is 2017-04-27 00:28:03 +00:00
GVNSink Changed a comparison operator for std::stable_sort to implement strict weak ordering. 2017-06-08 17:27:40 +00:00
IndVarSimplify [SCEV] Make MulOpsInlineThreshold lower to avoid excessive compilation time 2017-06-21 07:28:13 +00:00
InferAddressSpaces InferAddressSpaces: Avoid assertion failure with replacing identical 2017-06-08 13:20:55 +00:00
InferFunctionAttrs Add argmononly attribute to strlen and wcslen, i.e. they only read memory (string) passed to them. 2017-06-18 03:10:26 +00:00
Inline [InlineCost] Do not take INT_MAX when Cost is negative 2017-06-23 16:12:37 +00:00
InstCombine [InstCombine] Add test cases demonstrating that we don't optmize select+cmp+cttz/ctlz when the bitwidth is larger than 64 bits. 2017-06-27 04:50:47 +00:00
InstMerge
InstNamer Add basic test case for -instnamer 2017-05-08 23:18:46 +00:00
InstSimplify [InstSimplify] Constant fold the new GEP in SimplifyGEPInst. 2017-06-06 10:17:14 +00:00
InterleavedAccess Fix the bug when handling shufflevector for aarch64. 2017-06-26 21:33:51 +00:00
Internalize
IPConstantProp
IRCE [IRCE] Canonicalize pre/post loops after the blocks are added into parent loop 2017-06-06 14:54:01 +00:00
JumpThreading [JumpThreading] Safely replace uses of condition 2017-05-23 13:36:25 +00:00
LCSSA
LICM Add argmononly attribute to strlen and wcslen, i.e. they only read memory (string) passed to them. 2017-06-18 03:10:26 +00:00
LoadStoreVectorizer Skip bitcasts while looking for GEP in LoadStoreVectorizer 2017-04-25 18:00:08 +00:00
LoopDataPrefetch
LoopDeletion [LoopDeletion] Update exits correctly when multiple duplicate edges from an exiting block 2017-06-22 20:20:56 +00:00
LoopDistribute
LoopIdiom [Atomics] Rename and change prototype for atomic memcpy intrinsic 2017-06-16 14:43:59 +00:00
LoopInterchange
LoopLoadElim
LoopPredication
LoopReroll
LoopRotate Restrict the definition of loop preheader to avoid EH blocks 2017-06-22 23:27:16 +00:00
LoopSimplify [LoopSimplify] Re-instate r306081 with a bug fix w.r.t. indirectbr. 2017-06-25 22:45:31 +00:00
LoopSimplifyCFG
LoopStrengthReduce Revert r304824 "Fix PR23384 (part 3 of 3)" 2017-06-19 17:57:15 +00:00
LoopUnroll [LoopUnroll] Fix a test. REQUIRE should be REQUIRES. 2017-05-12 15:30:58 +00:00
LoopUnswitch [LoopSimplify] Re-instate r306081 with a bug fix w.r.t. indirectbr. 2017-06-25 22:45:31 +00:00
LoopVectorize revert r306336 for breaking ppc test. 2017-06-26 23:05:35 +00:00
LoopVersioning
LoopVersioningLICM
LowerAtomic
LowerExpectIntrinsic Fix builin_expect lowering bug 2017-06-07 18:32:24 +00:00
LowerGuardIntrinsic
LowerInvoke
LowerSwitch LowerSwitch: Fix producing invalid IR on unreachable code 2017-04-21 23:54:12 +00:00
LowerTypeTests Change YAML traits for vector<string> to flow_vector. 2017-06-16 20:50:41 +00:00
Mem2Reg Add test coverage for mem2reg dbg.declare lowering. 2017-04-21 22:13:55 +00:00
MemCpyOpt Add address space mangling to lifetime intrinsics 2017-04-10 20:18:21 +00:00
MergeFunc
MetaRenamer
NameAnonGlobals
NaryReassociate
NewGVN NewGVN: Fix PR 33461, caused by slightly overzealous verification. 2017-06-19 00:24:00 +00:00
ObjCARC Replace hardcoded intrinsic list with speculatable attribute. 2017-05-03 02:26:10 +00:00
PartiallyInlineLibCalls
PGOProfile [PGO] Implementate profile counter regiser promotion 2017-06-25 00:26:43 +00:00
PhaseOrdering Make globalaa-retained.ll test catching more cases. 2017-04-18 13:29:26 +00:00
PlaceSafepoints
PreISelIntrinsicLowering
PruneEH
Reassociate [Reassociate] Make sure EraseInst sets MadeChange 2017-06-27 05:32:13 +00:00
Reg2Mem
RewriteStatepointsForGC [RS4GC] Drop invalid metadata after pointers are relocated 2017-06-12 21:26:53 +00:00
SafeStack Align definition of DW_OP_plus with DWARF spec [3/3] 2017-06-14 13:14:38 +00:00
SampleProfile Do not inline recursive direct calls in sample loader pass. 2017-06-21 17:57:43 +00:00
Scalarizer
SCCP [SCCP] Resolve indirect branch target when possible. 2017-04-10 00:33:25 +00:00
SeparateConstOffsetFromGEP
SimpleLoopUnswitch [PM/Unswitch] Fix a bug in the domtree update logic for the new unswitch 2017-05-25 06:33:36 +00:00
SimplifyCFG [ValueTracking] Teach isSafeToSpeculativelyExecute() about the speculatable attribute 2017-04-28 21:13:09 +00:00
Sink [Sink] Fix predicate in legality check 2017-06-09 19:31:10 +00:00
SLPVectorizer AMDGPU: Allow vectorization of packed types 2017-06-20 20:38:06 +00:00
SpeculativeExecution Revert r301950: SpeculativeExecution: Stop using whitelist for costs 2017-05-10 12:30:07 +00:00
SROA [SROA] Fix PR32902 by more carefully propagating !nonnull metadata. 2017-06-27 08:32:03 +00:00
StraightLineStrengthReduce
StripDeadPrototypes
StripSymbols [StripDeadDebug/DIFinder] Track inlined SPs 2017-04-11 13:32:11 +00:00
StructurizeCFG Revert "StructurizeCFG: Directly invert cmp instructions" 2017-04-24 20:25:01 +00:00
TailCallElim [TRE] Improve code motion in TRE, use AA to tell whether a load can be moved before a call that writes to memory. 2017-06-19 15:21:18 +00:00
ThinLTOBitcodeWriter Write summaries for merged modules when splitting modules for ThinLTO. 2017-06-08 23:01:49 +00:00
Util PredicateInfo: Don't insert conditional info when a conditional branch jumps to the same target regardless of condition 2017-06-14 21:19:52 +00:00
WholeProgramDevirt Skip CFI for dead functions. 2017-06-02 18:24:23 +00:00