https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81778

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
This is essentially:
...
diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c
index 2c28682..3990998 100644
--- a/gcc/omp-expand.c
+++ b/gcc/omp-expand.c
@@ -4327,6 +4327,18 @@ expand_omp_simd (struct omp_region *region,
        if (V cond N2) goto L0; else goto L2;
     L2:

+    and for simt (assuming sufficient safe_len), we generate pseudocode
+
+       V = N1 + simt_lane * STEP; // Can this overflow?
+       goto L1;
+    L0:
+       BODY;
+       V += STEP * simt_vf; // This can overflow, see PR81778
+    L1:
+       if (V cond N2) goto L0; else goto L2;
+    L2:
+       V -= STEP * (simt_vf - 1)
+
     For collapsed loops, given parameters:
       collapse(3)
       for (V1 = N11; V1 cond1 N12; V1 += STEP1)
...

Reply via email to