File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -4627,6 +4627,17 @@ void IRGenSILFunction::visitIsEscapingClosureInst(
4627
4627
setLoweredExplosion (i, out);
4628
4628
}
4629
4629
4630
+ static bool isCallToSwiftTaskAlloc (llvm::Value *val) {
4631
+ auto *call = dyn_cast<llvm::CallInst>(val);
4632
+ if (!call)
4633
+ return false ;
4634
+ auto *callee = call->getCalledFunction ();
4635
+ if (!callee)
4636
+ return false ;
4637
+ auto isTaskAlloc = callee->getName ().equals (" swift_task_alloc" );
4638
+ return isTaskAlloc;
4639
+ }
4640
+
4630
4641
void IRGenSILFunction::emitDebugInfoForAllocStack (AllocStackInst *i,
4631
4642
const TypeInfo &type,
4632
4643
llvm::Value *addr) {
@@ -4644,6 +4655,11 @@ void IRGenSILFunction::emitDebugInfoForAllocStack(AllocStackInst *i,
4644
4655
else if (auto *CoroAllocaGet = dyn_cast<llvm::IntrinsicInst>(Op0)) {
4645
4656
if (CoroAllocaGet->getIntrinsicID () == llvm::Intrinsic::coro_alloca_get)
4646
4657
addr = CoroAllocaGet;
4658
+ } else if (auto *call = dyn_cast<llvm::CallInst>(Op0)) {
4659
+ addr = call;
4660
+ bool isTaskAlloc = isCallToSwiftTaskAlloc (call);
4661
+ assert (isTaskAlloc && " expecting call to swift_task_alloc" );
4662
+ (void )isTaskAlloc;
4647
4663
}
4648
4664
}
4649
4665
@@ -4659,7 +4675,7 @@ void IRGenSILFunction::emitDebugInfoForAllocStack(AllocStackInst *i,
4659
4675
4660
4676
// At this point addr must be an alloca or an undef.
4661
4677
assert (isa<llvm::AllocaInst>(addr) || isa<llvm::UndefValue>(addr) ||
4662
- isa<llvm::IntrinsicInst>(addr));
4678
+ isa<llvm::IntrinsicInst>(addr) || isCallToSwiftTaskAlloc (addr) );
4663
4679
4664
4680
auto Indirection = DirectValue;
4665
4681
if (!IGM.IRGen .Opts .DisableDebuggerShadowCopies &&
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -primary-file %s -emit-ir -enable-experimental-concurrency -g | %FileCheck %s
2
+
3
+ // Don't assert on dynamically sized variables.
4
+ // CHECK: define{{( dllexport)?}}{{( protected)?}} swiftcc void @"$s5debug1fyxxYKlF"
5
+
6
+ public func f< Success> ( _ value: Success ) async throws -> Success {
7
+ switch Result < Success , Error > . success ( value) {
8
+ case . success( let success) :
9
+ return success
10
+
11
+ case . failure( let error) :
12
+ throw error;
13
+ }
14
+ }
You can’t perform that action at this time.
0 commit comments