Skip to content

Commit dbf2f62

Browse files
Merge pull request #76282 from aschwaighofer/loadable_by_address_reg2mem_throw
[loadable by address reg2mem] Implement missing throw instruction
2 parents 85068f0 + eeaf962 commit dbf2f62

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lib/IRGen/LoadableByAddress.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3919,6 +3919,8 @@ class RewriteUser : SILInstructionVisitor<RewriteUser> {
39193919

39203920
void visitYieldInst(YieldInst *yield) { userInstructionFallback(yield); }
39213921

3922+
void visitThrowInst(ThrowInst *t) { userInstructionFallback(t); }
3923+
39223924
void visitFixLifetimeInst(FixLifetimeInst *f) {
39233925
auto addr = assignment.getAddressForValue(f->getOperand());
39243926
auto builder = assignment.getBuilder(f->getIterator());

test/IRGen/loadable_by_address_reg2mem.sil

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,16 @@ bb0(%0 : $*X):
351351
dealloc_stack %1 : $*Y
352352
return %13 : $()
353353
}
354+
355+
// CHECK: sil @test14
356+
// CHECK: [[VAL:%.*]] = load {{.*}} : $*X
357+
// CHECK: throw [[VAL]]
358+
// CHECK: } // end sil function 'test14'
359+
sil @test14 : $@convention(thin) (@in X) -> @error X {
360+
bb0(%0 : $*X):
361+
%1 = alloc_stack $X
362+
copy_addr [take] %0 to [init] %1 : $*X
363+
%3 = load %1 : $*X
364+
dealloc_stack %1 : $*X
365+
throw %3 : $X
366+
}

0 commit comments

Comments
 (0)