Commit graph

410794 commits

Author SHA1 Message Date
Michael Jones 04e8c8f997 [libc] fix strtold_test formatting on ARM
I missed a variable when reformatting the tests. This fixes that.

Differential Revision: https://reviews.llvm.org/D117161
2022-01-12 14:34:57 -08:00
Daniel McIntosh f011a53c14 [libcxxabi] Added convenience classes to cxa_guard
This is the 5th of 5 changes to overhaul cxa_guard.
See D108343 for what the final result will be.

Depends on D115368

Reviewed By: ldionne, #libc_abi

Differential Revision: https://reviews.llvm.org/D115369
2022-01-12 17:31:36 -05:00
Daniel McIntosh 29be7c9c4f [libcxxabi] Re-organized inheritance structure to remove CRTP in cxa_guard
Currently, the `InitByte...` classes inherit from `GuardObject` so they can
access the `base_address`, `init_byte_address` and `thread_id_address`. Then,
since `GuardObject` needs to call `acquire`/`release`/`abort_init_byte`, it uses
the curiously recurring template pattern (CRTP). This is rather messy.

Instead, we'll have `GuardObject` contain an instance of `InitByte`, and pass it
the addresses it needs in the constructor. `GuardObject` doesn't need the
addresses anyways, so it makes more sense for `InitByte` to keep them instead of
`GuardObject`. Then, `GuardObject` can call `acquire`/`release`/`abort` as one
of `InitByte`'s member functions.

Organizing things this way not only gets rid of the use of the CRTP, but also
improves separation of concerns a bit since the `InitByte` classes are no longer
indirectly responsible for things because of their inheritance from
`GuardObject`. This means we no longer have strange things like calling
`InitByteFutex.cxa_guard_acquire`, instead we call
`GuardObject<InitByteFutex>.cxa_guard_acquire`.

This is the 4th of 5 changes to overhaul cxa_guard.
See D108343 for what the final result will be.

Depends on D115367

Reviewed By: ldionne, #libc_abi

Differential Revision: https://reviews.llvm.org/D115368
2022-01-12 17:31:08 -05:00
Daniel McIntosh 847ea76219 [libcxxabi] Pulled guard byte code out of GuardObject
Right now, GuardObject is in charge of both reading and writing to the guard
byte, and co-ordinating with the InitByte... classes. In order to improve
separation of concerns, create a separate class responsible for managing the
guard byte and use that inside GuardObject.

This is the 3rd of 5 changes to overhaul cxa_guard.
See D108343 for what the final result will be.

Depends on D110088

Reviewed By: ldionne, #libc_abi

Differential Revision: https://reviews.llvm.org/D115367
2022-01-12 17:30:39 -05:00
Daniel McIntosh 3601ee6cfd [libcxxabi] Make InitByteGlobalMutex check GetThreadID instead of PlatformThreadID
By relying on PlatformSupportsThreadID, InitByteGlobalMutex disregards
the GetThreadID template argument, rendering it useless.

This is the 2nd of 5 changes to overhaul cxa_guard.
See D108343 for what the final result will be.

Depends on D109539

Reviewed By: ldionne, #libc_abi

Differential Revision: https://reviews.llvm.org/D110088
2022-01-12 17:30:10 -05:00
Daniel McIntosh e42eeb88d7 [NFC][libcxxabi] Rename GlobalLock to GlobalMutex
This will make the naming more consistent with what it's called in the
rest of the file.

This is the 1st of 5 changes to overhaul cxa_guard.
See D108343 for what the final result will be.

Reviewed By: ldionne, #libc_abi

Differential Revision: https://reviews.llvm.org/D109539
2022-01-12 17:29:17 -05:00
Michael Jones ba6a3972d7 [libc] add working ARM entrypoints
Some functions were added to x86_64 that were untested on Aarch64. Now
that I've had an opportunity to test them, they all work on Aarch64 with
the minor formatting change included.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D117146
2022-01-12 14:24:18 -08:00
natashaknk 310e9636ca [tosa][mlir] Support dynamic batch dimension for ops where the batch dim is explicit
Dynamic batch for rescale, gather, max_pool, avg_pool, conv2D and depthwise_conv2D. Split helper functions into a separate header file.

Reviewed By: rsuderman

Differential Revision: https://reviews.llvm.org/D117031
2022-01-12 14:16:50 -08:00
River Riddle 676bfb2a22 [mlir] Refactor ShapedType into an interface
ShapedType was created in a time before interfaces, and is one of the earliest
type base classes in the ecosystem. This commit refactors ShapedType into
an interface, which is what it would have been if interfaces had existed at that
time. The API of ShapedType and it's derived classes are essentially untouched
by this refactor, with the exception being the API surrounding kDynamicIndex
(which requires a sole home).

For now, the API of ShapedType and its name have been kept as consistent to
the current state of the world as possible (to help with potential migration churn,
among other reasons). Moving forward though, we should look into potentially
restructuring its API and possible its name as well (it should really have "Interface"
at the end like other interfaces at the very least).

One other potentially interesting note is that I've attached the ShapedType::Trait
to TensorType/BaseMemRefType to act as mixins for the ShapedType API. This
is kind of weird, but allows for sharing the same API (i.e. preventing API loss from
the transition from base class -> Interface). This inheritance doesn't affect any
of the derived classes, it is just for API mixin.

Differential Revision: https://reviews.llvm.org/D116962
2022-01-12 14:12:09 -08:00
River Riddle a60e83fe7c [mlir][Interfaces] Add a extraSharedClassDeclaration field
This field allows for defining a code block that is placed in both the interface
and trait declarations. This is very useful when defining a set of utilities to
expose on both the Interface class and the derived attribute/operation/type.

In non-static methods, `$_attr`/`$_op`/`$_type` (depending on the type of
interface) may be used to refer to an instance of the IR entity. In the interface
declaration, this is an instance of the interface class. In the trait declaration,
this is an instance of the concrete entity class (e.g. `IntegerAttr`, `FuncOp`, etc.).

Differential Revision: https://reviews.llvm.org/D116961
2022-01-12 14:12:08 -08:00
Rob Suderman aa1c533a4e [mlir][tosa] Expand tosa.apply_scale lowering for vectors
Apply scale may encounter scalar, tensor, or vector operations. Expand the
lowering so that it can lower arbitrary of container types.

Reviewed By: NatashaKnk

Differential Revision: https://reviews.llvm.org/D117080
2022-01-12 14:07:52 -08:00
Tomas Matheson 2db4cf5962 clang support for Armv8.8/9.3 HBC
This introduces clang command line support for new Armv8.8-A and
Armv9.3-A Hinted Conditional Branches feature, previously introduced
into LLVM in https://reviews.llvm.org/D116156.

Patch by Tomas Matheson and Son Tuan Vu.

Differential Revision: https://reviews.llvm.org/D116939
2022-01-12 22:07:35 +00:00
River Riddle d4d016869d [mlir] Remove populateFuncOpTypeConversionPattern
This method simply forwards to populateFunctionLikeTypeConversionPattern,
which is more general. This also helps to remove special treatment of FuncOp from
DialectConversion.

Differential Revision: https://reviews.llvm.org/D116624
2022-01-12 14:05:35 -08:00
CJ Johnson 81c330e23d Filter string_view from the nullptr diagnosis of bugprone-string-constructor to prevent duplicate warnings with bugprone-stringview-nullptr
Updates the check and tests to not diagnose the null case for string_view (but retains it for string). This prevents the check from giving duplicate warnings that are caught by bugprone-stringview-nullptr ([[ https://reviews.llvm.org/D113148 | D113148 ]]).

Reviewed By: ymandel

Differential Revision: https://reviews.llvm.org/D114823
2022-01-12 17:04:44 -05:00
Luís Ferreira 6983968e83 [Demangle] Pass Ret parameter from decodeNumber by reference
Since Ret parameter is never meant to be nullptr, let's pass it by reference instead of a raw pointer.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D117046
2022-01-12 21:57:31 +00:00
Luís Ferreira b21ea1c270 [Demangle] Add support for D types back referencing
This patch adds support for type back referencing, allowing demangling of
    compressed mangled symbols with repetitive types.

    Signed-off-by: Luís Ferreira <contact@lsferreira.net>

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D111419
2022-01-12 21:57:31 +00:00
Luís Ferreira bec08795db [Demangle] Add support for D symbols back referencing
This patch adds support for identifier back referencing allowing compressed
    mangled names by avoiding repetitiveness.

    Signed-off-by: Luís Ferreira <contact@lsferreira.net>

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D111417
2022-01-12 21:57:31 +00:00
Luís Ferreira 669bfcf036 [Demangle] Add minimal support for D simple basic types
This patch implements simple demangling of two basic types to add minimal type functionality. This will be later used in function type parsing. After that being implemented we can add the rest of the types and test the result of the type name.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D111416
2022-01-12 21:57:30 +00:00
CJ Johnson 7e29da875c Add support for return values in bugprone-stringview-nullptr
bugprone-stringview-nullptr was not initially written with tests for return statements. After landing the check, the thought crossed my mind to add such tests. After writing them, I realized they needed additional handling in the matchers.

Differential Revision: https://reviews.llvm.org/D115121
2022-01-12 16:53:13 -05:00
Stanislav Gatev 963f40051a [clang][dataflow] Add transfer functions for initializers
This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun

Differential Revision: https://reviews.llvm.org/D117123
2022-01-12 21:51:39 +00:00
James Y Knight d1021978b8 Omit "clang" from CHECK lines.
This avoids spurious failures in some environemnts.
Similar change to eafc64ed63.
2022-01-12 21:18:52 +00:00
Konstantin Varlamov 57092f87b2 Revert "[libc++] Temporarily disable the in_out_result test on Fuchsia."
This reverts commit 9e634b35ff.
2022-01-12 13:10:30 -08:00
Fangrui Song a5249c2dd2 [ELF] Change gnuHashTab/hashTab to unique_ptr. NFC
and remove associated make<XXX> calls.

My x86-64 `lld` is ~5KiB smaller.
2022-01-12 13:04:32 -08:00
Mehdi Amini 9dc4dea110 Add llc to the list of build dependencies to test MLIR (Fix buildbot) 2022-01-12 20:55:52 +00:00
Richard fff59f4817 [clang-tidy] Improve modernize-redundant-void-arg to recognize macro uses
Sometimes a macro invocation will look like an argument list
declaration.  Improve the check to detect this situation and not
try to modify the macro invocation.

Thanks to Nathan James for the fix.

- Ignore implicit typedefs (e.g. compiler builtins)
- Improve lexing state machine to locate void argument tokens
- Add additional return_t() macro tests
- clang-format control in the test case file
- remove braces around single statements per LLVM style guide

Fixes #43791

Differential Revision: https://reviews.llvm.org/D116425
2022-01-12 13:51:50 -07:00
Fangrui Song 43d927984c [ELF] Refactor how .gnu.hash and .hash are discarded
Switch to the D114180 approach which is simpler and allows gnuHashTab/hashTab to
switch to unique_ptr.
2022-01-12 12:47:07 -08:00
Fangrui Song b592cbf329 [ELF][test] Improve discard-gnu-hash.s to check DT_HASH and DT_GNU_HASH 2022-01-12 12:43:49 -08:00
Walter Erquinigo 1f53dd1f23 [CODE OWNERS] Add wallace as code owner 2022-01-12 12:36:30 -08:00
Mehdi Amini 453a056df6 Add split-file to the MLIR test dependencies (Fix bot) 2022-01-12 20:33:52 +00:00
Kazu Hirata 44bb5cd80d [mlir] Fix a warning
This patch fixes:

  mlir/lib/Dialect/Arithmetic/Transforms/ExpandOps.cpp:161:52: error:
  'static_assert' with no message is a C++17 extension
  [-Werror,-Wc++17-extensions]
2022-01-12 12:31:43 -08:00
Mehdi Amini 44bdcb889a Apply clang-tidy fixes for bugprone-macro-parentheses in Interop.h (NFC) 2022-01-12 20:21:47 +00:00
Mehdi Amini ac5d32b103 Add an example of integration test invoking MLIR source with Memref from C
Reviewed By: ftynse, nicolasvasilache, bondhugula

Differential Revision: https://reviews.llvm.org/D117072
2022-01-12 20:18:56 +00:00
Craig Topper 15a78f9d09 [RISCV] Remove stale references to experimental-b. NFC
Differential Revision: https://reviews.llvm.org/D117136
2022-01-12 12:13:21 -08:00
Sanjay Patel 6bd127b079 [InstSimplify] use knownbits to fold more udiv/urem
We could use knownbits on both operands for even more folds (and there are
already tests in place for that), but this is enough to recover the example
from:
https://github.com/llvm/llvm-project/issues/51934
(the tests are derived from the code in that example)

I am assuming no noticeable compile-time impact from this because udiv/urem
are rare opcodes.

Differential Revision: https://reviews.llvm.org/D116616
2022-01-12 14:59:43 -05:00
River Riddle 56f62fbf73 [mlir] Finish removing Identifier from the C++ API
There have been a few API pieces remaining to allow for a smooth transition for
downstream users, but these have been up for a few months now. After this only
the C API will have reference to "Identifier", but those will be reworked in a followup.

The main updates are:
* Identifier -> StringAttr
* StringAttr::get requires the context as the first parameter
  - i.e. `Identifier::get("...", ctx)` -> `StringAttr::get(ctx, "...")`

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D116626
2022-01-12 11:58:23 -08:00
Christian Sigg be1aeb818c Remove NaN constant from arith.minf, arith.maxf expansion
If any of the operands is NaN, return the operand instead of a new constant.

When the rhs operand is a constant, the second arith.cmpf+select ops will be folded away.

https://reviews.llvm.org/D117010 marks the two ops commutative, which will place the constant on the rhs.

Reviewed By: herhut

Differential Revision: https://reviews.llvm.org/D117011
2022-01-12 20:56:40 +01:00
Fangrui Song bf9c8636f2 [ELF] Support discarding .relr.dyn
db08df0570 does not work because part.relrDyn is
a unique_ptr and `reset` destroys the object which may still be referenced.

This commit uses the D114180 approach. Also improve the test to check that there
is no R_X86_64_RELATIVE.
2022-01-12 11:55:22 -08:00
Christian Sigg f6fab68c30 Fold arith.cmpf when at least one operand is known to be NaN.
Reviewed By: herhut

Differential Revision: https://reviews.llvm.org/D117101
2022-01-12 20:48:52 +01:00
Thomas Raoux b0a309dd7a [mlir][vector] Add folding for extract + extract/insert_strided
Differential Revision: https://reviews.llvm.org/D116785
2022-01-12 11:48:35 -08:00
Sanjay Patel c87e917fb2 [InstCombine] add tests for binop with phi operands; NFC 2022-01-12 14:46:30 -05:00
Fangrui Song d8b7ae947d [ELF][test] Temporarily remove .relr.dyn test which is not working 2022-01-12 11:43:56 -08:00
Nico Weber 66b2ed477f Revert "[JITLink][AArch64] Add support for splitting eh-frames on AArch64."
This reverts commit 253ce92844.
Breaks tests on Windows, see
https://github.com/llvm/llvm-project/issues/52921#issuecomment-1011118896
2022-01-12 14:40:09 -05:00
Alex Bradbury 33d008b169 [RISCV] Update recently ratified Zb{a,b,c,s} extensions to no longer be experimental
Agreed policy is that RISC-V extensions that have not yet been ratified
should be marked as experimental, and enabling them requires the use of
the -menable-experimental-extensions flag when using clang alongside the
version number. These extensions have now been ratified, so this is no
longer necessary, and the target feature names can be renamed to no
longer be prefixed with "experimental-".

Differential Revision: https://reviews.llvm.org/D117131
2022-01-12 19:33:44 +00:00
Fangrui Song 24e7371fef [llvm-ar] Enforce one-dash form for long options
binutils ar does not support one-dash long options (they conflict with
operation code and modifier flags).

```
% ar -help
ar: invalid option -- 'e'
...
% ar -version
ar: invalid option -- 'e'
...

% ar x --plugin=xx x.a  # ok
% ar x -plugin=xx x.a
ar: two different operation options specified
% ar -plugin=/usr/lib/gcc/x86_64-linux-gnu/10/liblto_plugin.so x x.a
ar: x: No such file or directory
```

Drop one-dash long options to simplify code and match the usual practice for
command line utilities.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D116977
2022-01-12 11:33:23 -08:00
Fangrui Song f8476fd47b [llvm-ar][test] Test that --plugin is ignored 2022-01-12 11:32:31 -08:00
Matt Arsenault 22e6722632 AMDGPU/GlobalISel: Regenerate mir test checks 2022-01-12 13:44:06 -05:00
Matt Arsenault bd2c01e937 AMDGPU/GlobalISel: Do not use terminator copy before waterfall loops
Stop using the _term variants of the mov to save the initial exec
value before the waterfall loop. This cannot be glued to the bottom of
the block because we may need to spill the result register. Just use a
regular mov, like the loops produced on the DAG path. Fixes some
verification errors with regalloc fast.
2022-01-12 13:44:05 -05:00
Matt Arsenault 8a16201a0b GlobalISel: Fix insert point in localizer
This was inserting the new G_CONSTANT after the use, and the later
block scan would run off the end. Fix calling SkipPHIsAndLabels for no
apparent reason.
2022-01-12 13:44:05 -05:00
Fangrui Song 5014d6fc53 [ELF] -Map --why-extract=: print despite errors
Fix https://github.com/llvm/llvm-project/issues/53073

In case of a relocation error, GNU ld's link map includes
the archive member extraction information but not output sections.

Our -Map and --why-extract= are currently no-op in case of an error.
This change makes the two options work.

Reviewed By: ikudrin, peter.smith

Differential Revision: https://reviews.llvm.org/D116838
2022-01-12 10:40:33 -08:00
Fangrui Song db08df0570 [ELF] Support discarding .relr.dyn
to prepare for D116838, otherwise for linkerscript/discard-section-err.s,
there will be a null pointer dereference in `part.relrDyn->getParent()->size`
in `finalizeSynthetic(part.relrDyn.get())`.
2022-01-12 10:38:59 -08:00