Andres-Salamanca wrote:

> > My initial idea was to handle these cases in the FlattenCFG pass.
> 
> @Andres-Salamanca Do you mean emitting code past a `co_return` in the same 
> block and cleaning that up later in `FlattenCFG`? The problem with that would 
> be that the IR wouldn't be valid until you flatten it because the `co_return` 
> is a terminator. Or am I misunderstanding you?
> 
> Whether we fallthrough or not also affects whether we need to emit an 
> implicit `co_return` or not and that shouldn't be handled in FlattenCFG.
> 
> If you mean removing dead code that's probably fine and just a question of 
> whether we like to remain it at this stage. IIRC we also keep dead code for 
> `if` statements. I don't feel strongly either way.

Yes, I meant removing dead code during `FlattenCFG`.

OGCG emits the final suspend depending on whether the coroutine can fall 
through, which CIR currently doesn't handle, since it emits the final suspend 
in all cases. My idea was to remove the final suspend during `FlattenCFG` when 
the coroutine can't fall through.
What do you think about handling the final suspend this way?

https://github.com/llvm/llvm-project/pull/231046
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to