Add an isStrict flag to SIL pointer_to_address. (#3529)

Strict aliasing only applies to memory operations that use strict
addresses. The optimizer needs to be aware of this flag. Uses of raw
addresses should not have their address substituted with a strict
address.

Also add Builtin.LoadRaw which will be used by raw pointer loads.
This commit is contained in:
Andrew Trick
2016-07-15 15:04:02 -05:00
committed by GitHub
parent 5564f94867
commit c47687da2c
55 changed files with 366 additions and 207 deletions

View File

@@ -92,7 +92,7 @@ static SILValue getArrayStructPointer(ArrayCallKind K, SILValue Array) {
/// %40 = function_ref @getElementAddress
/// %42 = apply %40(%28, %37)
/// %43 = struct_extract %42
/// %44 = pointer_to_address %43
/// %44 = pointer_to_address strict %43
/// store %1 to %44 : $*Int
static bool isArrayEltStore(StoreInst *SI) {
// Strip the MarkDependenceInst (new array implementation) where the above
@@ -106,7 +106,7 @@ static bool isArrayEltStore(StoreInst *SI) {
// %46 = unchecked_ref_cast %45 : $... to $_ContiguousArrayStorageBase
// %47 = unchecked_ref_cast %46 : $... to $Builtin.NativeObject
// %48 = struct_extract %41 : $..., #UnsafeMutablePointer._rawValue
// %49 = pointer_to_address %48 : $Builtin.RawPointer to $*Int
// %49 = pointer_to_address %48 : $Builtin.RawPointer to strict $*Int
// %50 = mark_dependence %49 : $*Int on %47 : $Builtin.NativeObject
// store %1 to %50 : $*Int
SILValue Dest = SI->getDest();