https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97000
--- Comment #8 from Tom de Vries <vries at gcc dot gnu.org> ---
This detects the problem earlier, in the host compiler:
...
diff --git a/gcc/omp-offload.c b/gcc/omp-offload.c
index 32c2485abd4..fce01af7682 100644
--- a/gcc/omp-offload.c
+++ b/gcc/omp-offload.c
@@ -1148,6 +1148,7 @@ oacc_loop_discover_walk (oacc_loop *loop, basic_block bb)
break;
case IFN_UNIQUE:
+ gcc_assert (stmt == last_stmt (CONST_CAST_BB (bb)));
enum ifn_unique_kind kind
= (enum ifn_unique_kind) (TREE_INT_CST_LOW
(gimple_call_arg (call, 0)));
...