Author: Robert Imschweiler
Date: 2026-06-26T16:08:29Z
New Revision: 4290299b5c999fec55ff6f26bdefaf50ff124c88

URL: 
https://github.com/llvm/llvm-project/commit/4290299b5c999fec55ff6f26bdefaf50ff124c88
DIFF: 
https://github.com/llvm/llvm-project/commit/4290299b5c999fec55ff6f26bdefaf50ff124c88.diff

LOG: [clang][OpenMP][NFC] Assert fused distribute loop invariant (#206113)

See
https://github.com/llvm/llvm-project/pull/201670#discussion_r3463060131

Added: 
    

Modified: 
    clang/lib/CodeGen/CGStmtOpenMP.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp 
b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 95fd6694437fe..88f698f38cce0 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -3905,9 +3905,14 @@ bool CodeGenFunction::EmitOMPWorksharingLoop(
       // GPU combined `distribute parallel for`: emit a single
       // for_static_init with the fused distr_static_chunk + static_chunkone
       // schedule (enum 93). The surrounding EmitOMPDistributeLoop must skip
-      // its distribute_static_init under the same conditions.
-      if (StaticChunkedOne && canEmitGPUFusedDistSchedule(CGM, S, EKind))
-        ScheduleKind.UseFusedDistChunkSchedule = true;
+      // its distribute_static_init under the same conditions. Both sites are
+      // guarded by canEmitGPUFusedDistSchedule() alone so they cannot
+      // disagree; the assert guards the invariant that makes this safe today,
+      // aka that the implicit GPU default schedule is always static chunk-one.
+      ScheduleKind.UseFusedDistChunkSchedule =
+          canEmitGPUFusedDistSchedule(CGM, S, EKind);
+      assert((!ScheduleKind.UseFusedDistChunkSchedule || StaticChunkedOne) &&
+             "fused distribute schedule requires a static chunk-one schedule");
       bool IsMonotonic =
           Ordered ||
           (ScheduleKind.Schedule == OMPC_SCHEDULE_static &&


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

Reply via email to