================
@@ -3358,14 +3396,17 @@ genOMP(Fortran::lower::AbstractConverter &converter,
               .t);
   // Currently only private/firstprivate clause is handled, and
   // all privatization is done within `omp.section` operations.
+  symTable.pushScope();
----------------
kparzysz wrote:

`pushScope` and `popScope` used to be call before as well, but somewhere else.

The tree structure of SECTIONS (with a single SECTION for simplicity) looks 
like this:
```
OpenMPConstruct (variant) -> OpenMPSectionsConstruct
`-- OpenMPConstruct (variant) -> OpenMPSectionConstruct
     `-- body of section
```

Before this PR, in the bridge, genFIR for `OpenMPConstruct` would call the 
entry point to OpenMP, then it would iterate over the nested evaluations and 
call genFIR recursively(*) for them.  Each call from the bridge to the OpenMP 
entry would be wrapped in `pushScope`/`popScope`.  The first call would process 
the SECTIONS construct, but since it didn't do recursive lowering, it would 
just create the skeleton, and not visit the nested SECTION.

The first recursive (*) call to genFIR would then call the OpenMP entry again, 
this time for SECTION, and that call would again have `pushScope` and 
`popScope` around it.  If there are multiple nested SECTION's, each of them 
would have its own scope.

After this PR, the genOMP for SECTIONS also visits the SECTION constructs.  In 
other words, it skips the additional intervening genFIR calls, and does the 
SECTION processing directly.  The consequence is that it now has to create the 
additional scopes on its own.


https://github.com/llvm/llvm-project/pull/77758
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to