Skip to content

Commit 9642080

Browse files
committed
[NFC] SILVerifier: Doc + cleanup to store_borrow.
1 parent 2060979 commit 9642080

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,23 +2450,22 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
24502450
}
24512451

24522452
void checkStoreBorrowInst(StoreBorrowInst *SI) {
2453+
// A store_borrow must be to an alloc_stack. That alloc_stack can only be
2454+
// used by store_borrows (and dealloc_stacks).
24532455
require(SI->getSrc()->getType().isObject(),
24542456
"Can't store from an address source");
24552457
require(!fnConv.useLoweredAddresses()
24562458
|| SI->getSrc()->getType().isLoadable(*SI->getFunction()),
24572459
"Can't store a non loadable type");
24582460
require(SI->getDest()->getType().isAddress(),
24592461
"Must store to an address dest");
2462+
// Note: This is the current implementation and the design is not final.
24602463
require(isa<AllocStackInst>(SI->getDest()),
2461-
"store_borrow destination should be alloc_stack");
2464+
"store_borrow destination can only be an alloc_stack");
24622465
requireSameType(SI->getDest()->getType().getObjectType(),
24632466
SI->getSrc()->getType(),
24642467
"Store operand type and dest type mismatch");
24652468

2466-
// Note: This is the current implementation and the design is not final.
2467-
require(isa<AllocStackInst>(SI->getDest()),
2468-
"store_borrow destination can only be an alloc_stack");
2469-
24702469
SSAPrunedLiveness scopedAddressLiveness;
24712470
ScopedAddressValue scopedAddress(SI);
24722471
// FIXME: Reenable @test_load_borrow_store_borrow_nested in

test/SIL/store_borrow_verify_errors.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ bb1:
196196
}
197197

198198
// CHECK: Begin Error in function test_store_borrow_dest
199-
// CHECK: SIL verification failed: store_borrow destination should be alloc_stack: isa<AllocStackInst>(SI->getDest())
199+
// CHECK: SIL verification failed: store_borrow destination can only be an alloc_stack: isa<AllocStackInst>(SI->getDest())
200200
// CHECK: Verifying instruction:
201201
// CHECK: %0 = argument of bb0 : $Klass // user: %3
202202
// CHECK: %2 = struct_element_addr %1 : $*NonTrivialStruct, #NonTrivialStruct.val // user: %3

0 commit comments

Comments
 (0)