mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Use the best resilience expansion when lowering types
This is a large patch; I couldn't split it up further while still keeping things working. There are four things being changed at once here: - Places that call SILType::isAddressOnly()/isLoadable() now call the SILFunction overload and not the SILModule one. - SILFunction's overloads of getTypeLowering() and getLoweredType() now pass the function's resilience expansion down, instead of hardcoding ResilienceExpansion::Minimal. - Various other places with '// FIXME: Expansion' now use a better resilience expansion. - A few tests were updated to reflect SILGen's improved code generation, and some new tests are added to cover more code paths that previously were uncovered and only manifested themselves as standard library build failures while I was working on this change.
This commit is contained in:
@@ -249,7 +249,7 @@ static bool isCaptured(AllocStackInst *ASI, bool &inSingleBlock) {
|
||||
// Destroys of loadable types can be rewritten as releases, so
|
||||
// they are fine.
|
||||
if (auto *DAI = dyn_cast<DestroyAddrInst>(II))
|
||||
if (DAI->getOperand()->getType().isLoadable(DAI->getModule()))
|
||||
if (DAI->getOperand()->getType().isLoadable(*DAI->getFunction()))
|
||||
continue;
|
||||
|
||||
// Other instructions are assumed to capture the AllocStack.
|
||||
@@ -296,7 +296,7 @@ bool MemoryToRegisters::isWriteOnlyAllocation(AllocStackInst *ASI) {
|
||||
/// Promote a DebugValueAddr to a DebugValue of the given value.
|
||||
static void
|
||||
promoteDebugValueAddr(DebugValueAddrInst *DVAI, SILValue Value, SILBuilder &B) {
|
||||
assert(DVAI->getOperand()->getType().isLoadable(DVAI->getModule()) &&
|
||||
assert(DVAI->getOperand()->getType().isLoadable(*DVAI->getFunction()) &&
|
||||
"Unexpected promotion of address-only type!");
|
||||
assert(Value && "Expected valid value");
|
||||
B.setInsertionPoint(DVAI);
|
||||
@@ -368,7 +368,9 @@ static void replaceLoad(LoadInst *LI, SILValue val, AllocStackInst *ASI) {
|
||||
}
|
||||
|
||||
static void replaceDestroy(DestroyAddrInst *DAI, SILValue NewValue) {
|
||||
assert(DAI->getOperand()->getType().isLoadable(DAI->getModule()) &&
|
||||
SILFunction *F = DAI->getFunction();
|
||||
|
||||
assert(DAI->getOperand()->getType().isLoadable(*F) &&
|
||||
"Unexpected promotion of address-only type!");
|
||||
|
||||
assert(NewValue && "Expected a value to release!");
|
||||
@@ -376,7 +378,6 @@ static void replaceDestroy(DestroyAddrInst *DAI, SILValue NewValue) {
|
||||
SILBuilderWithScope Builder(DAI);
|
||||
|
||||
auto Ty = DAI->getOperand()->getType();
|
||||
SILFunction *F = DAI->getFunction();
|
||||
auto &TL = F->getTypeLowering(Ty);
|
||||
|
||||
bool expand = shouldExpand(DAI->getModule(),
|
||||
|
||||
Reference in New Issue
Block a user