Commit Graph

58 Commits

Author SHA1 Message Date
Tom Eccles
e9cba3c8ed [flang][OpenMP] use attribute for delayed privatization barrier (#140092)
Fixes #136357

The barrier needs to go between the copying into firstprivate variables
and the initialization call for the OpenMP construct (e.g. wsloop).
There is no way of expressing this in MLIR because for delayed
privatization that is all implicit (added in MLIR->LLVMIR conversion).

The previous approach put the barrier immediately before the wsloop (or
similar). For delayed privatization, the firstprivate copy code would
then be inserted after that, opening the possibility for the race
observed in the bug report.

This patch solves the issue by instead setting an attribute on the mlir
operation, which will instruct openmp dialect to llvm ir conversion to
insert a barrier in the correct place.
2025-05-22 15:25:53 +01:00
NimishMishra
0baacd1a58 [flang][OpenMP] Support MLIR lowering of linear clause for omp.wsloop (#139385)
This patch adds support for MLIR lowering of linear clause on omp.wsloop
(except for linear modifiers).
2025-05-19 23:33:06 -07:00
Tom Eccles
2a32d738bb [flang][OpenMP] fix predetermined privatization inside section (#138159)
This now produces code equivalent to if there was an explicit private
clause on the SECTIONS construct.

The problem was that each SECTION construct got its own DSP, which tried
to privatize the same symbol for that SECTION. Privatization for
SECTION(S) happens on the outer SECTION construct and so the outer
construct's DSP should be shared.

Fixes #135108
2025-05-08 10:08:49 +01:00
Kareem Ergawy
9543e9e927 [flang][OpenMP] Handle pre-detemined lastprivate for simd (#129507)
This PR tries to fix `lastprivate` update issues in composite
constructs. In particular, pre-determined `lastprivate` symbols are
attached to the wrong leaf of the composite construct (the outermost
one). When using delayed privatization (should be the default mode in
the future), this results in trying to update the `lastprivate` symbol
in the wrong construct (outside the `omp.loop_nest` op).

For example, given the following input:
```fortran
!$omp target teams distribute parallel do simd collapse(2) private(y_max)
  do i=x_min,x_max
    do j=y_min,y_max
    enddo
  enddo
```

Without the fixes introduced in this PR, the `DataSharingProcessor`
tries to generate the `lastprivate` update ops in the `parallel` op
since this is the op for which the DSP instance is created.

The fix consists of 2 main parts:
1. Instead of creating a single DSP instance, one instance is created
for the leaf constructs that might need privatization (whether for
explicit, implicit, or pre-determined symbols).
2. When generating the `lastprivate` comparison ops, we don't directly
use the SSA values of the UBs and steps. Instead, we regenerated these
SSA values from the original loop bounds' expressions. We have to do
this to avoid using `host_eval` values in the `lastprivate` comparison
logic which is illegal.
2025-03-07 05:44:39 +01:00
Kiran Chandramohan
e2911aa2c2 [Flang][OpenMP] Fix crash when loop index var is pointer or allocatable (#129717)
Use hlfir dereferencing for pointers and allocatables and use hlfir
assign. Also, change the code updating IV in lastprivate.

Note: This is a small change. Modifications in existing tests are
changes from fir.store to hlfir.assign.

Fixes #121290
2025-03-06 12:19:34 +00:00
Tom Eccles
db48d49311 [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (#125307)
See RFC:

https://discourse.llvm.org/t/rfc-openmp-supporting-delayed-task-execution-with-firstprivate-variables/83084

The aim here is to ensure that tasks which are not executed for a while
after they are created do not try to reference any data which are now
out of scope. This is done by packing the data referred to by the task
into a heap allocated structure (freed at the end of the task).

I decided to create the task context structure in
OpenMPToLLVMIRTranslation instead of adapting how it is done
CodeExtractor (via OpenMPIRBuilder] because CodeExtractor is (at least
in theory) generic code which could have other unrelated uses.
2025-02-27 09:22:44 +00:00
Tom Eccles
747588dc64 [flang][Lower][OpenMP] Don't read moldarg for static sized array (#127838)
This should further reduce the number of spurious barriers
2025-02-20 10:31:34 +00:00
Tom Eccles
22ef210100 Revert "[flang][Lower][OpenMP] Don't read moldarg for static sized array" (#127596)
Reverts llvm/llvm-project#125901

Revert until I have fixed bot failures
2025-02-18 09:12:36 +00:00
Tom Eccles
88dd372d67 [flang][Lower][OpenMP] Don't read moldarg for static sized array (#125901)
This should further reduce the number of spurious barriers
2025-02-18 09:02:29 +00:00
Sergio Afonso
8a3d7cedb7 [Flang][OpenMP] Per-sym checks to introduce barriers (#127074)
Whenever there is a `lastprivate` variable and another unrelated
variable sets the `mightHaveReadHostSym` flag during Flang lowering
privatization, this will result in the insertion of a barrier.

This patch modifies this behavior such that this barrier will not be
inserted unless the same symbol both sets the flag and has
`lastprivate`.
2025-02-14 12:24:16 +00:00
Kareem Ergawy
25f29ee377 [flang][OpenMP] Update all lastprivate symbols, not just in clauses (#125628)
Fixes a bug in updating `lastprivate` variables. Previously, we only
iterated over the symbols collected from `lastprivate` clauses. This
meants that for pre-determined symbols, we did not implement the update
correctly (e.g. for loop iteration variables of `simd` constructs).
2025-02-04 15:52:46 +01:00
Tom Eccles
aeaafce464 [mlir][OpenMP][flang] make private variable allocation implicit in omp.private (#124019)
The intention of this work is to give MLIR->LLVMIR conversion freedom to
control how the private variable is allocated so that it can be
allocated on the stack in ordinary cases or as part of a structure used
to give closure context for tasks which might outlive the current stack
frame. See RFC:

https://discourse.llvm.org/t/rfc-openmp-supporting-delayed-task-execution-with-firstprivate-variables/83084

For example, a privatizer for an integer used to look like
```mlir
  omp.private {type = private} @x.privatizer : !fir.ref<i32> alloc {
  ^bb0(%arg0: !fir.ref<i32>):
    %0 = ... allocate proper memory for the private clone ...
    omp.yield(%0 : !fir.ref<i32>)
  }
```

After this change, allocation become implicit in the operation:
```mlir
  omp.private {type = private} @x.privatizer : i32
```

For more complex types that require initialization after allocation, an
init region can be used:
``` mlir
  omp.private {type = private} @x.privatizer : !some.type init {
  ^bb0(%arg0: !some.pointer<!some.type>, %arg1: !some.pointer<!some.type>):
    // initialize %arg1, using %arg0 as a mold for allocations
    omp.yield(%arg1 : !some.pointer<!some.type>)
  } dealloc {
    ^bb0(%arg0: !some.pointer<!some.type>):
    ... deallocate memory allocated by the init region ...
    omp.yield
  }
```

This patch lays the groundwork for delayed task execution but is not
enough on its own.

After this patch all gfortran tests which previously passed still pass.
There
are the following changes to the Fujitsu test suite:
- 0380_0009 and 0435_0009 are fixed
- 0688_0041 now fails at runtime. This patch is testing firstprivate
variables with tasks. Previously we got lucky with the undefined
behavior and won the race. After these changes we no longer get lucky.
This patch lays the groundwork for a proper fix for this issue.

In flang the lowering re-uses the existing lowering used for reduction
init and dealloc regions.

In flang, before this patch we hit a TODO with the same wording when
generating the copy region for firstprivate polymorphic variables. After
this patch the box-like fir.class is passed by reference into the copy
region, leading to a different path that didn't hit that old TODO but
the generated code still didn't work so I added a new TODO in
DataSharingProcessor.
2025-01-31 09:35:26 +00:00
Kareem Ergawy
a0406ce823 [flang][OpenMP] Add hostIsSource paramemter to copyHostAssociateVar (#123162)
This fixes a bug when the same variable is used in `firstprivate` and
`lastprivate` clauses on the same construct. The issue boils down to the
fact that `copyHostAssociateVar` was deciding the direction of the copy
assignment (i.e. the `lhs` and `rhs`) based on whether the
`copyAssignIP`
parameter is set. This is not the best way to do it since it is not
related to whether we doing a copy from host to localized copy or the
other way around. When we set the insertion for `firstprivate` in
delayed privatization, this resulted in switching the direction of the
copy assignment. Instead, this PR adds a new paramter to explicitely
tell
the function the direction of the assignment.

This is a follow up PR for
https://github.com/llvm/llvm-project/pull/122471, only the latest commit
is relevant.
2025-01-16 19:10:12 +01:00
Leandro Lupori
5130a4ea12 [flang][OpenMP] Handle pointers and allocatables in clone init (#121824)
InitializeClone(), implemented in #120295, was not handling top
level pointers and allocatables correctly.
Pointers and unallocated variables must be skipped.

This caused some regressions in the Fujitsu testsuite:
https://linaro.atlassian.net/browse/LLVM-1488
2025-01-07 14:00:39 -03:00
Leandro Lupori
1fcb6a9754 [flang][OpenMP] Initialize allocatable members of derived types (#120295)
Allocatable members of privatized derived types must be allocated,
with the same bounds as the original object, whenever that member
is also allocated in it, but Flang was not performing such
initialization.

The `Initialize` runtime function can't perform this task unless
its signature is changed to receive an additional parameter, the
original object, that is needed to find out which allocatable
members, with their bounds, must also be allocated in the clone.
As `Initialize` is used not only for privatization, sometimes this
other object won't even exist, so this new parameter would need
to be optional.
Because of this, it seemed better to add a new runtime function:
`InitializeClone`.
To avoid unnecessary calls, lowering inserts a call to it only for
privatized items that are derived types with allocatable members.

Fixes https://github.com/llvm/llvm-project/issues/114888
Fixes https://github.com/llvm/llvm-project/issues/114889
2024-12-19 17:26:50 -03:00
Leandro Lupori
db9856b516 [flang][OpenMP][NFC] Turn symTable into a reference (#119435)
Convert `DataSharingProcessor::symTable` from pointer to reference.
This avoids accidental null pointer dereferences and makes it
possible to use `symTable` when delayed privatization is disabled.
2024-12-11 16:26:19 -03:00
jeanPerier
ff78cd5f3d [flang] fix private pointers and default initialized variables (#118494)
Both OpenMP privatization and DO CONCURRENT LOCAL lowering was incorrect
for pointers and derived type with default initialization.

For pointers, the descriptor was not established with the rank/type
code/element size, leading to undefined behavior if any inquiry was made
to it prior to a pointer assignment (and if/when using the runtime for
pointer assignments, the descriptor must have been established).

For derived type with default initialization, the copies were not
default initialized.
2024-12-05 14:09:48 +01:00
Sergio Afonso
0a17bdfc36 [MLIR][OpenMP] Remove terminators from loop wrappers (#112229)
This patch simplifies the representation of OpenMP loop wrapper
operations by introducing the `NoTerminator` trait and updating
accordingly the verifier for the `LoopWrapperInterface`.

Since loop wrappers are already limited to having exactly one region
containing exactly one block, and this block can only hold a single
`omp.loop_nest` or loop wrapper and an `omp.terminator` that does not
return any values, it makes sense to simplify the representation of loop
wrappers by removing the terminator.

There is an extensive list of Lit tests that needed updating to remove
the `omp.terminator`s adding some noise to this patch, but actual
changes are limited to the definition of the `omp.wsloop`, `omp.simd`,
`omp.distribute` and `omp.taskloop` loop wrapper ops, Flang lowering for
those, `LoopWrapperInterface::verifyImpl()`, SCF to OpenMP conversion
and OpenMP dialect documentation.
2024-10-15 11:28:39 +01:00
Tom Eccles
c734d77b99 [flang][semantics][OpenMP] no privatisation of stmt functions (#106550)
OpenMP prohibits privatisation of variables that appear in expressions
for statement functions.

This is a re-working of an old patch https://reviews.llvm.org/D93213 by
@praveen-g-ctt.

The old patch couldn't be landed because of ordering concerns. Statement
functions are rewritten during parse tree rewriting, but this was done
after resolve-directives and so some array expressions were incorrectly
identified as statement functions. For this reason **I have opted to
re-order the semantics driver so that resolve-directives is run after
parse tree rewriting**.

Closes #54677

---------

Co-authored-by: Praveen <praveen@compilertree.com>
2024-10-04 10:46:31 +01:00
NimishMishra
eafa15009e [flang][OpenMP] Enable lastprivate on simd (#93786)
This PR enables the lowering of lastprivate when defined on simd
construct
2024-10-03 06:32:44 -07:00
Krzysztof Parzyszek
f98244392b [flang][OpenMP] Parse lastprivate modifier, add TODO to lowering (#110568)
Parse the lastprivate clause with a modifier. Codegen for it is not yet
implemented.
2024-10-02 15:36:45 -05:00
Matthias Springer
49df12c01e [mlir][NFC] Minor cleanup around ModuleOp usage (#110498)
Use `moduleOp.getBody()` instead of `moduleOp.getBodyRegion().front()`.
2024-09-30 21:20:48 +02:00
Sergio Afonso
433ca3ebbe [Flang][Lower] Introduce SymMapScope helper class (NFC) (#107866)
This patch creates a simple RAII wrapper class for `SymMap` to make it
easier to use and prevent a missing matching `popScope()` for a
`pushScope()` call on simple use cases.

Some push-pop pairs are replaced with instances of the new class by this
patch.
2024-09-10 11:09:25 +01:00
Sergio Afonso
12c4d26c1d [Flang][OpenMP] NFC: DataSharingProcessor cleanup (#107391)
This patch removes unused and undefined method declarations from
`DataSharingProcessor`, as well as the unused `hasLastPrivateOp` class
member. The `insPt` class member is replaced by a local `InsertionGuard`
in the only place it is set and used.
2024-09-06 10:36:49 +01:00
Leandro Lupori
797f01198e [flang][OpenMP] Make lastprivate work with reallocated variables (#106559)
Fixes https://github.com/llvm/llvm-project/issues/100951
2024-09-05 14:55:01 -03:00
Sergio Afonso
2784060c16 [MLIR][Flang][OpenMP] Remove omp.parallel from loop wrapper ops (#105833)
This patch updates the `omp.parallel` operation according to the results
of the discussion in [this
RFC](https://discourse.llvm.org/t/rfc-disambiguation-between-loop-and-block-associated-omp-parallelop/79972).
It is removed from the set of loop wrapper operations, changing the
expected MLIR representation for composite `distribute parallel do/for`
into the following:

```mlir
omp.parallel {
  ...
  omp.distribute {
    omp.wsloop {
      omp.loop_nest ... { ... }
      omp.terminator
    }
    omp.terminator
  }
  ...
  omp.terminator
}
```

MLIR verifiers for operations impacted by this representation change are
updated, as well as related tests. The `LoopWrapperInterface` is also
updated, since it's no longer representing an optional "role" of an
operation but a mandatory set of restrictions instead.
2024-08-29 11:43:04 +01:00
Leandro Lupori
216ba6bc6c [flang][OpenMP] Privatize vars referenced in statement functions (#103390)
Variables referenced in the body of statement functions need to be
handled as if they are explicitly referenced. Otherwise, they are
skipped during implicit privatization, because statement functions
are represented as procedures in the parse tree.

To avoid missing symbols referenced only in statement functions
during implicit privatization, new symbols, associated with them,
are created and inserted into the context of the directive that
privatizes them. They are later collected and processed in
lowering. To avoid confusing these new symbols with regular ones,
they are tagged with the new OmpFromStmtFunction flag.

Fixes https://github.com/llvm/llvm-project/issues/74273
2024-08-26 08:39:32 -03:00
Kareem Ergawy
bbadbf751e [flang][OpenMP] Delayed privatization for variables with equivalence association (#100531)
Handles variables that are storage associated via `equivalence`. The
problem is that these variables are declared as `fir.ptr`s while their
privatized storage is declared as `fir.ref` which was triggering a
validation error in the OpenMP dialect.
2024-08-01 11:52:00 +02:00
Sergio Afonso
46ecd7bbe8 [MLIR][OpenMP] Create LoopRelatedClause (#99506)
This patch introduces a new OpenMP clause definition not defined by the spec.

Its main purpose is to define the `loop_inclusive` (previously "inclusive",
renamed according to the parent of this PR in the stack) argument of
`omp.loop_nest` in such a way that a followup implementation of a tablegen
backend to automatically generate clause and operation operand structures
directly from `OpenMP_Op` and `OpenMP_Clause` definitions can properly generate
the `LoopNestOperands` structure.

`collapse` clause arguments are also moved into this new definition, as they
represent information on the loop nests being collapsed rather than the
`collapse` clause itself.
2024-07-29 11:29:48 +01:00
Sergio Afonso
fdfeea5bd6 [MLIR][OpenMP][Flang] Normalize clause arguments names (#99505)
Currently, there are some inconsistencies to how clause arguments are
named in the OpenMP dialect. Additionally, the clause operand structures
associated to them also diverge in certain cases. The purpose of this
patch is to normalize argument names across all `OpenMP_Clause` tablegen
definitions and clause operand structures.

This has the benefit of providing more consistent representations for
clauses in the dialect, but the main short-term advantage is that it
enables the development of an OpenMP-specific tablegen backend to
automatically generate the clause operand structures without breaking
dependent code.

The main re-naming decisions made in this patch are the following:
- Variadic arguments (i.e. multiple values) have the "_vars" suffix.
This and other similar suffixes are removed from array attribute
arguments.
- Individual required or optional value arguments do not have any suffix
added to them (e.g. "val", "var", "expr", ...), except for `if` which
would otherwise result in an invalid C++ variable name.
- The associated clause's name is prepended to argument names that don't
already contain it as part of its name. This avoids future collisions
between arguments named the same way on different clauses and adding
both clauses to the same operation.
- Privatization and reduction related arguments that contain lists of
symbols pointing to privatizer/reducer operations use the "_syms"
suffix. This removes the inconsistencies between the names for
"copyprivate_funcs", "[in]reductions", "privatizers", etc.
- General improvements to names, replacement of camel case for snake
case everywhere, etc.
- Renaming of operation-associated operand structures to use the
"Operands" suffix in place of "ClauseOps", to better differentiate
between clause operand structures and operation operand structures.
- Fields on clause operand structures are sorted according to the
tablegen definition of the same clause.

The assembly format for a few arguments is updated to better reflect the
clause they are associated with:
  - `chunk_size` -> `dist_schedule_chunk_size`
  - `grain_size` -> `grainsize`
  - `simd` -> `par_level_simd`
2024-07-29 10:56:45 +01:00
Tom Eccles
98e733eaf2 [flang][OpenMP] Initialize privatised derived type variables (#100417)
Fixes #91928
2024-07-25 16:53:27 +01:00
Tom Eccles
2e6558b8bc [flang][OpenMP] fix lastprivate for allocatables (#99686)
Don't use `copyHostAssociateVar` for allocatable variables. It isn't
clear to me whether or not this should be addressed in
`copyHostAssociateVar` instead of inside OpenMP. I opted for OpenMP
to minimise how many things I effected. `copyHostAssociateVar` will
not update the destination variable if the destination variable
was unallocated. This is incorrect because assignment inside of the
openmp block can cause the allocation status of the variable to
change. Furthermore, `copyHostAssociateVar` seems to only copy the
variable address not other metadata like the size of the allocation.
Reallocation by assignment could cause this to change.
2024-07-22 16:05:17 +01:00
David Truby
4b9fab5919 [flang][OpenMP] Implement lastprivate with collapse (#99500)
This patch enables the lastprivate clause to be used in the presence of
the collapse clause.

Note: the way we currently implement lastprivate means that this adds a
large number of compare instructions to the end of every iteration of
the loop. This is a clearly non-optimal thing to do, but lastprivate in
general will need re-implementing to prevent this. This is planned as
part of the delayed privatization work. This current implementation is
just a stop-gap measure as generating sub-optimal but working code is
better than crashing out.
2024-07-19 15:55:36 +01:00
Sergio Afonso
99f6ff9c0b [Flang][OpenMP] Use InsertionGuard in DataSharingProcessor (#97562)
This patch removes the introduction of `fir.undef` operations as a way
to keep track of insertion points inside of the `DataSharingProcessor`,
and it replaces them with an `InsertionGuard` to avoid creating such
operations inside of loop wrappers.

Leaving any `fir.undef` operation inside of a loop wrapper would result
in a verifier error, since they enforce strict requirements on the
contents of their code regions.
2024-07-04 13:13:21 +01:00
Kareem Ergawy
913a8244fe [flang][OpenMP] Lower target .. private(..) to omp.private ops (#94195)
Extends delayed privatization support to `taraget .. private(..)`. With
this PR, `private` is support for `target` **only** is delayed
privatization mode.
2024-06-07 14:44:01 +02:00
Krzysztof Parzyszek
8b18f2fe06 [flang][OpenMP] Add sym() member function to omp::Object (#94493)
The object identity requires more than just `Symbol`. Don't use `id()`
to get the Symbol associated with the object, becase the return value
will need to change. Instead use `sym()` which is added for that reason.
2024-06-05 13:38:28 -05:00
Kareem Ergawy
e1aa8ad6fa [flang][OpenMP] Fix bug in emitting dealloc logic (#93641)
Fixes a bug in emiting deacllocation logic when delayed privatization is
disabled. I introduced the bug when implementing delayed privatization
for allocatables: when delayed privatization is disabled the
deacllocation ops are emitted for only one allocatable variables.
2024-05-29 11:58:59 +02:00
Kareem Ergawy
6af4118f15 Reapply #91116 with fix (#93160)
This PR contains 2 commits:
1. A commit to reapply changes introduced #91116 (was reverted earlier
due to test suite failures)
2. A commit containing a possible solution for the issue causing the
test suite failures. In particular, it introduces a simple symbol
visitor class to keep track of the current active OMP construct and
marking this active construct as the scope defining the symbol being
visisted.
2024-05-27 14:26:52 +02:00
Kiran Chandramohan
7cee61c82f [Flang][OpenMP] Fix lastprivate store issue (#92777)
Fix an issue where the lastprivate variable type is different from the
type used for the index of the loop.

Fixes #79780
2024-05-21 10:48:52 +01:00
Muhammad Omair Javaid
85e1124049 Revert "[flang][OpenMP] Try to unify induction var privatization for OMP regions. (#91116)"
This reverts commit 2a97b507dc.

It has broken LLVM testsuite on various bots
https://lab.llvm.org/buildbot/#/builders/184/builds/12760
https://lab.llvm.org/buildbot/#/builders/197/builds/14376
https://lab.llvm.org/buildbot/#/builders/179/builds/10176
2024-05-21 06:51:30 +05:00
Kareem Ergawy
2a97b507dc [flang][OpenMP] Try to unify induction var privatization for OMP regions. (#91116) 2024-05-18 08:39:58 +02:00
Krzysztof Parzyszek
7a66e4209b [flang][OpenMP] Remove unnecessary Fortran:: qualification, NFC (#92298)
The `Fortran::` namespace is redundant for all parts of the code in this
PR, except for names of functions in their definitions.
2024-05-16 07:49:01 -05:00
Leandro Lupori
6542e5663d [flang][OpenMP] Move privatizations out of sections (#88191)
Besides duplicating code, privatizing variables in every section
causes problems when synchronization barriers are used. This
happens because each section is executed by a given thread, which
will cause the program to hang if not all running threads execute
the barrier operation.

Fixes https://github.com/llvm/llvm-project/issues/72824
2024-05-06 13:14:18 -03:00
Leandro Lupori
1e9625e595 [flang][OpenMP] Support tasks' implicit firstprivate DSA (#85989)
Handle implicit firstprivate DSAs on task generating constructs.

Fixes https://github.com/llvm/llvm-project/issues/64480
2024-05-06 08:15:52 -03:00
Kareem Ergawy
24f5fc77d4 [flang][MLIR][OpenMP] Extend delayed privatization for arrays and characters (#85023) 2024-05-04 21:20:17 +02:00
NimishMishra
37f6ba4fb2 [flang][OpenMP] Fix construct privatization in default clause (#72510)
Current implementation of default clause privatization incorrectly fails
to privatize in presence of non-OpenMP constructs (i.e. nested
constructs with regions whose symbols need to be privatized in the scope
of the parent OpenMP construct). This patch fixes the same by
considering non-OpenMP constructs separately by collecting symbols of a
nested region if it is a non-OpenMP construct with a region, and
privatizing it in the scope of the parent OpenMP construct.

Fixes https://github.com/llvm/llvm-project/issues/71914 and
https://github.com/llvm/llvm-project/issues/71915
2024-05-02 21:58:20 -07:00
Kareem Ergawy
0632cb38a6 [flang][MLIR] Outline deallocation logic to omp.private ops (#90592)
When delayed privatization is enabled, this PR emits the deallocation
logic to the newly introduced `dealloc` region on `omp.private` ops.
2024-05-01 06:21:30 +02:00
Kiran Chandramohan
5c969af66a [Flang][OpenMP] Skip default privatization of implied do indices (#89915)
The scope of these indices is limited to the implied-do and is mapped to
SSA values or registers and hence need not be privatized.

Fixes #87216
2024-04-26 11:21:34 +01:00
Sergio Afonso
ca4dbc2718 [Flang][OpenMP][Lower] Update workshare-loop lowering (5/5) (#89215)
This patch updates lowering from PFT to MLIR of workshare loops to
follow the loop wrapper approach. Unit tests impacted by this change are
also updated.

As the last patch of the stack, this should compile and pass unit tests.
2024-04-24 14:30:03 +01:00
Sergio Afonso
9dbf3e2384 [Flang][OpenMP] NFC: Simplify handling of insertion points (#89221)
This patch replaces some `saveInsertionPoint`, `restoreInsertionPoint`
call pairs for an `InsertionGuard` instance where it makes sense within
Flang OpenMP lowering to make further modifications less error-prone.
2024-04-19 16:13:10 +01:00