Commit Graph

414124 Commits

Author SHA1 Message Date
David Pagan 0a7cc078ac Enable inoutset dependency-type in depend clause.
Done in manner similar to mutexinoutset
(see https://reviews.llvm.org/D57576)

Runtime support already exists in LLVM OpenMP runtime (see
https://reviews.llvm.org/D97085).

The value used to identify an inoutset dependency type in the LLVM
OpenMP runtime is 8.

Some tests updated due to change in dependency type error messages that
now include new dependency type. Also updated
test/OpenMP/task_codegen.cpp to verify we emit the right code.
2022-02-08 08:35:36 -05:00
Arjun P 6472546fb7 [MLIR][Presburger] factor out duplicated function `parsePoly` into a Utils.h
Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D119194
2022-02-09 00:35:43 +05:30
Simon Pilgrim 1468202748 [ValueTracking] Add support for X*X self-multiplication
D108992 added KnownBits handling for 'Quadratic Reciprocity' self-multiplication patterns (bit[1] == 0), which can be used for non-undef values (poison is OK).

This patch adds noundef selfmultiply handling to value tracking so demanded bits patterns can make use of it.

Differential Revision: https://reviews.llvm.org/D117995
2022-02-08 13:33:27 +00:00
Simon Pilgrim e2537f6b19 [ValueTracking] Replace dyn_cast with dyn_cast_or_null to account for getTerminator returning null
Noticed while running checks on D117995 - a hexagon regression test was managing to return a block without a terminator
2022-02-08 13:33:26 +00:00
Jesko Appelfeller 0851970af5 Make run-clang-tidy.py print the configured checks correctly
The test invocation at the start of run-clang-tidy.py (line 257) prints
all enabled checks - meaning either the default set or anything
configured via the -checks option. If any checks were (un-)configured
via the -config option, these are not printed. This is confusing to the
user, since the list of checks that are printed may be different from
the list of checks that are used by the non-testing calls to clang-tidy,
where the -config option is passed correctly.

This patch adds the -config option to the test invocation of clang-tidy
at the start of the script. This means that checks (un-)configured via
the -config option (rather than the -checks option) are applied
correctly, when printing the list of enabled checks.
2022-02-08 08:32:04 -05:00
Nikita Popov 9cc83bfd6c [AMDGPU] Regenerate test checks (NFC)
Use --include-generated-funcs checks. Unfortunately this places
all the functions at the end of the file rather than interleaving
them, but at least makes it feasible to update these tests.
2022-02-08 14:30:18 +01:00
Simon Moll ae1bb44ed8 [VE] v256.32|64 setcc isel and tests
Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D119223
2022-02-08 13:20:55 +01:00
Simon Pilgrim fd2bb51f1e [ADT] Add APInt/MathExtras isShiftedMask variant returning mask offset/length
In many cases, calls to isShiftedMask are immediately followed with checks to determine the size and position of the bitmask.

This patch adds variants of APInt::isShiftedMask, isShiftedMask_32 and isShiftedMask_64 that return these values as additional arguments.

I've updated a number of cases that were either performing seperate size/position calculations or had created their own local wrapper versions of these.

Differential Revision: https://reviews.llvm.org/D119019
2022-02-08 12:04:13 +00:00
Guillaume Chatelet 83f9b13d8c [libc] Optimized version of memmove
This implementation relies on storing data in registers for sizes up to 128B.
Then depending on whether `dst` is less (resp. greater) than `src` we move data forward (resp. backward) by chunks of 32B.
We first make sure one of the pointers is aligned to increase performance on large move sizes.

Differential Revision: https://reviews.llvm.org/D114637
2022-02-08 11:55:09 +00:00
Simon Pilgrim 508b3f437d Attempt to fix sphinx 'Malformed table' warning. 2022-02-08 11:48:37 +00:00
David Green fdce239ae9 [AArch64] Attempt to emitConjunction from brcond
We currently use emitConjunction to create CCMP conjunctions from the
conditions of selects, helping turning and/ors into more optimal ccmp
sequences that don't need to go through csels. This extends that to also
be used whilst lowering brcond, giving more opportunity for better
condition generation.

Differential Revision: https://reviews.llvm.org/D118650
2022-02-08 11:27:10 +00:00
Simon Pilgrim c00db97159 [Clang] Add elementwise saturated add/sub builtins
This patch implements `__builtin_elementwise_add_sat` and `__builtin_elementwise_sub_sat` builtins.

These map to the add/sub saturated math intrinsics described here:
https://llvm.org/docs/LangRef.html#saturation-arithmetic-intrinsics

With this in place we should then be able to replace the x86 SSE adds/subs intrinsics with these generic variants - it looks like other targets should be able to use these as well (arm/aarch64/webassembly all have similar examples in cgbuiltin).

Differential Revision: https://reviews.llvm.org/D117898
2022-02-08 11:22:01 +00:00
Mubashar Ahmad 95b8a3e520 [AArch64] FeaturePerfMon Added to CPUs
FeaturePerfMon has been enabled for CPUs in AArch64.

Differential Revision: https://reviews.llvm.org/D118705
2022-02-08 11:19:26 +00:00
Nikita Popov d9dba4c782 [NVPTXISelLowering] Remove unnecessary context parameter (NFCI)
The module context shouldn't be relevant here, and should never
be null either.
2022-02-08 12:18:15 +01:00
Nikita Popov 80267c8887 [NVPTXISelLowering] Use byval IndirectType
Instead of the pointer element type.
2022-02-08 12:08:52 +01:00
Nikita Popov 54b8fa790e [NVPTXISelLowering] Use getByValSize()
Instead of computing the size of the pointer element type.
2022-02-08 12:04:34 +01:00
Guillaume Chatelet f231599666 [libc] Don't use Clang flags on other compilers
This is necessary to get llvm-libc compile with GCC.
This patch is extracted from D119002.

Differential Revision: https://reviews.llvm.org/D119143
2022-02-08 11:00:48 +00:00
Nikita Popov af7b4df667 [NVPTXAsmPrinter] Use byval type
Instead of pointer element type.
2022-02-08 11:57:46 +01:00
Andrzej Warzynski 8d248002a6 [flang][nfc] Add an assert to guard against `nullptr` dereferencing
Differential Revision: https://reviews.llvm.org/D119133
2022-02-08 10:46:57 +00:00
Guillaume Chatelet a33e98543a [libc] Disable rtti/expections
llvm-libc exhibits a C interface but its source is C++.
This patch explicitly disables the use of exceptions and RTTI when compiling the entrypoints.

Differential Revision: https://reviews.llvm.org/D118889
2022-02-08 10:46:28 +00:00
Fraser Cormack 62c4ac764b [RISCV] Optimize splats of extracted vector elements
This patch adds an optimization to splat-like operations where the
splatted value is extracted from a identically-sized vector. On RVV we
can splat that via vrgather.vx/vrgather.vi without dropping to scalar
beforehand.

We do have a similar VECTOR_SHUFFLE-specific optimization but that only
works on fixed-length vector types and for those with a constant splat
lane. This patch extends this optimization to make it work on
scalable-vector types and on unknown extract indices.

It is performed during fixed-vector BUILD_VECTOR lowering and during a
new DAGCombine on SPLAT_VECTOR for scalable vectors.

Reviewed By: craig.topper, khchen

Differential Revision: https://reviews.llvm.org/D118456
2022-02-08 10:35:25 +00:00
Nikita Popov 215aba7712 [NVPTXLowerArgs] Use byval type
Instead of pointer element type.
2022-02-08 11:41:45 +01:00
Nikita Popov 179540299a [OpenMPIRBuilderTest] Remove getPointerElementType() uses (NFC)
Use the type of the stored value instead.
2022-02-08 11:38:17 +01:00
Guillaume Chatelet c28a522fc7 [libc][NFC] moving template specialization outside class declaration
This is necessary to get llvm-libc compile with GCC.
This patch is extracted from D119002.

Differential Revision: https://reviews.llvm.org/D119142
2022-02-08 10:35:44 +00:00
David Green f21dd70f68 [AArch64] Add some additional tests for conditions of branches. NFC 2022-02-08 10:28:33 +00:00
Tres Popp 64b918852c Remove restriction on static dimensions in Shape method
mlir::shape::ToExtentTensorOp::areCastCompatible didn't allow the input
to have a static dimension, but that is allowed.
2022-02-08 11:20:01 +01:00
Cullen Rhodes 99d95025e1 [mlir][Affine][Vector] NFC: fix examples in comments
s/-affine-vectorize/-affine-super-vectorize/g

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D118892
2022-02-08 10:03:32 +00:00
Nikita Popov b896334834 [ArgPromotion] Check dereferenceability on argument as well
Before walking all the callers, check whether we have a
dereferenceable attribute directly on the argument.

Also make it clearer that the code currently does not treat
alignment correctly.
2022-02-08 10:29:51 +01:00
Nikita Popov c2b476767e [ArgPromotion] Test dereferenceable annotation on callee (NFC)
While we check dereferenceability of all callers, we don't check
dereferenceability annotations on the callee.
2022-02-08 10:27:17 +01:00
Nikita Popov bf17cb294a [Bitstream] Make MaxChunkSize word-size independent
We only support chunks <= 32 bits regardless of whether we're
running on a 64-bit platform or not. Chunk size > 32 <= 64 would
cause UB in the reading code.
2022-02-08 10:14:07 +01:00
Nikita Popov 6d52ea885f [Bitcode] Prevent OOB read for invalid name size 2022-02-08 09:49:39 +01:00
Nikita Popov 67348c8acf [Bitstream] Check for unterminated VBR
This avoid shift larger than bitwidth UB.
2022-02-08 09:49:39 +01:00
Nikita Popov 13ac0392de [Bitcode] Add missing includes in llvm-dis-fuzzer
Probably missed as part of some recent header cleanup.
2022-02-08 09:49:38 +01:00
Clement Courbet 90d2291fbb [NFC] Fix comment.
The extra space causes the table to render incorrectly in doxygen.
2022-02-08 09:42:44 +01:00
Marek Kurdej 06e42590a5 [clang-format] Comment unused parameters. NFC. 2022-02-08 09:33:55 +01:00
Marek Kurdej 7d6397348e [clang-format] Fix typo. NFC. 2022-02-08 09:33:54 +01:00
Alex Zinenko 68784267b1 [mlir] Move constBuidlerCall from to ArrayAttrBase
This makes it applicable to both ArrayAttr and its typed subclasses instead of
only the latter. There is no good reason why ArrayAttr shouldn't be
const-buildable while its typed subclasses are, this was likely just an
omission.

Depends On D119113

Reviewed By: rriddle, nicolasvasilache

Differential Revision: https://reviews.llvm.org/D119114
2022-02-08 09:31:11 +01:00
Alex Zinenko 3df6cadec4 [mlir] ODS: require DefaultValuedAttr to be const-buildable
ODS provides a mechanism for defalut-valued attributes based on a wrapper
TableGen class that is recognized by mlir-tblgen. Such attributes, if not set
on the operaiton, can be construted on-the-fly in their getter given a constant
value. In order for this construction to work, the attribute specificaiton in
ODS must set the constBuilderCall field correctly. This has not been verified,
which could lead to invalid C++ code being generated by mlir-tblgen.

Closes #53588.

Reviewed By: rriddle, mehdi_amini

Differential Revision: https://reviews.llvm.org/D119113
2022-02-08 09:31:09 +01:00
Zi Xuan Wu ec642ceebc [CSKY] Add CSKYDisassembler.cpp to construct objdump
CSKYDisassembler tries to disassemble register MC operand from register num for different register class, and
also handles immediate num and carry flag operand which is not encoded in instruction binary.

Also enhance the printer of instruction to accept sub-option to control the print format. Sometimes, it prefers to
print number in hex, especially when immediate number represents symbol address.
2022-02-08 16:02:59 +08:00
Zi Xuan Wu 9ee96aaab2 [CSKY] Add CK800 series ProcessorModel and complete related SubtargetFeatures
Now we only support CSKY 800 series cpus and newer cpus in the future undering CSKYv2 ABI specification.
There are 11 processor family enums for CK series cpus such as CK801, CK802, CK803, CK803S, CK804, CK805,
CK807, CK810, CK810V, CK860, CK860V.

The SchedMachineModels are not ready for different cpus, so only NoSchedModel is used.
2022-02-08 16:02:59 +08:00
Tres Popp a1f3f1d2c9 Add missing BUILD dependency to ShapeOps 2022-02-08 09:00:22 +01:00
Rainer Orth 541171f02f [CodeGen][test] XFAIL CodeGen/Generic/ForceStackAlign.ll on SPARC
`CodeGen/Generic/ForceStackAlign.ll` `FAIL`s on SPARC like this:

  LLVM ERROR: Function "g" required stack re-alignment, but LLVM couldn't
handle it (probably because it has a dynamic alloca).

According to the comments in `llvm/lib/Target/Sparc/SparcFrameLowering.cpp`
(`SparcFrameLowering::emitPrologue`) and `SparcRegisterInfo.cpp`
(`SparcRegisterInfo::canRealignStack`) this isn't going to change any time
soon, so this patch `XFAIL`s the test.

Tested on `sparcv9-sun-solaris2.11`.

Differential Revision: https://reviews.llvm.org/D119119
2022-02-08 08:57:59 +01:00
Jason Molenda 9b1cb0e171 Platform gdb RSP packet doc fixes based on implementation behavior
Reviewing some recent fixes to the platform packet implementations
in lldb, I saw the docs were out of sync in a few spots.  Updated them.

Differential Revision: https://reviews.llvm.org/D118842
2022-02-07 23:51:46 -08:00
Mariusz Ceier 385f5c4d33 [lldb][CMake] Fix linking of gdb-remote when LLVM_ENABLE_ZLIB is ON
When LLVM_ENABLE_ZLIB is ON gdb-remote should link against ZLIB::ZLIB.

This fixes
```
/mnt/b/yoe/master/build/tmp/hosttools/ld: lib/liblldbPluginProcessGDBRemote.a(GDBRemoteCommunication.cpp.o): in function `lldb_private::process_gdb_remote::GDBRemoteCommunication::DecompressPacket() [clone .localalias]':
GDBRemoteCommunication.cpp:(.text._ZN12lldb_private18process_gdb_remote22GDBRemoteCommunication16DecompressPacketEv+0x59a): undefined reference to `inflateInit2_'
/mnt/b/yoe/master/build/tmp/hosttools/ld: GDBRemoteCommunication.cpp:(.text._ZN12lldb_private18process_gdb_remote22GDBRemoteCommunication16DecompressPacketEv+0x5af): undefined reference to `inflate'
```

Reviewed By: JDevlieghere, MaskRay

Differential Revision: https://reviews.llvm.org/D119186
2022-02-07 23:26:22 -08:00
Carl Ritson 42ac4e1a12 [MachineLICM] Add shouldHoist method to TargetInstrInfo
Add a shouldHoist method to TargetInstrInfo which is queried by
MachineLICM to override hoisting decisions for a given target.
This mirrors functionality provided by shouldSink.

Reviewed By: foad

Differential Revision: https://reviews.llvm.org/D118773
2022-02-08 15:53:05 +09:00
Lang Hames fe2f5c976c [ORC-RT] Fix missing #include from f9aef477eb. 2022-02-08 17:41:53 +11:00
Lang Hames f9aef477eb [ORC][ORC-RT] Rewrite the MachO platform to use allocation actions.
This patch updates the MachO platform (both the ORC MachOPlatform class and the
ORC-Runtime macho_platform.* files) to use allocation actions, rather than EPC
calls, to transfer the initializer information scraped from each linked object.
Interactions between the ORC and ORC-Runtime sides of the platform are
substantially redesigned to accomodate the change.

The high-level changes in this patch are:

1. The MachOPlatform::setupJITDylib method now calls into the runtime to set up
   a dylib name <-> header mapping, and a dylib state object (JITDylibState).

2. The MachOPlatformPlugin builds an allocation action that calls the
   __orc_rt_macho_register_object_platform_sections and
   __orc_rt_macho_deregister_object_platform_sections functions in the runtime
   to register the address ranges for all "interesting" sections in the object
   being allocated (TLS data sections, initializers, language runtime metadata
   sections, etc.).

3. The MachOPlatform::rt_getInitializers method (the entry point in the
   controller for requests from the runtime for initializer information) is
   replaced by MachOPlatform::rt_pushInitializers. The former returned a data
   structure containing the "interesting" section address ranges, but these are
   now handled by __orc_rt_macho_register_object_platform_sections. The new
   rt_pushInitializers method first issues a lookup to trigger materialization
   of the "interesting" sections, then returns the dylib dependence tree rooted
   at the requested dylib for dlopen to consume. (The dylib dependence tree is
   returned by rt_pushInitializers, rather than being handled by some dedicated
   call, because rt_pushInitializers can alter the dependence tree).

The advantage of these changes (beyond the performance advantages of using
allocation actions) is that it moves more information about the materialized
portions of the JITDylib into the executor. This tends to make the runtime
easier to reason about, e.g. the implementation of dlopen in the runtime is now
recursive, rather than relying on recursive calls in the controller to build a
linear data structure for consumption by the runtime. This change can also make
some operations more efficient, e.g. JITDylibs can be dlclosed and then
re-dlopened without having to pull all initializers over from the controller
again.

In addition to the high-level changes, there are some low-level changes to ORC
and the runtime:

* In ORC, at ExecutionSession teardown time JITDylibs are now destroyed in
reverse creation order. This is on the assumption that the ORC runtime will be
loaded into an earlier dylib that will be used by later JITDylibs. This is a
short-term solution to crashes that arose during testing when the runtime was
torn down before its users. Longer term we will likely destroy dylibs in
dependence order.

* toSPSSerializable(Expected<T> E) is updated to explicitly initialize the T
value, allowing it to be used by Ts that have explicit constructors.

* The ORC runtime now (1) attempts to track ref-counts, and (2) distinguishes
not-yet-processed "interesting" sections from previously processed ones. (1)
is necessary for standard dlopen/dlclose emulation. (2) is intended as a step
towards better REPL support -- it should enable future runtime calls that
run only newly registered initializers ("dlopen_more", "dlopen_additions",
...?).
2022-02-08 17:28:13 +11:00
Fangrui Song f237ab0dd1 [ELF] AArch64ErrataFix: replace std::map with DenseMap. NFC
There is now no <map> in lld/ELF.
2022-02-07 22:02:25 -08:00
Fangrui Song 27bb799095 [ELF] Clean up headers. NFC 2022-02-07 21:53:34 -08:00
wangpc c53d99c37d [RISCV] Split f64 undef into two i32 undefs
So that no store instruction will be generated.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D118222
2022-02-08 13:42:15 +08:00