mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -708,7 +708,8 @@ MaterializeForSetEmitter::emitUsingGetterSetter(SILGenFunction &gen,
|
||||
// Set up the result buffer.
|
||||
resultBuffer =
|
||||
gen.B.createPointerToAddress(loc, resultBuffer,
|
||||
RequirementStorageType.getAddressType());
|
||||
RequirementStorageType.getAddressType(),
|
||||
/*isStrict*/ true);
|
||||
TemporaryInitialization init(resultBuffer, CleanupHandle::invalid());
|
||||
|
||||
// Evaluate the getter into the result buffer.
|
||||
@@ -783,8 +784,8 @@ MaterializeForSetEmitter::createSetterCallback(SILFunction &F,
|
||||
|
||||
// The callback gets the value at +1.
|
||||
auto &valueTL = gen.getTypeLowering(lvalue.getTypeOfRValue());
|
||||
value = gen.B.createPointerToAddress(loc, value,
|
||||
valueTL.getLoweredType().getAddressType());
|
||||
value = gen.B.createPointerToAddress(
|
||||
loc, value, valueTL.getLoweredType().getAddressType(), /*isStrict*/ true);
|
||||
if (valueTL.isLoadable())
|
||||
value = gen.B.createLoad(loc, value);
|
||||
ManagedValue mValue = gen.emitManagedRValueWithCleanup(value, valueTL);
|
||||
|
||||
Reference in New Issue
Block a user