llvm-6502/include/llvm/IR
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
..
Argument.h Add a dereferenceable attribute 2014-07-18 15:51:28 +00:00
AssemblyAnnotationWriter.h
Attributes.h Add a dereferenceable attribute 2014-07-18 15:51:28 +00:00
AutoUpgrade.h Rename loop unrolling and loop vectorizer metadata to have a common prefix. 2014-06-25 15:41:00 +00:00
BasicBlock.h
CallingConv.h
CallSite.h Add a dereferenceable attribute 2014-07-18 15:51:28 +00:00
CFG.h Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
CMakeLists.txt
Comdat.h IR: Add COMDATs to the IR 2014-06-27 18:19:56 +00:00
Constant.h InstCombine: Don't turn -(x/INT_MIN) -> x/INT_MIN 2014-07-02 06:07:09 +00:00
ConstantFolder.h Add CreatePointerBitCastOrAddrSpaceCast to IRBuilder and co. 2014-07-14 17:24:35 +00:00
ConstantRange.h
Constants.h
DataLayout.h Fix typo 2014-06-25 23:39:08 +00:00
DebugInfo.h Constify the Function pointers in the result of makeSubprogramMap 2014-07-02 18:30:05 +00:00
DebugLoc.h
DerivedTypes.h
DiagnosticInfo.h Rename DiagnosticInfoOptimizationWarning to DiagnosticInfoOptimizationFailure 2014-07-18 19:36:04 +00:00
DiagnosticPrinter.h
DIBuilder.h Add new debug kind LocTrackingOnly. 2014-06-24 17:02:03 +00:00
Dominators.h Move operator[] to DomTreeNodeBase 2014-07-02 06:50:48 +00:00
Function.h Add a dereferenceable attribute 2014-07-18 15:51:28 +00:00
GetElementPtrTypeIterator.h
GlobalAlias.h IR: Add COMDATs to the IR 2014-06-27 18:19:56 +00:00
GlobalObject.h IR: Add COMDATs to the IR 2014-06-27 18:19:56 +00:00
GlobalValue.h IR: Add a helper to check for LinkOnceODRLinkage 2014-07-01 00:30:52 +00:00
GlobalVariable.h
GVMaterializer.h Make ObjectFile and BitcodeReader always own the MemoryBuffer. 2014-06-23 21:53:12 +00:00
InlineAsm.h
InstIterator.h
InstrTypes.h Add CreatePointerBitCastOrAddrSpaceCast to IRBuilder and co. 2014-07-14 17:24:35 +00:00
Instruction.def
Instruction.h AA metadata refactoring (introduce AAMDNodes) 2014-07-24 12:16:19 +00:00
Instructions.h Add a dereferenceable attribute 2014-07-18 15:51:28 +00:00
InstVisitor.h
IntrinsicInst.h
Intrinsics.h TableGen: introduce support for MSBuiltin 2014-07-04 18:42:25 +00:00
Intrinsics.td CodeGen: extend f16 conversions to permit types > float. 2014-07-17 10:51:23 +00:00
IntrinsicsAArch64.td Port memory barriers intrinsics to AArch64 2014-07-17 10:50:20 +00:00
IntrinsicsARM.td ARM: mark matching ARM intrinsics as MSBuiltin 2014-07-05 20:09:24 +00:00
IntrinsicsHexagon.td
IntrinsicsMips.td
IntrinsicsNVVM.td [NVPTX] Add more surface/texture intrinsics, including CUDA unified texture fetch 2014-07-17 11:59:04 +00:00
IntrinsicsPowerPC.td
IntrinsicsR600.td R600: Fix inconsistency in rsq instructions. 2014-06-24 22:13:39 +00:00
IntrinsicsX86.td AVX-512: Fixed intrinsic of VSQRTPS/PD instructions. 2014-07-22 11:07:31 +00:00
IntrinsicsXCore.td
IRBuilder.h Add scoped-noalias metadata 2014-07-24 14:25:39 +00:00
IRPrintingPasses.h
LeakDetector.h
LegacyPassManager.h
LegacyPassManagers.h
LegacyPassNameParser.h
LLVMContext.h Add scoped-noalias metadata 2014-07-24 14:25:39 +00:00
Mangler.h
MDBuilder.h Add scoped-noalias metadata 2014-07-24 14:25:39 +00:00
Metadata.h Add scoped-noalias metadata 2014-07-24 14:25:39 +00:00
Module.h IR: Add COMDATs to the IR 2014-06-27 18:19:56 +00:00
NoFolder.h
OperandTraits.h
Operator.h
PassManager.h
PatternMatch.h
PredIteratorCache.h
SymbolTableListTraits.h
Type.h
TypeBuilder.h
TypeFinder.h
Use.h
User.h
Value.h IR: Fix comment from r213824 2014-07-24 02:56:59 +00:00
ValueHandle.h
ValueMap.h Revert "Replace Execution Engine's mutex with std::recursive_mutex." 2014-06-20 21:07:14 +00:00
ValueSymbolTable.h
Verifier.h