Skip to content

Commit 0bbc44c

Browse files
committed
Disable !invariant metadata for 'let' variables.
I enabled this recently by piggybacking it in the mega-commit: commit badc565 Author: Andrew Trick <[email protected]> Date: Mon Mar 2 16:23:53 2020 Fix SIL MemBehavior queries with access markers. It miscompiles SwiftNIO's NIOPerformanceTester benchmark causing it to segfault immediately. We may consider debugging this to reenable it in the future... <rdar://60068448> Teach IRGen to emit !invariant metadata for 'let' variables Fixes <rdar://60038603> Swift CI: SwiftNIO_macOS NIOHTTP2_macOS fails
1 parent ef149d5 commit 0bbc44c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3569,16 +3569,16 @@ void IRGenSILFunction::visitRefTailAddrInst(RefTailAddrInst *i) {
35693569

35703570
static bool isInvariantAddress(SILValue v) {
35713571
SILValue accessedAddress = getAccessedAddress(v);
3572-
if (accessedAddress->getType().isAddress() && isLetAddress(accessedAddress)) {
3573-
return true;
3574-
}
35753572
if (auto *ptrRoot = dyn_cast<PointerToAddressInst>(accessedAddress)) {
35763573
return ptrRoot->isInvariant();
35773574
}
35783575
// TODO: We could be more aggressive about considering addresses based on
35793576
// `let` variables as invariant when the type of the address is known not to
35803577
// have any sharably-mutable interior storage (in other words, no weak refs,
3581-
// atomics, etc.)
3578+
// atomics, etc.). However, this currently miscompiles some programs.
3579+
// if (accessedAddress->getType().isAddress() && isLetAddress(accessedAddress)) {
3580+
// return true;
3581+
// }
35823582
return false;
35833583
}
35843584

test/IRGen/invariant_load.sil

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
22

3+
// REQUIRES: rdar60068448
4+
// FIXME Reenable the !invariant.load metadata after debugging miscompiles...
5+
// <rdar://60068448> Teach IRGen to emit !invariant metadata for 'let' variables
6+
37
sil_stage lowered
48

59
import Builtin

0 commit comments

Comments
 (0)