Skip to content

Commit 8476d7e

Browse files
committed
Add NoDuplicate to coro.promise
1 parent b7c158e commit 8476d7e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

llvm/lib/Transforms/Coroutines/CoroEarly.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ void Lowerer::hidePromiseAlloca(CoroIdInst *CoroId, CoroBeginInst *CoroBegin) {
168168
SmallVector<Value *, 3> Arg{CoroBegin, Alignment, FromPromise};
169169
auto *PI = Builder.CreateIntrinsic(
170170
Builder.getPtrTy(), Intrinsic::coro_promise, Arg, {}, "promise.addr");
171+
PI->setCannotDuplicate();
171172
PA->replaceUsesWithIf(PI, [CoroId](Use &U) {
172173
bool IsBitcast = U == U.getUser()->stripPointerCasts();
173174
bool IsCoroId = U.getUser() == CoroId;

llvm/lib/Transforms/Coroutines/Coroutines.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ void coro::Shape::analyze(Function &F,
288288
}
289289
break;
290290
case Intrinsic::coro_promise:
291+
assert(CoroPromise == nullptr &&
292+
"CoroEarly must ensure coro.promise unique");
291293
CoroPromise = cast<CoroPromiseInst>(II);
292294
break;
293295
}

0 commit comments

Comments
 (0)