On 09/23/2015 11:26 AM, Thomas Schwinge wrote: > On Wed, 23 Sep 2015 10:57:40 -0700, Cesar Philippidis > <ce...@codesourcery.com> wrote: >> On 09/23/2015 10:42 AM, Cesar Philippidis wrote: >> | Gang, worker, vector and collapse all contain optional arguments which >> | may be used during loop expansion. In OpenACC, those expressions could >> | contain variables > > I'm fairly sure that at least the collapse clause needs to be a > compile-time constant?
Thanks, you're correct. I was looking at a user application and not the spec when I made this change. I've applied this patch to fix that. >> | but those variables aren't always getting remapped >> | automatically. This patch remaps those variables inside lower_omp_loop. > > Shouldn't that be done in lower_rec_input_clauses? (Maybe I'm confused > -- it's been a long time that I looked at this code.) (Jakub?) I thought that lower_rec_input_clauses was for omp reductions and firstprivate initialization? Variables ultimately get remapped when omplower eventually calls gimple_regimplify_operands. That function uses the value-expr to for remapping. In this case, since lower_omp_for is responsible for GIMPLE_OMP_FOR stmts, gimple_regimplify_operands doesn't get called on the clauses. Cesar
2015-09-23 Cesar Philippidis <ce...@codesourcery.com> gcc/ * omp-low.c (lower_omp_for): Don't remap OMP_CLAUSE_COLLAPSE because it always a constant value. diff --git a/gcc/omp-low.c b/gcc/omp-low.c index fa6b8a5..753996b 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -11341,7 +11341,6 @@ lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx) break; case OMP_CLAUSE_VECTOR: case OMP_CLAUSE_WORKER: - case OMP_CLAUSE_COLLAPSE: args = 1; break; }