Skip to content

Commit 5228c3b

Browse files
committed
Relax restriction on fallthrough coro.end
1 parent efa867f commit 5228c3b

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

llvm/include/llvm/Transforms/Coroutines/CoroInstr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ class AnyCoroEndInst : public IntrinsicInst {
682682
enum { FrameArg, UnwindArg, TokenArg };
683683

684684
public:
685-
bool isFallthrough() const { return !isUnwind() && user_empty(); }
685+
bool isFallthrough() const { return !isUnwind(); }
686686
bool isUnwind() const {
687687
return cast<Constant>(getArgOperand(UnwindArg))->isOneValue();
688688
}

llvm/lib/Transforms/Coroutines/Coroutines.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,6 @@ void coro::Shape::analyze(Function &F,
259259

260260
if (CoroEnds.back()->isUnwind())
261261
HasUnwindCoroEnd = true;
262-
263-
if (CoroEnds.back()->isFallthrough() && isa<CoroEndInst>(II)) {
264-
// Make sure that the fallthrough coro.end is the first element in the
265-
// CoroEnds vector.
266-
// Note: I don't think this is neccessary anymore.
267-
if (CoroEnds.size() > 1) {
268-
if (CoroEnds.front()->isFallthrough())
269-
report_fatal_error(
270-
"Only one coro.end can be marked as fallthrough");
271-
std::swap(CoroEnds.front(), CoroEnds.back());
272-
}
273-
}
274262
break;
275263
case Intrinsic::coro_promise:
276264
assert(CoroPromise == nullptr &&

llvm/test/Transforms/Coroutines/coro-split-coroend.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ entry:
2828

2929
end:
3030
%InResume = call i1 @llvm.coro.end(ptr null, i1 false, token none)
31-
br i1 %InResume, label %start, label %done
31+
br i1 %InResume, label %resume, label %start
3232

33-
start:
33+
resume:
3434
call void @a()
35-
br label %done
35+
br label %start
3636

37-
done:
37+
start:
3838
call i1 @llvm.coro.end(ptr null, i1 false, token none)
3939
ret ptr %hdl
4040
}

0 commit comments

Comments
 (0)