Commit Graph

424686 Commits

Author SHA1 Message Date
Amy Kwan 0bf3c38b0b Fix build failure revealed by c35ca3a1c7
This commit resolves a Linux kernel build failure that was revealed by
c35ca3a1c7. The patch introduces two new
intrinsics, which ultimately changes the intrinsic numbering of other PPC
intrinsics. This causes an issue introduced by
ff40fb07ad, as the patch checks for intrinsics
with particular values, but the addition of the fnabs/fnabss intrinsics updates
the original sqrt/sdiv intrinsic values.
2022-05-24 16:32:04 -05:00
Peter Klausler cdd54cbdd9 [flang][runtime] Catch decimal integer input overflow
B/O/Z input overflow is already caught, and real input overflow
is signalled as an IEEE arithmetic exception, but regular decimal
integer overflow was silent.

Differential Revision: https://reviews.llvm.org/D126155
2022-05-24 14:07:35 -07:00
Peter Klausler 0a79113b9e [flang] Replace crash and improve a semantics TODO message
The derived type information table construction code had a
crash whose root cause was replacing an expression with one
of its operands -- the deletion of the LHS of that assignment
led to the RHS being invalidated before it could be read.
Fix by cloning the RHS.  Also update a TODO message to the
new "_todo_en_US" message class and add a comment about how
it should be resolved.

Differential Revision: https://reviews.llvm.org/D126154
2022-05-24 14:01:22 -07:00
Peter Klausler d52a6e75b0 [flang] Process subprogram BIND(C,NAME=...) locally
The scalar-default-character-expression that defines the interoperable
name of a function or subroutine (or interface) must have its names
resolved within the context of the subprogram, despite its appearance
on a function-stmt or a subroutine-stmt.  Failure to do so can lead
to bogus errors or to incorrect results.

The solution is to defer name resolution for function-stmt suffixes
(but not entry-stmt suffixes) and for subroutine-stmt language binding
specifications to EndSubprogram().  (Their resolution only need to be
deferred to the end of the specification part, but it's cleanest to
deal with it in EndSubprogram().)

Differential Revision: https://reviews.llvm.org/D126153
2022-05-24 14:00:20 -07:00
Yitzhak Mandelbaum 2f93bbb9cd [clang][dataflow] Relax `Environment` comparison operation.
Ignore `MemberLocToStruct` in environment comparison. As an ancillary data
structure, including it is redundant. We also can generate environments which
differ in their `MemberLocToStruct` but are otherwise equivalent.

Differential Revision: https://reviews.llvm.org/D126314
2022-05-24 20:58:18 +00:00
Peter Klausler dcf9ba82d9 [flang] Fix false error for multiple defined I/O subroutines
User-defined derived type I/O subroutines need to be unique for
a given type and operation in any scope, but it is acceptable
to have more than one defined I/O subroutine so long as only one
of them is visible.

Differential Revision: https://reviews.llvm.org/D126152
2022-05-24 13:46:42 -07:00
Peter Klausler 48a8a3eb2f [flang] Accept defined assignment with CLASS(*) RHS
A utility predicate in semantics was incorrectly determining that
an INTERFACE ASSIGNMENT(=) (or other form of generic) could not have
a specific procedure with an unlimited polymorphic second argument.
This led to a crash later in expression analysis.  Fix, and
extend tests.

Differential Revision: https://reviews.llvm.org/D126151
2022-05-24 13:41:28 -07:00
Peter Klausler bd92bca535 [flang] Fix purity testing for generic calls
The purity or impurity of a call to a generic interface
depends on the attributes of the specific procedure or specific
binding.  Change expression analysis of calls to generic interfaces
to replace the symbol in the parse tree with the specific procedure
or binding; this ensures that later checking for purity in
DO CONCURRENT and other contexts will be accurate.

Remove an "XFAIL" from a test that now passes again with this fix.

Differential Revision: https://reviews.llvm.org/D126150
2022-05-24 13:40:25 -07:00
Alex Lorenz 1b34f1e996 [clang][test] mark tests added in ee8524087c as unsupported on AIX
These tests are failing on the PPC64 AIX CI bot, but it's unclear why,
as they pass on other CI jobs.
I marked them as unsupported on AIX for now while investigating the failure.
2022-05-24 13:39:37 -07:00
Peter Klausler cd2a8df891 [flang] Don't prematurely resolve subprogram names
Name resolution for subprograms checks whether the name is already
present in the enclosing scope as a generic interface, so that the
case of a generic with the same name as one of its specifics can be
handled.  The particular means by which the enclosing scope is searched
for the name would resolve the name (bind a symbol to it) as a side
effect.  This turns out to be the wrong thing to do when the subprogram
is going to have its symbol created in another scope to cope with its
BIND(C,NAME="name") name, and its Fortran name is already present in the
enclosing scope for a subprogram of the same name but without
BIND(C,NAME="name").

A very long explanation for a one-line fix, sorry.  In short, change
the code to look up the name but not resolve it at that point.

Differential Revision: https://reviews.llvm.org/D126149
2022-05-24 13:34:58 -07:00
Yitzhak Mandelbaum 6eb9e0f5eb [clang][dataflow] Make limit on fixpoint-algorithm iterations proportional to size of CFG.
Currently, the maximum number of iterations of the loop for finding the fixpoint
of the dataflow analysis is set at 2^16. When things go wrong in an analysis,
this can be far too large.  This patch changes the limit to be proportional to
the size of the CFG, which will generally be far smaller than 2^16 (while still
maintaining 2^16 as the absolute limit).

Differential Revision: https://reviews.llvm.org/D126316
2022-05-24 20:13:55 +00:00
Mariusz Borsa 8246b2e156 [Sanitizers][Darwin] Replace SANITIZER_MAC with SANITIZER_APPLE in source files
This is a follow up to [Sanitizers][Darwin] Rename Apple macro SANITIZER_MAC -> SANITIZER_APPLE (D125816)

Performed a global search/replace as in title against LLVM sources

Differential Revision: https://reviews.llvm.org/D126263
2022-05-24 12:59:27 -07:00
Peter Klausler c428620913 [flang] Catch calls to assumed-length character functions
Semantics was allowing calls to CHARACTER(*) functions, which are odd
things -- they can be declared, and passed around, but can never actually
be called as such.  They must be redeclared with an explicit length that
ends up being passed as a hidden argument.  So check for these calls
and diagnose them, add tests, and clean up some existing tests that
were in error and now get caught.

Possible TODO for lowering: there were some test cases that used
bad calls to assumed-length CHARACTER*(*) functions and validated
their implementations.  I've removed some, and adjusted another,
but the code that somehow implemented these calls may need to be
removed and replaced with an assert about bad semantics.

Differential Revision: https://reviews.llvm.org/D126148
2022-05-24 12:53:32 -07:00
Vasileios Porpodas 9df0568b07 [SLP] Fix crash caused by reorderBottomToTop().
The crash is caused by incorrect order set by reorderBottomToTop(), which
happens when it is reordering a TreeEntry which has a user that has already been
reordered earlier. Please see the detailed description in the lit test.

Differential Revision: https://reviews.llvm.org/D126099
2022-05-24 12:24:19 -07:00
Sanjay Patel 05527b68a0 [InstCombine] fold more shuffles with FP<->Int cast operands
shuffle (cast X), (cast Y), Mask --> cast (shuffle X, Y, Mask)

This extends the transform added with 0353c2c996.

If the shuffle reduces vector length, the transform
reduces the width of the cast, so that should be a
win for most codegen (if not, it can be inverted).
2022-05-24 15:11:38 -04:00
Leonard Chan 6edbdf80ca Revert "[compiler-rt][scudo] Add missing preprocessor token" and "[compiler-rt][scudo] Simplify TBI checks"
This reverts commit 676eaa2ca9
and f6038cdca0 since builders are still
broken.
2022-05-24 11:30:31 -07:00
Leonard Chan 676eaa2ca9 [compiler-rt][scudo] Add missing preprocessor token
This should fix build errors seen on bots like
https://lab.llvm.org/buildbot/#/builders/57/builds/18263.
2022-05-24 11:12:30 -07:00
Sotiris Apostolakis 67be40df6e Recommit "[SelectOpti][5/5] Optimize select-to-branch transformation"
Use container::size_type directly to avoid type mismatch causing build failures in Windows.

Original commit message:
This patch optimizes the transformation of selects to a branch when the heuristics deemed it profitable.
It aggressively sinks eligible instructions to the newly created true/false blocks to prevent their
execution on the common path and interleaves dependence slices to maximize ILP.

Depends on D120232

Reviewed By: davidxl

Differential Revision: https://reviews.llvm.org/D120233
2022-05-24 14:08:09 -04:00
Peter Klausler 03095bd97b [flang] Fix crash in semantics after PDT instantiation
The code in semantics that reinitializes symbol table pointers in
the parse tree of a parameterized derived type prior to a new
instantiation of the type was processing the symbols of the
derived type instantiation scope in arbitrary address order,
which could fail if a reference to a type parameter inherited from
an ancestor type was processed prior to the parent component sequence.
Fix by instantiating components of PDT instantiations in declaration
order.

Differential Revision: https://reviews.llvm.org/D126147
2022-05-24 11:06:12 -07:00
V Donaldson 1e1f60c605 [flang] Alternate entry points with unused arguments
A dummy argument in an entry point of a subprogram with multiple
entry points need not be defined in other entry points. It is only
legal to reference such an argument when calling an entry point that
does have a definition. An entry point without such a definition
needs a local "substitute" definition sufficient to generate code.
It is nonconformant to reference such a definition at runtime.
Most such definitions and associated code will be deleted as dead
code at compile time. However, that is not always possible, as in
the following code. This code is conformant if all calls to entry
point ss set m=3, and all calls to entry point ee set n=3.

subroutine ss(a, b, m, d, k) ! no x, y, n
  integer :: a(m), b(a(m)), m, d(k)
  integer :: x(n), y(x(n)), n
  integer :: k
1 print*, m, k
  print*, a
  print*, b
  print*, d
  if (m == 3) return
entry ee(x, y, n, d, k) ! no a, b, m
  print*, n, k
  print*, x
  print*, y
  print*, d
  if (n /= 3) goto 1
end

  integer :: xx(3), yy(5), zz(3)
  xx = 5
  yy = 7
  zz = 9
  call ss(xx, yy, 3, zz, 3)
  call ss(xx, yy, 3, zz, 3)
end

Lowering currently generates fir::UndefOp's for all unused arguments.
This is usually ok, but cases such as the one here incorrectly access
unused UndefOp arguments for m and n from an entry point that doesn't
have a proper definition.

The problem is addressed by creating a more complete definition of an
unused argument in most cases. This is implemented in large part by
moving the definition of an unused argument from mapDummiesAndResults
to mapSymbolAttributes. The code in mapSymbolAttributes then chooses
one of three code generation options, depending on information
available there.

This patch deals with dummy procedures in alternate entries, and adds
a TODO for procedure pointers (the PFTBuilder is modified to analyze
procedure pointer symbol so that they are not silently ignored, and
instead hits proper TODOs).

BoxAnalyzer is also changed because assumed-sized arrays were wrongfully
categorized as constant shape arrays.  This had no impact, except when
there were unused entry points.

Co-authored-by: jeanPerier <jperier@nvidia.com>

Differential Revision: https://reviews.llvm.org/D125867
2022-05-24 10:56:04 -07:00
Stanislav Mekhanoshin 26c4cf2391 [AMDGPU] Disable newly added gfx90a global isel image tests. NFC.
This fixed build failure with expensive checks after D126009.
The change has added new run lines for Global ISel which has
uncovered a pre-existing problem: it does not select a correct
flavor of these image instructions.
2022-05-24 10:53:55 -07:00
Leonard Chan f6038cdca0 [compiler-rt][scudo] Simplify TBI checks
Differential Revision: https://reviews.llvm.org/D111080
2022-05-24 10:53:09 -07:00
Saleem Abdulrasool b159108bc5 Sema: adjust assertion to account for deduced types
Previous changes for the BTF attributes introduced a new sub-tree
visitation.  That uncovered that when accessing the typespec location we
would assert that the type specification is either a type declaration or
`typename`.  However, `typename` was explicitly permitted.  This change
predates the introduction of newer deduced type representations such as
`__underlying_type` from C++ and the addition of the GNU `__typeof__`
expression.

Thanks to aaron.ballman for the valuable discussion and pointer to
`isTypeRep`.

Differential Revision: https://reviews.llvm.org/D126093
Reviewed By: aaron.ballman, yonghong-song
2022-05-24 17:49:44 +00:00
Joseph Huber 3723868d9e [OpenMP] Fix file arguments for embedding bitcode in the linker wrapper
Summary:
The linker wrapper supports embedding bitcode images instead of linked
device images to facilitate JIT in the device runtime. However, we were
incorrectly passing in the file twice when this option was set. This
patch makes sure we only use the intermediate result of the LTO pass and
don't add the final output to the full job.

In the future we will want to add both of these andle handle that
accoridngly to allow the runtime to either use the AoT compiled version
or JIT compile the bitcode version if availible.
2022-05-24 13:45:52 -04:00
Mike Rice 9ba937112f [OpenMP] Add parsing/sema support for omp_all_memory reserved locator
Adds support for the reserved locator 'omp_all_memory' for use
in depend clauses with 'out' or 'inout' dependence-types.

Differential Revision: https://reviews.llvm.org/D125828
2022-05-24 10:28:59 -07:00
Peter Klausler 8527f9e443 [flang][runtime] Handle BACKSPACE after reading past EOF
An external READ(END=) that hits the end of the file must
also note the virtual position of the endfile record that
has just been discovered, so that a later BACKSPACE statement
won't end up at the wrong record.

Differential Revision: https://reviews.llvm.org/D126146
2022-05-24 10:27:50 -07:00
Leonard Chan c8644ea88e [compiler-rt][lsan] Update CanBeAHeapPointer for AArch64
While attempting to get the 64-bit lsan allocator working for Fuchsia, I
noticed this function would incorrectly return false for pointers returned
by the 64-bit allocator. On AArch64, this function attempts to get the VMA
size dynamically by counting the number of leading zeros from the function
frame address. This will fail if the frame address is significantly below an
allocated pointer (that is, the frame address has more leading zeros than an
allocated pointer). This is possible on Fuchsia and linux (when not called
from the initial thread stack).

It seems the intended use of this function is to speed up pointer scanning by
filtering out addresses that user code might not be able to access. Other
platforms this check is done on seem to hardcode the VMA size/shift, so it
seems appropriate to do this for aarch64 as well. This implies pointers on
aarch64 where the VMA size is <64 will pass through, but bad pointers will
still be caught by subsequent scan checks.

This patch also renames the function to something more fitting of what it's
trying to do.

Differential Revision: https://reviews.llvm.org/D123814
2022-05-24 10:22:46 -07:00
Nathan Ridge 175833ed6f [clangd] Handle '--' in QueryDriverDatabase
Fixes https://github.com/clangd/clangd/issues/1100,
a regression from D116721.

Differential Revision: https://reviews.llvm.org/D126274
2022-05-24 13:10:41 -04:00
Paul Robinson 4a3e2aff5f Reland "[PS5] Verify defaults to -fno-stack-size-section"
This reverts commit efebb27b74.
Fixes typos (accidentally omitted %s from some RUN lines).
2022-05-24 10:09:39 -07:00
Stanislav Mekhanoshin 5df6669d45 [AMDGPU] Enforce alignment of image vaddr on gfx90a
Even though single address image instructions only use a single VGPR
HW accesses 4 or 5 which creates alignment requirement.

Fixes: SWDEV-316648

Differential Revision: https://reviews.llvm.org/D126009
2022-05-24 10:05:39 -07:00
Alex Lorenz ee8524087c [libclang] add supporting for indexing/visiting C++ concepts
This commit builds upon recently added indexing support for C++ concepts
from https://reviews.llvm.org/D124441 by extending libclang to
support indexing and visiting concepts, constraints and requires
expressions as well.

Differential Revision: https://reviews.llvm.org/D126031
2022-05-24 10:02:53 -07:00
Paul Robinson efebb27b74 Revert "[PS5] Verify defaults to -fno-stack-size-section"
This reverts commit 28432b0f65.

Caused some unexpected buildbot failures.
2022-05-24 10:00:33 -07:00
Chris Bieneman 11dd508bd4 NFC. Clang-formatting.
Since the rest of the DirectX backend is pretty well clang-format
clean, this file should be too.
2022-05-24 11:51:00 -05:00
Peter Klausler d90e866a19 [flang][runtime] INQUIRE(UNIT=666,NUMBER=n) must set n=666
Whether a unit number in an inquire-by-unit statement is valid or not,
it should be the value to which the NUMBER= variable is set, not -1.
-1 should be returned to NUMBER= only for an inquire-by-file statement
when the FILE= is not connected to any unit.

Differential Revision: https://reviews.llvm.org/D126145
2022-05-24 09:48:32 -07:00
Paul Robinson 28432b0f65 [PS5] Verify defaults to -fno-stack-size-section 2022-05-24 09:47:37 -07:00
Craig Topper 415b9f595d Recommit "[RISCV] Use selectShiftMaskXLen ComplexPattern for isel of rotates."
This reverts commit dfe513ae1b.

Tests have been changed to avoid the type legalization bug being
fixed in D126036.

Original commit message:
This will remove masks on the shift amount. We usually get this with
SimplifyDemandedBits in DAGCombine, but that's restricted to cases
where the AND has a single use. selectShiftMaskXLen does not have
that restriction.
2022-05-24 09:41:04 -07:00
Craig Topper cddeb78e8d [RISCV] Add test cases showing failure to remove mask on rotate amounts.
This is similar to tests I added in
e2f410feea that had to be reverted.

I've modified them to avoid the bug that is being fixed by D126036.
2022-05-24 09:41:00 -07:00
Nico Weber 1b976f2cb2 [gn build] Reformat all build files
Ran:

    git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
2022-05-24 12:16:55 -04:00
Peter Klausler 574f9dfee8 [flang] Extension: Accept Hollerith actual arguments as if they were BOZ
When a Hollerith (or short character) literal is presented as an actual
argument that corresponds to a dummy argument for which a BOZ literal
would be acceptable, treat the Hollerith as if it had been a BOZ
literal in the same way -- and with the same code -- as f18 already
does for the similar extension in DATA statements.

Differential Revision: https://reviews.llvm.org/D126144
2022-05-24 09:04:31 -07:00
Cyndy Ishida a1a14e817e [Clang] Avoid misleading 'conflicting types' diagnostic with no-prototype decls.
Clang has recently started diagnosing prototype redeclaration errors like [rG385e7df33046](https://reviews.llvm.org/rG385e7df33046d7292612ee1e3ac00a59d8bc0441)

This flagged legitimate issues in a codebase but was confusing to resolve because it actually conflicted with a function declaration from a system header and not from the one emitted with "note: ".

This patch updates the error handling to use the canonical declaration's source location instead to avoid misleading errors like the one described.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D126258
2022-05-24 08:43:31 -07:00
Nico Weber 154f93ca90 [gn build] (semi-automatically) port 0360b9f159 2022-05-24 11:41:28 -04:00
Louis Dionne 6325184049 [libc++][NFC] Whitespace refactoring of string.cpp for consistency and legibility 2022-05-24 11:32:00 -04:00
Louis Dionne dc8a9a03ec [libc++][NFC] Move definitions around in string.cpp to reduce _LIBCPP_HAS_NO_WIDE_CHARACTERS blocks 2022-05-24 11:32:00 -04:00
Mogball 96bbe1bd61 [mlir] Rename mlir::SmallVector -> llvm::SmallVector 2022-05-24 15:03:19 +00:00
Logan Chien 57d239e4ad [mlir] Breakdown diagnostic string literals
This commit breaks down diagnostic string literals so that the attribute
name and enumurator names can be shared with the stringify utility
function and the "expected ", " to be one of ", and ", " can be shared
between different enum-related diagnostic.

Differential Revision: https://reviews.llvm.org/D125938
2022-05-24 07:58:00 -07:00
Peter Klausler deb62f5ad6 [flang][runtime] Clean up asynchronous I/O APIs
Now that the requirements and implementation of asynchronous I/O are
better understood, adjust their I/O runtime APIs.  In particular:
1) Remove the BeginAsynchronousOutput/Input APIs; they're not needed,
   since any data transfer statement might have ASYNCHRONOUS= and
   (if ASYNCHRONOUS='YES') ID= control list specifiers that need to
   at least be checked.
2) Add implementations for BeginWait(All) to check for the error
   case of a bad unit number and nonzero ID=.
3) Rearrange and comment SetAsynchronous so that it's clear that
   it can be called for READ/WRITE as well as for OPEN.

The implementation remains completely synchronous, but should be conforming.
Where opportunities make sense for true asynchronous implementations of
some big block transfers without SIZE= in the future, we'll need to add
a GetAsynchronousId API to capture ID= on a READ or WRITE; add sourceFile
and sourceLine arguments to BeginWait(All) for good error reporting;
track pending operations in unit.h; and add code to force synchronization
to non-asynchronous I/O operations.

Lowering should call SetAsynchronous when ASYNCHRONOUS= appears as
a control list specifier.  It should also set ID=x variables to 0
until such time as we support asynchronous operations, if ever.
This patch only removes the removed APIs from lowering.

Differential Revision: https://reviews.llvm.org/D126143
2022-05-24 07:54:57 -07:00
Serge Pavlov 6fc0bc5b0f Fix behavior of is_fp_class on empty class set
The second argument to is_fp_class specifies the set of floating-point
class to test against. It can be zero, in this case the intrinsic is
expected to return zero value.

Differential Revision: https://reviews.llvm.org/D112025
2022-05-24 21:50:18 +07:00
Simon Pilgrim 11455e4758 [DAG] Unroll vectorized FPOW instructions before widening that will scalarize to libcalls anyway
Followup to D125988 - FPOW is similar to FREM and will most likely scalarize to libcalls, so unroll before widening to prevent use making additional libcalls with UNDEF args.
2022-05-24 15:44:53 +01:00
Hans Wennborg ebe2e4f5b7 [libcxx] Add sort.bench.cpp to libcxx/benchmarks/CMakeLists.txt
It was forgotten in D124740.

Differential revision: https://reviews.llvm.org/D126297
2022-05-24 16:39:02 +02:00
Sam Parker e0fe9785d3 [TypePromotion] Avoid unnecessary trunc zext pairs
Any zext 'sink' should already have an operand that is in the legal
value, so avoid using a trunc and just use the trunc operand instead.

Differential Revision: https://reviews.llvm.org/D118905
2022-05-24 15:34:36 +01:00