| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
Apply the check for the constraint `C1172` to `unlock-stmt`,
`change-team-stmt`, `end-team-stmt`, and `critical-stmt`, which
all have `sync-stat-lists` and so `C1172` applies to them. Add
a test to check the `sync-stat-lists` for these 4 statements.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D150745
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Generate supporting data structures and calls to new runtime IO functions
for defined IO that accesses non-type-bound procedures, such as `wft` in:
module m1
type t
integer n
end type
interface write(formatted)
module procedure wft
end interface
contains
subroutine wft(dtv, unit, iotype, v_list, iostat, iomsg)
class(t), intent(in) :: dtv
integer, intent(in) :: unit
character(*), intent(in) :: iotype
integer, intent(in) :: v_list(:)
integer, intent(out) :: iostat
character(*), intent(inout) :: iomsg
iostat = 0
write(unit,*,iostat=iostat,iomsg=iomsg) 'wft was called: ', dtv%n
end subroutine
end module
module m2
contains
subroutine test1
use m1
print *, 'test1, should call wft: ', t(1)
end subroutine
subroutine test2
use m1, only: t
print *, 'test2, should not call wft: ', t(2)
end subroutine
end module
use m1
use m2
call test1
call test2
print *, 'main, should call wft: ', t(3)
end
|
|
|
|
|
|
|
|
|
| |
Symbols corresponding to entries returning character results
must be mapped to EmboxCharOp, first, before we can map them
to DeclareOp. The code may be reworked after HLFIR is enabled
by default, but right now it seems like an acceptable solution to me.
Differential Revision: https://reviews.llvm.org/D150749
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The lowering of hlfir.forall to loops (and later hlfir.where) requires
doing a data dependency analysis to avoid creating temporary storage for
every control/mask/rhs/lhs expressions.
The added code implements a data dependency analysis for the hlfir
ordered assignment trees (it is not specific to Forall since these nodes
includes Where, user defined assignments, and assignment to vector
subscripted entities, but the added code is only plugged and tested
with hlfir.forall in this patch).
This data dependency analysis returns a "schedule", which is a list of
runs containing actions. Each runs will result in a single loop nest
evaluating all its action "at the same time" inside the loop body.
Actions may either evaluating an assignment, or saving some expression
evaluation (the value yielded inside the ordered assignment hlfir operations)
in a temporary storage before doing the assignment that requires this
expression value but may "conflict" with it.
A "conflict" is a read in an expression E to a variable that is, or may
be (analysis is conservative), written by an assignment that depends on
E.
The analysis is based on MLIR SideEffectInterface and fir AliasAnalysis
which makes it generic.
For now, the codegen that will apply the schedule and rewrite the
hlfir.forall into a set of loops is not implemented, but the scheduling
is tested on its own (from Fortran, because it allows testing many cases
in very readable fashions).
The current scheduling has limitations, for instance
"forall(i=1, 10) x(i)=2*x(i)" does not require saving the RHS values for
all "i" before doing the assignments since the RHS does not depend
on values computed during previous iterations. Any user call will also
trigger a conservative assumption that there is a conflict. Finally,
a lot of operations are missing memory effect interfaces (especially
in HLFIR). This patch adds a few so that it can be tested, but more
will be added in later patches.
Differential Revision: https://reviews.llvm.org/D150455
|
|
|
|
|
|
|
|
|
|
|
| |
Fortran doesn't allow inaccessible procedure bindings to be
overridden, and this needs to apply to generic resolution.
When resolving a type-bound generic procedure from another
module, ensure only that the most extended override from its
module is used if it is PRIVATE, not a later apparent override
from another module.
Differential Revision: https://reviews.llvm.org/D150721
|
|
|
|
|
|
|
|
|
| |
Incorrect error messages were issuing for symbol table entries
with the CONTIGUOUS attribute that didn't deserve them, like
host association symbols. Put the CONTIGUOUS check into
CheckObjectEntity().
Differential Revision: https://reviews.llvm.org/D150712
|
|
|
|
|
|
|
|
|
|
|
| |
Establish a set of optional usage warnings, and enable some
only in "-pedantic" mode that, in our subjective experience
with application codes, seem to issue frequently without
indicating usage that really needs to be corrected. By default,
with this patch the compiler should appear to be somewhat less
persnickety but not less informative.
Differential Revision: https://reviews.llvm.org/D150710
|
|
|
|
|
|
|
|
|
|
|
| |
In the CoarrayChecker, add checks for the constraints C1177 and
C1178 for event-wait-stmt. Add event-post-stmt to the check
for the constraints for sync-stat-list. Add a check for the
constraint C1176 on event-variable.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D137204
|
|
|
|
| |
This reverts commit 9725c740fbe7841a7aed57ca35f83d28aac1814c.
|
|
|
|
|
|
|
|
|
|
| |
test.
Missed adding this check in previous commit so adding it through separate commit.
Reviewed By: raghavendhra
Differential Revision: https://reviews.llvm.org/D150626
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The right-hand sides of assignment statements are always expressions,
never variables. When an assignment statement is converted into a call
to a defined assignment subroutine, and the actual argument being associated
with the second dummy argument is a variable, and the dummy argument does
not have the VALUE attribute, wrap it with parentheses so that lowering
will pass it by means of a temporary.
Fixes https://github.com/llvm/llvm-project/issues/62599.
Differential Revision: https://reviews.llvm.org/D150331
|
|
|
|
|
|
|
|
|
|
|
| |
Apply the default PUBLIC/PRIVATE accessibility of a module to its symbols
a second time after it is known that all symbols, including implicitly typed
names from NAMELIST groups and specification expressions in module subprograms,
have been created in its scope.
Fixes https://github.com/llvm/llvm-project/issues/62598.
Differential Revision: https://reviews.llvm.org/D150307
|
|
|
|
|
|
|
|
|
|
|
| |
(bug #58732)
After tokenizing an identifier, don't allow the next token to be a
Hollerith literal.
Fixes https://github.com/llvm/llvm-project/issues/58732.
Differential Revision: https://reviews.llvm.org/D150406
|
|
|
|
|
|
|
| |
The two constants should be equal only if their derived types
are the same. This fixes regression caused by D150380.
Differential Revision: https://reviews.llvm.org/D150634
|
|
|
|
|
|
|
|
|
|
|
| |
In the CoarrayChecker, add checks for the constraints C1177 and
C1178 for event-wait-stmt. Add event-post-stmt to the check
for the constraints for sync-stat-list. Add a check for the
constraint C1176 on event-variable.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D137204
|
|
|
|
|
|
|
|
|
|
| |
Lower host_data construct to the acc.host_data operation.
Depends on D150289
Reviewed By: razvanlupusoru, jeanPerier
Differential Revision: https://reviews.llvm.org/D150290
|
|
|
|
|
|
| |
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D150502
|
|
|
|
|
|
| |
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D150501
|
|
|
|
|
|
| |
Depends on: D150272
Differential Revision: https://reviews.llvm.org/D150451
|
|
|
|
|
|
|
|
| |
Carries out the lowering of the any intrinsic into HLFIR
Depends on: D149964
Differential Revision: https://reviews.llvm.org/D150272
|
|
|
|
|
|
|
| |
Adds a HLFIR operation for the ANY intrinsic according to the
design set out in flang/docs/HighLevel.md
Differential Revision: https://reviews.llvm.org/D149964
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The global names were created using a hash based on the address
of std::vector::data address. Since the memory may be reused
by different std::vector's, this may cause non-equivalent
constant expressions to map to the same name. This is what is happening
in the modified flang/test/Lower/constant-literal-mangling.f90 test.
I changed the name creation to use a map between the constant expressions
and corresponding unique names. The uniquing is done using a name counter
in FirConverter. The effect of this change is that the equivalent
constant expressions are now mapped to the same global, and the naming
is "stable" (i.e. it does not change from compilation to compilation).
Though, the issue is not HLFIR specific it was affecting several tests
when using HLFIR lowering.
Differential Revision: https://reviews.llvm.org/D150380
|
|
|
|
|
|
| |
The codegen tried to fir.convert !fir.box to !fir.ref for this case.
I used BoxAddr under a check for the type mismatch, but I am not sure
if this is the right fix. Maybe it has to be handled in the lowering.
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D150393
|
|
|
|
|
|
|
|
|
|
| |
Instead of calling _FortranASizeDim, we can instead load extent
directly from descriptor. Add this support for cases where dim
is a known constant at compile time.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D150385
|
|
|
|
|
|
|
|
|
| |
The bufferization pass must create the tuple for these operations, because
the users may require it. For example, in case of ElementalOp inlining
a DestroyOp may be generated for the operand of YieldElementOp, and
the operand may be ApplyOp->NoReassocOp chain.
Differential Revision: https://reviews.llvm.org/D150343
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Windows, global string literals with "linkonce" linkage is not
supported without using comdat. As a simpler fix than adding comdat
support we can use internal linkage instead.
This fixes a bug where two string literals with the same value in
different fortran files would cause a linker error due to the use
of linkonce linkage.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D149859
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently complex division is lowered to a fir.divc operation and the
fir.divc is later converted to a sequence of llvm operations to perform
complex division, however this causes issues for extreme values when
the calculations overflow.
This patch changes the lowering of complex division to use the Intrinsic
Call functionality to lower into library calls (for single, double,
extended and quad precisions) or an MLIR complex dialect division operation
(for half and bfloat precisions).
A new wrapper function `genLibSplitComplexArgsCall` is written to handle
the case of the arguments of the Complex Library calls being split to
its real and imaginary real components.
Note 1: If the Complex To Standard conversion of division operation
matures then we can use it for all precisions. Currently it has the
same issues as the conversion of fir.divc.
Note 2: A previous patch (D145808) did the same but during conversion of
the fir.divc operation. But using function calls at that stage leads to
ABI issues since the conversion to LLVM is not aware of the complex target
rewrite.
Note 3: If the patch is accepted, fir.divc can be removed from FIR. We
can use the complex.div operation where any transformation is required.
Reviewed By: vzakhari, PeteSteinfeld, DavidTruby, jeanPerier
Differential Revision: https://reviews.llvm.org/D149546
|
|
|
|
|
|
|
|
| |
on OMP TARGET DATA directive.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D149815
|
|
|
|
|
|
|
|
| |
OpenMP 5.2 introduces a Fortran specific construct that aims to replace the executable allocate directive. This patch seeks to add parser support for the directive as well as the allocator clause with the [[ https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5-2.pdf#section.6.6 | extended align/complex ]] modifier.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D149727
|
|
|
|
|
|
|
|
|
|
|
| |
The order of operand in clauses that are decomposed was not
preserved. This patch change how operands are handled and preserve
the user ordering for the entry data operation on the acc.parallel
operation.
Reviewed By: vzakhari
Differential Revision: https://reviews.llvm.org/D150214
|
|
|
|
|
|
|
|
|
|
|
| |
The order of operand in clauses that are decomposed was not
preserved. This patch change how operands are handled and preserve
the user ordering for the entry data operation on the acc.data
operation.
Reviewed By: vzakhari
Differential Revision: https://reviews.llvm.org/D150213
|
|
|
|
|
|
|
|
|
|
|
| |
Remove old clause operands from acc.parallel operation since
the new dataOperands is now in place.
private, firstprivate and reductions will receive some redesign but are
not part of the new dataOperands.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150207
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The lowerbound was not correctly normalized to 0 when the bound
are generated for an array without subscripts.
```
integer :: a(11:20)
!$acc enter data create(a)
```
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150208
|
|
|
|
|
|
|
|
|
| |
The implied-do index value has 'index' type, and it has to be
converted to the original ac-do-variable's data type.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D150150
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since the new data operand operations have been added in D148389 and
adopted on acc.data in D149673, the old clause operands are no longer
needed.
The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.
processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150155
|
|
|
|
| |
This reverts commit 626aa8518d873c5760cd033fe49b1809c9de3494.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The lowerbound was not correctly normalized to 0 when the bound
are generated for an array without subscripts.
```
integer :: a(11:20)
!$acc enter data create(a)
```
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150208
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since the new data operand operations have been added in D148389 and
adopted on acc.exit_data in D149601, the old clause operands are no longer
needed.
The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.
processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D150145
|
|
|
|
|
|
|
|
|
| |
Self clause is the same same as the host clause. Lower it
in a simmilar way.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150174
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follow up of https://reviews.llvm.org/D149979 for lowering.
In Fortran, it is possible to assign a pointer to another pointer
with an undefined association status.
When using the runtime do to none trivial pointer association, if the
descriptor are garbage, the runtime cannot safely detect that it has
a garbage descriptor, and it cannot safely know the descriptor size
leading to undefined behavior.
Another reason to initialize descriptor of pointers is to record any
non deferred length parameter value.
Hence, although this is not required by Fortran, f18 always initialize
pointers to NULL().
This was already done in lowering for whole pointer object, but not for
pointer components.
This patch uses the related semantics patch that updated
derivedTypeSpe::HasDefaultInitialization to ensure pointer components
of local and global object are always initialized.
It adds tests to ensure that allocation of such derived type uses the
runtime to ensure the storage is initialized, and that structure
constructors are setting the descriptor component to NULL() if no
initial target is given.
Differential Revision: https://reviews.llvm.org/D150180
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since the new data operand operations have been added in D148389 and
adopted on acc.enter_data in D148721, the old clause operands are no longer
needed.
The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.
processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D150132
|
|
|
|
|
|
|
|
|
|
|
| |
The `if_present` clause is modeled as an attribute on the
acc.update operation. The lowering was not adding correctly the attribute
when the clause was present. This patch update the lowering to add
the attribute when needed.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150171
|
|
|
|
|
|
|
|
|
|
| |
This patch lowers assignments to vector subscripted designators into the
newly added hlfir.elemental_addr and hlfir.region_assign.
Note that the codegen of these operation to FIR is still TODO and will
still emit a TODO message when trying to compile programs end to end.
Differential Revision: https://reviews.llvm.org/D149962
|
|
|
|
|
|
|
| |
Lower WHERE to the newly added hlfir.where and hlfir.elsewhere
operations.
Differential Revision: https://reviews.llvm.org/D149950
|
|
|
|
|
|
|
|
|
|
|
| |
Lower Forall to the previously added hlfir.forall, hlfir.forall_mask.
hlfir.forall_index, and hlfir.region_assign operations.
The HLFIR assignment code lowering is moved into genDataAssignment for
more readability and so that user defined assignment (still a TODO),
will be able to share most of the logic.
Differential Revision: https://reviews.llvm.org/D149878
|
|
|
|
|
|
|
|
|
| |
This fixes LEN inquiry on array constructors where the length
expression includes references to the ac-do-variable.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D150149
|
|
|
|
|
|
|
| |
Make __builtin_c_loc() into an intrinsic function and verify the
special semantic requirements on its actual arguments.
Differential Revision: https://reviews.llvm.org/D149988
|
|
|
|
|
|
|
|
| |
Code in Evaluate/type.cpp was maintaining a very old assumption that
procedure pointers would need to be represented as descriptors. This
is not the case -- they are code or thunk addresses.
Differential Revision: https://reviews.llvm.org/D149984
|