Skip to content

Commit ce05a0a

Browse files
committed
[Coro] RetconOnceDynamic: Annotate alloc param.
Mark the allocator parameter passed to the allocation functions swiftcoro.
1 parent cc0e462 commit ce05a0a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

llvm/lib/Transforms/Coroutines/Coroutines.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ Value *coro::Shape::emitAlloc(IRBuilder<> &Builder, Value *Size,
559559
Args.push_back(TypeId);
560560
}
561561
auto *Call = Builder.CreateCall(Alloc, Args);
562+
Call->addParamAttr(1, Attribute::SwiftCoro);
562563
propagateCallAttrsFromCallee(Call, Alloc);
563564
addCallToCallGraph(CG, Call, Alloc);
564565
return Call;
@@ -598,6 +599,7 @@ void coro::Shape::emitDealloc(IRBuilder<> &Builder, Value *Ptr,
598599
Ptr, Dealloc->getFunctionType()->getParamType(allocationParamIndex));
599600
Args.push_back(Ptr);
600601
auto *Call = Builder.CreateCall(Dealloc, Args);
602+
Call->addParamAttr(1, Attribute::SwiftCoro);
601603
propagateCallAttrsFromCallee(Call, Dealloc);
602604
addCallToCallGraph(CG, Call, Dealloc);
603605
return;

llvm/test/Transforms/Coroutines/coro-retcon-once-dynamic.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ declare i32 @getSize()
174174
; CHECK: %size = call i32 @getSize()
175175
; CHECK: call swiftcorocc ptr @allocate(
176176
; CHECK-SAME: ptr %frame,
177-
; CHECK-SAME: ptr %allocator,
177+
; CHECK-SAME: ptr swiftcoro %allocator,
178178
; CHECK-SAME: i32 %size
179179
; CHECK-SAME: )
180180
define { ptr, ptr } @allocating_something(ptr noalias %frame, ptr swiftcoro %allocator) {

0 commit comments

Comments
 (0)