[clang] [CIR] Wire unreachable, return, and switch to MemoryEffectsOpInterface (PR #242180)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 18 03:52:25 PST 2026


================
@@ -1048,7 +1048,8 @@ defvar CIR_ReturnableScopes = [
 ];
 
 def CIR_ReturnOp : CIR_Op<"return", [
-  ParentOneOf<CIR_ReturnableScopes>, Terminator
+  ParentOneOf<CIR_ReturnableScopes>, Terminator,
+  DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
----------------
xlauko wrote:

Without the interface, `cir.return` already has unknown effects, which is what keeps a scope containing it alive. What makes erasing that scope wrong is the non-local exit, not a memory access, so it belongs to the region being exited rather than to the terminator.

https://github.com/llvm/llvm-project/pull/242180


More information about the cfe-commits mailing list