Age | Commit message (Collapse) | Author | Files | Lines |
|
Differential Revision: https://reviews.llvm.org/D135675
|
|
Differential Revision: https://reviews.llvm.org/D135684
|
|
This patch adds a cpowi function to the flang runtime, and switches
to using that function instead of pgmath for complex number to
integer power operations.
Differential Revision: https://reviews.llvm.org/D134889
|
|
The GNU extension intrinsic IARGC is equivalent to
COMMAND_ARGUMENT_COUNT, and the GETARG is similar to
GET_COMMAND_ARGUMENT, but with less arguments. Reuse the runtime of
COMMAND_ARGUMENT_COUNT and GET_COMMAND_ARGUMENT for IARGC and GETARG.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D133558
|
|
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D135570
|
|
According to the support of fir::ConvertOp conversion in CodeGen.cpp,
it also supports integer to pointer conversion and pointer to integer
conversion. The entity can be array, and the conversion type can be
pointer to array.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D135571
|
|
We used to have a big switch statement over the type categories and kinds
inside Minloc/Maxloc. After D133051 the switch grew bigger, and this
changed inlining decisions made by GCC (the build compiler). Some of the
simple methods stopped being inlined, and this caused slight performance
regression in Polyhedron/gas_dyn2. This change adds separate entries
for real/integer data types to let them be optimized separately.
Differential Revision: https://reviews.llvm.org/D135610
|
|
This patch updates the fir.convert operation's verifier to allow
conversion from !fir.box<!fir.type<T>> to !fir.class<!fir.type<T>>.
Other conversion involving fir.class are likely needed but will
be added when lowering needs them.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D135445
|
|
When the work on the Flang driver started, we created 2 test
directories:
* flang/test/Frontend/
* flang/test/Driver/
That was mostly done to model what Clang was doing. In practice, we
stopped using "flang/test/Frontend/" early on and most Flang driver
tests are currently located in "flang/test/Driver/". This patch moves
the remaining tests from the latter into the former directory.
This change also means that we can re-use test input files, i.e.
flang/test/Frontend/Inputs/hello-world.f90 can be replaced with
flang/test/Driver/Inputs/hello.f90. To this end, the affected test is
updated (multiple-input-files.f90).
Differential Revision: https://reviews.llvm.org/D130633
|
|
Use the ultimate symbol while calling the `IsAllocatableOrPointer`
function to ensure that the check works as expected for
host-associated symbols.
Fixes #58178
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D135443
|
|
Some operations are using `AnyRefOrBox` to specify the type of the
operands or attribute. This is the case for the `fir.coordinate_of`
operation. This patch updates the `AnyRefOrBox` to accept `BaseBoxType`
instead of only `BoxType`.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D135442
|
|
|
|
TARGET dummy arguments have fir.target attribute attached to them,
but globals do not have any sign of TARGET. This patch adds
target attribute for globals, which can be queried via
::fir::GlobalOp::getTarget().
Differential Revision: https://reviews.llvm.org/D135313
|
|
Don't return a hard .FALSE. when folding IS_CONTIGUOUS() unless the
subscript triplets are discontiguous and array section is nonempty,
or if the array section is nonempty and there is a vector subscript.
Differential Revision: https://reviews.llvm.org/D135334
|
|
|
|
A namelist input item that is a derived type component reference
needs additional processing when the base item or the component
is an array. When both have rank > 0, the component reference
must of course be subscripted.
(Fixes https://gitlab-master.nvidia.com/fortran/f18-stage/-/issues/999, NAG test t/tz2.)
|
|
A namelist input item that is a derived type component reference
needs additional processing when the base item or the component
is an array. When both have rank > 0, the component reference
must of course be subscripted.
Differential Revision: https://reviews.llvm.org/D135218
|
|
An error message in semantic analysis of SELECT TYPE type guards
doesn't allow for the possibility of failure from FindSourceLocation(),
and that can happen when the type guard is just an intrinsic type
name like "type is (character)". Deal with it.
Differential Revision: https://reviews.llvm.org/D135217
|
|
The parser combinator withMessage("error message"_err_en_US, PARSER) is meant
to run the parser PARSER and, if it fails, override its error messages if
it failed silently or it was unable to recognize any tokens at all. This
gives the parser a way to avoid emitting some confusing or missing error
messages. Unfortunately, the implementation could sometimes lose track of
whether any tokens had been recognized, leading to problems with outer usage
of withMessage() and also -- more seriously -- with ParseState::CombineFailedParses().
That's a utility that determines which error messages to retain when two
or more parsers have been attempted at the same starting point and none
of them succceed. Its policy is to retain the state from the parser that
consumed the most input text before failing, so long as it had recognized at
least one token.
So anyway, fix up withMessage(), adjust the tests, and add a test of the
original motivating confusing error situation, in which a syntax error in
a COMMON statement was being diagnosed as a problem with a statement function
definition because withMessage() had lost the fact that the parse of the
COMMON statement had recognized some tokens, and the last attempted parse
later was a failed attempt to parse a statement function.
Differential Revision: https://reviews.llvm.org/D135216
|
|
Ensure that the semantic error "An allocatable or pointer component
reference must be applied to a scalar base" is emitted with a source
code location.
Differential Revision: https://reviews.llvm.org/D135215
|
|
Summarize current understanding of Fortran's guarantees to a compiler
(or in other words, restrictions on programs and programmers)
about aliasing.
Differential Revision: https://reviews.llvm.org/D135214
|
|
Name resolution was mishandling cases of generic interfaces and specific procedures
(sometimes complicatd by use of the same name for each) when the specific procedure
was accessed by means of host association; only the scope of the generic interface
definition was searched for the specific procedure. Also search enclosing scopes
in the usual way.
Differential Revision: https://reviews.llvm.org/D135213
|
|
Remove custom parser/printer and make use of the assembly format
for the fir.dispatch operation.
Depends on D135358
Reviewed By: PeteSteinfeld, jeanPerier
Differential Revision: https://reviews.llvm.org/D135363
|
|
NAMELIST input processing in the runtime support library treats an
end-of-file found while searching for the initial '&' character
as an error condition, but it really should be distinguishable.
Call SignalEnd() rather than SignalError().
Differential Revision: https://reviews.llvm.org/D135212
|
|
valid targets
An ASSOCIATE or SELECT TYPE statement's selector whose "right-hand side" is the result
of a reference to a function that returns a pointer must be usable as a valid target
(but not as a pointer).
Differential Revision: https://reviews.llvm.org/D135211
|
|
When an I/O statement's UNIT= specifier is a variable that is a
function reference, parse tree rewriting may determine the wrong type
of the result because generic resolution has not yet been performed.
So move this bit of parse tree rewriting into I/O semantic
checking so that the right handling (integer -> external file unit
number, character pointer -> internal I/O) applies.
Differential Revision: https://reviews.llvm.org/D135210
|
|
Fortran strangely allows declarations to appear in procedure interface
definitions when those declarations do not contribute anything to the
characteristics of the procedure; in particular, one may declare local
variables that are neither dummy variables nor function results.
Such declarations "have no effect" on the semantics of the program,
and that should include semantic error checking for things like
special restrictions on PURE procedures.
Differential Revision: https://reviews.llvm.org/D135209
|
|
files
When a generic interface in a module shadows a procedure of the same name that
has been brought into scope via USE association, ensure that that USE association is
not lost when the module file is written.
Differential Revision: https://reviews.llvm.org/D135207
|
|
f18 emits an error message when the same name is used in a scope
for both a procedure and a generic interface, and the procedure is
not a specific procedure of the generic interface. It may be
questionable usage, and not portable, but it does not appear to
be non-conforming by a strict reading of the standard, and many
popular Fortran compilers accept it.
Differential Revision: https://reviews.llvm.org/D135205
|
|
The implementation of the folding code for SET_EXPONENT() was written
in such a fashion as to convert the I= actual argument value to a 32-bit
integer. Which is usually not a problem, but it's not always correct
and a test case ran into trouble with it. Fix to allow any kind of
INTEGER without conversion.
Differential Revision: https://reviews.llvm.org/D135203
|
|
Update the `fir.dispatch` operation to prepare
the lowering part. `nopass` and `pass_arg_pos` attributes
are added in the arguments list so accessors are generated
by MLIR tablegen. A verifier is added as well as some tests.
This patch is part of the implementation of the poltymorphic
entities.
https://github.com/llvm/llvm-project/blob/main/flang/docs/PolymorphicEntities.md
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D135358
|
|
Rather than crashing in llvm code, nip things in the bud.
Differential Revision: https://reviews.llvm.org/D135321
|
|
It is useful for couple of test suite like NAG to keep failing
with a TODO until the polymorphic entities is implemented all the
way done to codegen.
This pass adds a flag to LoweringOptions for experimental development.
This flag is off by default and can be enable in `bbc` with `-polymorphic-type`.
Options can be added in the driver and tco when needed.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D135283
|
|
nullptr matches both against ::mlir::UnitAttr and ::mlir::TypeRange,
so the following two candidates fit:
static void mlir::omp::OrderedRegionOp::build(::mlir::OpBuilder &odsBuilder,
::mlir::OperationState &odsState,
/*optional*/::mlir::UnitAttr simd)
static void mlir::omp::OrderedRegionOp::build(::mlir::OpBuilder &odsBuilder,
::mlir::OperationState &odsState,
::mlir::TypeRange resultTypes,
/*optional*/bool simd = false)
|
|
This reverts commit 43fe6f7cc35ded691bbc2fa844086d321e705d46.
Reverting this as CI breaks.
To reproduce, run check-flang, and it will fail with an error saying
.../lib/Bye.so not found in pass-plugin.f90
|
|
allocatable with runtime
Polymorphic and unlimited polymorphic entities should be handled by runtime. This patch
update the condition in `genDeallocate` to force polymorphic and unlimited polymorphic entities
to be deallocated through a runtime call and not inlined.
Depends on D135143
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D135144
|
|
This supports the lowering of private and firstprivate clauses in single
construct. The alloca ops are emitted in the entry block according to
https://llvm.org/docs/Frontend/PerformanceTips.html#use-of-allocas, and
the load/store ops are emitted in the single region. The data race
problem is handled in OMPIRBuilder. That is, the barrier is emitted in
OMPIRBuilder.
Co-authored-by: Nimish Mishra <neelam.nimish@gmail.com>
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D128596
|
|
functions
This patch update the fir::isUnlimitedPolymorphicType function
to reflect the chosen design. It adds also a fir::isPolymorphicType
function.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D135143
|
|
Add the -fpass-plugin option to flang which dynamically loads LLVM passes from the
shared object passed as the argument to the flag. The behavior of the option is
designed to replicate that of the same option in clang and thus has the same
capabilities and limitations.
- Multiple instances of -fpass-plugin=path-to-file can be specified and each of the
files will be loaded in that order.
- The flag can be passed to both flang-new and flang-new -fc1.
Differential Revision: https://reviews.llvm.org/D129156
|
|
This option allows running only CodeGen passes and then translating
FIR to LLVM IR. I am using it to fetch optimized FIR after bbc,
hand-modify it and then produce LLVM IR that can be fed to clang.
|
|
This patch lowers `TYPE(*)` correctly to fir.box<none>.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D135141
|
|
This patch updates lowering to produce the correct fir.class types for
various polymorphic and unlimited polymoprhic entities cases. This is only the
lowering. Some TODOs have been added to the CodeGen part to avoid errors since
this part still need to be updated as well.
The fir.class<*> representation for unlimited polymorphic entities mentioned in
the document has been updated to fir.class<none> to avoid useless work in pretty
parse/printer.
This patch is part of the implementation of the poltymorphic
entities.
https://github.com/llvm/llvm-project/blob/main/flang/docs/PolymorphicEntities.md
Depends on D134957
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D134959
|
|
Previously, AggregateStores were created for aggregates associated with common
blocks. As a) AggregateStoreMap uses scope and offset information to search for
aggregate stores and b) variables related to common blocks have their
offsets set relative to the common block itself, if there were multiple
equivalences and at least one involved variables defined in a common block there
was an opportunity for the scope/offset pairs to match between distinct
aggregate stores. As a result, entries in AggregateStoreMap could collide,
resulting in incorrect stores being returned for a particular variable.
To prevent these collisions, skip creating AggregateStores for aggregates which
are associated with common blocks. This information was already unused as
aggregates associated with common blocks are handled by instantiateCommon.
Fixes https://github.com/llvm/llvm-project/issues/57749
Differential Revision: https://reviews.llvm.org/D134828
|
|
Reviewed By: ktras
Differential Revision: https://reviews.llvm.org/D134205
|
|
As described in Issue #57642, `flang` currently lacks SPARC support in
`Optimizer/CodeGen/Target.cpp`, which causes a considerable number of tests
to `FAIL` with
error: flang/lib/Optimizer/CodeGen/Target.cpp:310: not yet implemented:
target not implemented
This patch fixes this by following GCC`s documentation of the ABI described
in the Issue.
Tested on `sparcv9-sun-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D133561
|
|
For TRIM and REPEAT calls, semantics was creating ProcedureDesignators
using the length parameter of the arguments. This caused bugs when
folding LEN(TRIM(char_explicit_constant_length)). The same did not
appeared in folding for REPEAT because it is rewritten at a higher
level to LEN(c)*N.
This is not only a folding issue since any place (like lowering) may
try to use the bad length parameter from the created ProcedureDesignator.
Update intrinsic resolution to not copy the length parameter for TRIM
and REPEAT.
Differential Revision: https://reviews.llvm.org/D134970
|
|
The raw accessor is going away soon so switch to prefixed accessors in the
fircg dialect. The main dialect was switched some months ago.
https://github.com/llvm/llvm-project/issues/58090
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D135061
|
|
The real(10) is supported on x86_64. On aarch64, the value of
selected_real_kind(16) should be 16 rather than 10 since real(10)
is not supported on x86_64. Previously, the real type support check
is not target dependent. Support it now through the target triple
information.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D134021
|
|
Introduce a new ClassType for polymorphic
entities. A fir.class type is similar to a fir.box type in
many ways and is also base on the BaseBoxType.
This patch is part of the implementation of the poltymorphic
entities.
https://github.com/llvm/llvm-project/blob/main/flang/docs/PolymorphicEntities.md
Depends on D134956
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D134957
|
|
Introduce a BaseBoxType to be used by BoxType and
the a new ClassType that is introduced in a follow up patch.
This patch is part of the implementation of the poltymorphic
entities.
https://github.com/llvm/llvm-project/blob/main/flang/docs/PolymorphicEntities.md
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D134956
|