[flang-commits] [flang] [llvm] [flang][cuda] Mark cuf.device_is_active as a read-only query (PR #233987)

Zhen Wang via flang-commits flang-commits at lists.llvm.org
Tue Oct 20 14:54:05 PDT 2026


================
@@ -448,6 +449,13 @@ def cuf_DeviceIsActiveOp : cuf_Op<"device_is_active", []> {
     Converted to a `_FortranACUFDeviceIsActive` runtime call on the host and
     to `false` in device code, so host-only cleanup is DCE'd from GPU
     functions.
+
+    The query is modeled as a read of the context state: it has no other
+    effect, so a `cuf.device_is_active` whose result is unused, for instance
+    once the cleanup it guarded has been removed, is dead and erased by
+    canonicalization while it is still an operation, before its conversion to
+    the runtime call. The runtime query it lowers to must stay free of
+    observable effects for this to hold.
----------------
wangzpgi wrote:

Removed.

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


More information about the flang-commits mailing list