llvm-6502/include/llvm/Analysis
Hal Finkel 16fd27b2c3 Add scoped-noalias metadata
This commit adds scoped noalias metadata. The primary motivations for this
feature are:
  1. To preserve noalias function attribute information when inlining
  2. To provide the ability to model block-scope C99 restrict pointers

Neither of these two abilities are added here, only the necessary
infrastructure. In fact, there should be no change to existing functionality,
only the addition of new features. The logic that converts noalias function
parameters into this metadata during inlining will come in a follow-up commit.

What is added here is the ability to generally specify noalias memory-access
sets. Regarding the metadata, alias-analysis scopes are defined similar to TBAA
nodes:

!scope0 = metadata !{ metadata !"scope of foo()" }
!scope1 = metadata !{ metadata !"scope 1", metadata !scope0 }
!scope2 = metadata !{ metadata !"scope 2", metadata !scope0 }
!scope3 = metadata !{ metadata !"scope 2.1", metadata !scope2 }
!scope4 = metadata !{ metadata !"scope 2.2", metadata !scope2 }

Loads and stores can be tagged with an alias-analysis scope, and also, with a
noalias tag for a specific scope:

... = load %ptr1, !alias.scope !{ !scope1 }
... = load %ptr2, !alias.scope !{ !scope1, !scope2 }, !noalias !{ !scope1 }

When evaluating an aliasing query, if one of the instructions is associated
with an alias.scope id that is identical to the noalias scope associated with
the other instruction, or is a descendant (in the scope hierarchy) of the
noalias scope associated with the other instruction, then the two memory
accesses are assumed not to alias.

Note that is the first element of the scope metadata is a string, then it can
be combined accross functions and translation units. The string can be replaced
by a self-reference to create globally unqiue scope identifiers.

[Note: This overview is slightly stylized, since the metadata nodes really need
to just be numbers (!0 instead of !scope0), and the scope lists are also global
unnamed metadata.]

Existing noalias metadata in a callee is "cloned" for use by the inlined code.
This is necessary because the aliasing scopes are unique to each call site
(because of possible control dependencies on the aliasing properties). For
example, consider a function: foo(noalias a, noalias b) { *a = *b; } that gets
inlined into bar() { ... if (...) foo(a1, b1); ... if (...) foo(a2, b2); } --
now just because we know that a1 does not alias with b1 at the first call site,
and a2 does not alias with b2 at the second call site, we cannot let inlining
these functons have the metadata imply that a1 does not alias with b2.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213864 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-24 14:25:39 +00:00
..
AliasAnalysis.h AA metadata refactoring (introduce AAMDNodes) 2014-07-24 12:16:19 +00:00
AliasSetTracker.h AA metadata refactoring (introduce AAMDNodes) 2014-07-24 12:16:19 +00:00
BlockFrequencyInfo.h
BlockFrequencyInfoImpl.h BFI: Add constructor for Weight 2014-07-12 00:26:00 +00:00
BranchProbabilityInfo.h
CallGraph.h
CallGraphSCCPass.h
CallPrinter.h
CaptureTracking.h Match semantics of PointerMayBeCapturedBefore to its name by default 2014-07-21 21:30:22 +00:00
CFG.h
CFGPrinter.h Revert "Introduce a string_ostream string builder facilty" 2014-06-26 22:52:05 +00:00
CGSCCPassManager.h [LCG] Normalize the post-order SCC iterator to just iterate over the SCC 2014-04-23 23:51:07 +00:00
CodeMetrics.h
ConstantFolding.h
ConstantsScanner.h
DependenceAnalysis.h remove constant terms 2014-05-27 22:41:45 +00:00
DominanceFrontier.h Try to fix MSVC build 2014-07-12 22:19:49 +00:00
DominanceFrontierImpl.h Try to fix MSVC warning. 2014-07-12 23:16:26 +00:00
DomPrinter.h
DOTGraphTraitsPass.h raw_ostream: Forward declare OpenFlags and include FileSystem.h only where necessary. 2014-04-29 23:26:49 +00:00
FindUsedTypes.h
InlineCost.h
InstructionSimplify.h
Interval.h
IntervalIterator.h
IntervalPartition.h
IVUsers.h
JumpInstrTableInfo.h Add a new attribute called 'jumptable' that creates jump-instruction tables for functions marked with this attribute. 2014-06-05 19:29:43 +00:00
LazyCallGraph.h Fix typos 2014-05-15 01:52:21 +00:00
LazyValueInfo.h
LibCallAliasAnalysis.h
LibCallSemantics.h
Lint.h
Loads.h AA metadata refactoring (introduce AAMDNodes) 2014-07-24 12:16:19 +00:00
LoopInfo.h Add optimization remarks to the loop unroller and vectorizer. 2014-04-29 14:27:31 +00:00
LoopInfoImpl.h
LoopIterator.h
LoopPass.h
MemoryBuiltins.h
MemoryDependenceAnalysis.h AA metadata refactoring (introduce AAMDNodes) 2014-07-24 12:16:19 +00:00
Passes.h Add scoped-noalias metadata 2014-07-24 14:25:39 +00:00
PHITransAddr.h
PostDominators.h
PtrUseVisitor.h
RegionInfo.h This declaration has no definition, which is causing MSVC to emit several "no suitable definition provided for explicit template instantiation request" C4661 warnings. 2014-07-21 13:08:08 +00:00
RegionInfoImpl.h Templatify RegionInfo so it works on MachineBasicBlocks 2014-07-19 18:29:29 +00:00
RegionIterator.h Templatify RegionInfo so it works on MachineBasicBlocks 2014-07-19 18:29:29 +00:00
RegionPass.h
RegionPrinter.h
ScalarEvolution.h Partially fix PR20058: reduce compile time for loop unrolling with very high count by reducing calls to SE->forgetLoop 2014-07-10 23:30:06 +00:00
ScalarEvolutionExpander.h
ScalarEvolutionExpressions.h removed circular definitions in comments 2014-07-14 21:51:59 +00:00
ScalarEvolutionNormalization.h
SparsePropagation.h
TargetFolder.h Add CreatePointerBitCastOrAddrSpaceCast to IRBuilder and co. 2014-07-14 17:24:35 +00:00
TargetTransformInfo.h Add Support to Recognize and Vectorize NON SIMD instructions in SLPVectorizer. 2014-06-20 04:32:48 +00:00
Trace.h
ValueTracking.h [ValueTracking] Extend range metadata to call/invoke 2014-06-19 16:50:16 +00:00