465354 Commits

Author SHA1 Message Date
John Brawn
5421ab4625 [lld][ARM] Add support for 16-bit thumb group relocations
This adds support for the following relocations:
 * R_ARM_THM_ALU_ABS_G0_NC
 * R_ARM_THM_ALU_ABS_G1_NC
 * R_ARM_THM_ALU_ABS_G2_NC
 * R_ARM_THM_ALU_ABS_G3
as defined in:
https://github.com/ARM-software/abi-aa/blob/main/aaelf32/aaelf32.rst#5615static-thumb16-relocations

Differential Revision: https://reviews.llvm.org/D153407
2023-06-23 13:43:04 +01:00
Matt Arsenault
89ccfa1b39 AMDGPU: Use correct lowering for llvm.log2.f32
We previously directly codegened to v_log_f32, which is broken for
denormals. The lowering isn't complicated, you simply need to scale
denormal inputs and adjust the result. Note log and log10 are still
not accurate enough, and will be fixed separately.
2023-06-23 08:37:37 -04:00
Ivan Kosarev
813f6a495b [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 12.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152905
2023-06-23 13:33:06 +01:00
Matt Arsenault
089f652f17 AMDGPU: Add more log vector tests 2023-06-23 08:28:42 -04:00
Marius Brehler
0f1ac5e110 [mlir][emitc] Add add and sub operations
This adds operations for binary additive operators to EmitC. The input
arguments to these ops can be EmitC pointers and thus the operations can
be used for pointer arithmetic.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D149963
2023-06-23 12:15:06 +00:00
Haojian Wu
6585dd3b83 [clangd] Replace the hacky include-cleaner macro-reference implementation.
Now MainFileMacros preserves enough information, we perform a just-in-time
convertion to interop with include-cleaner::Macro for include-cleaer features.

Differential Revision: https://reviews.llvm.org/D147034
2023-06-23 14:08:55 +02:00
Nikita Popov
407ff50eca [SCEV] Add test for alloca ranges (NFC) 2023-06-23 14:08:39 +02:00
Ivan Kosarev
5183ca8779 [AMDGPU][AsmParser] Eliminate cvtMtbuf().
Now that we have proper support for optional operands, the standard LLVM
machinery can take care of converting parsed instructions to MCInsts.
There are likely more cases where the conversion can be done
automatically, probably with some additional treatment. The plan is to
address them separately.

Part of <https://github.com/llvm/llvm-project/issues/62629>.

Reviewed By: arsenm, foad

Differential Revision: https://reviews.llvm.org/D153565
2023-06-23 12:43:52 +01:00
Ivan Kosarev
9435942447 [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 10.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152903
2023-06-23 12:24:52 +01:00
Nikita Popov
a68c968755 [ValueTracking] Correctly check addrspace of alloca
The DataLayout alloca address space is the address space that should
be used when creating new allocas. However, not all allocas are
required to be in this address space. The isKnownNonZero() check
should work on the actual address space of the alloca, not the
default alloca address space.
2023-06-23 13:11:28 +02:00
Aaron Ballman
63342ae4b8 Fix a failing assertion with implicit function definitions
When implicitly defining a function in C, we would try to find an
appropriate declaration context for the function to be declared within.
However, we did not account for GNU statement expressions, which
masquerade as a compound statement and can be used in other contexts
such as within structure member declarations.

Fixes https://github.com/llvm/llvm-project/issues/48579
2023-06-23 07:02:21 -04:00
Michael Platings
041ffc155f [Clang][Driver] Warn on invalid Arm or AArch64 baremetal target triple
A common user mistake is specifying a target of aarch64-none-eabi or
arm-none-elf whereas the correct names are aarch64-none-elf &
arm-none-eabi. Currently if a target of aarch64-none-eabi is specified
then the Generic_ELF toolchain is used, unlike aarch64-none-elf which
will use the BareMetal toolchain. This is unlikely to be intended by the
user so issue a warning that the target is invalid.

The target parser is liberal in what input it accepts so invalid triples
may yield behaviour that's sufficiently close to what the user intended.
Therefore invalid triples were used in many tests. This change updates
those tests to use valid triples.
One test (gnu-mcount.c) relies on the Generic_ELF toolchain behaviour so
change it to explicitly specify aarch64-unknown-none-gnu as the target.

Reviewed By: peter.smith, DavidSpickett

Differential Revision: https://reviews.llvm.org/D153430
2023-06-23 11:54:29 +01:00
Luke Lau
1c70c2bc2c [CostModel] Use operands argument in getInstructionCost in more places
The current instruction's pointer operand may be different from the one
specified in the Operands argument. We should use the pointer operand
from here instead in case the user has transformed it.

This manifested itself somewhere down the line in
https://reviews.llvm.org/D149889, but I haven't been able to create a
test case on its own yet unfortunately.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D153574
2023-06-23 11:52:27 +01:00
Nikita Popov
406e9c9372 [SCEV] Use object size for allocas as well
The object size and alignment based restriction on the possible
allocation range also applies to allocas, not just globals, so
handle them as well.

We shouldn't really need any type restriction here at all, but
for now stay conservative.
2023-06-23 12:38:12 +02:00
Nikita Popov
6555b5dc99 [SCEV] Store getValue() result in variable (NFC) 2023-06-23 12:31:36 +02:00
David Green
71ac2a8e23 [AArch64] Add tests for double reducts of vector.reduce.fmaximum/fminimum. NFC
Including some tests with mixed minnum/minimum reductions and removing the fast
from fmin/fmax reductions as those should not be needed.
2023-06-23 11:28:09 +01:00
Serge Pavlov
1099208b99 [symbolizer] Check existence of input file in GNU mode
GNU addr2line exits immediately if it cannot open the file specified as
executable/relocatable. In contrast llvm-addr2line does not exit and, if
addresses are not specified in command line, waits for input on stdin. This
causes the test compiler-rt/test/asan/TestCases/Posix/asan-symbolize-bad-path.cc to block
forever on Gentoo (see https://reviews.llvm.org/rG27c4777f41d2ab204c1cf84ff1cccd5ba41354da#1190273).
To fix this issue the behavior llvm-addr2line now exits if
executable/relocatable file cannot be found.

It fixes https://github.com/llvm/llvm-project/issues/42099 (llvm-addr2line
does not exit when passed a non-existent file).

Differential Revision: https://reviews.llvm.org/D147652
2023-06-23 17:20:15 +07:00
Nikita Popov
7cf567d461 [ConstantRange] Calculate precise range for multiply by -1
These are pretty common in SCEV, so make sure we get a precise
result by mapping to the sub() operation.
2023-06-23 12:17:48 +02:00
Igor Kirillov
04a8070b46 Revert "Revert "[CodeGen] Extend reduction support in ComplexDeinterleaving pass to support predication""
Adds the capability to recognize SelectInst that appear in the IR.
These instructions are generated during scalable vectorization for reduction
and when the code contains conditions inside the loop body or when
"-prefer-predicate-over-epilogue=predicate-dont-vectorize" is set.

Differential Revision: https://reviews.llvm.org/D152558

This reverts commit ab09654832dba5cef8baa6400fdfd3e4d1495624.

Reason: Reapplying after removing unnecessary default case in switch expression.
2023-06-23 10:13:22 +00:00
Ties Stuij
2273741ea2 [ARM] generate armv6m eXecute Only (XO) code
[ARM] generate armv6m eXecute Only (XO) code for immediates, globals

Previously eXecute Only (XO) support was implemented for targets that support
MOVW/MOVT (~armv7+). See: https://reviews.llvm.org/D27449

XO prevents the compiler from generating data accesses to code sections. This
patch implements XO codegen for armv6-M, which does not support MOVW/MOVT, and
must resort to the following general pattern to avoid loads:

    movs    r3, :upper8_15:foo
    lsls    r3, #8
    adds    r3, :upper0_7:foo
    lsls    r3, #8
    adds    r3, :lower8_15:foo
    lsls    r3, #8
    adds    r3, :lower0_7:foo
    ldr     r3, [r3]

This is equivalent to the code pattern generated by GCC.

The above relocations are new to LLVM and have been implemented in a parent
patch: https://reviews.llvm.org/D149443.

This patch limits itself to implementing codegen for this pattern and enabling
XO for armv6-M in the backend.

Separate patches will follow for:
- switch tables
- replacing specific loads from constant islands which are spread out over the
  ARM backend codebase. Amongst others: FastISel, call lowering, stack frames.

Reviewed By: john.brawn

Differential Revision: https://reviews.llvm.org/D152795
2023-06-23 10:50:47 +01:00
pvanhout
2f7ab29624 [NFC] clang-format GlobalISelEmitter.cpp
It was overdue for a clang-format run, and it avoids unrelated formatting changes sneaking into diffs.
2023-06-23 11:42:51 +02:00
pvanhout
fd33821650 [NFC] Remove leftover inline on some RuleMatcher functions
Accidentally copy-pasted them into the .cpp while refactoring the file in D151432
Those functions are currently only used in the .cpp so it didn't cause an issue, but it causes an undefined reference if another file attempts to use them.
2023-06-23 11:39:56 +02:00
Jolanta Jensen
c5ed93f975 [SVE ACLE] Remove DAG combines that are no longer relevant.
This patch removes DAG combines that are no longer relevant
because equivalent IR combines have been added.

Differential Revision: https://reviews.llvm.org/D153445
2023-06-23 09:09:07 +00:00
Jeremy Furtek
55c2211a23 [APFloat] Add APFloat semantic support for TF32
This diff adds APFloat support for a semantic that matches the TF32 data type
used by some accelerators (most notably GPUs from both NVIDIA and AMD).

For more information on the TF32 data type, see https://blogs.nvidia.com/blog/2020/05/14/tensorfloat-32-precision-format/.
Some intrinsics that support the TF32 data type were added in https://reviews.llvm.org/D122044.

For some discussion on supporting common semantics in `APFloat`, see similar
efforts for 8-bit formats at https://reviews.llvm.org/D146441, as well as
https://discourse.llvm.org/t/rfc-adding-the-amd-graphcore-maybe-others-float8-formats-to-apfloat/67969.

A subsequent diff will extend MLIR to use this data type. (Those changes are
not part of this diff to simplify the review process.)

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D151923
2023-06-23 10:54:49 +02:00
Kazu Hirata
2764322912 [LegacyPM] Remove LowerMatrixIntrinsicsLegacyPass and LowerMatrixIntrinsicsMinimalLegacyPass
Differential Revision: https://reviews.llvm.org/D153615
2023-06-23 01:32:38 -07:00
Kazu Hirata
0fd1e93bd7 [LegacyPM] Remove unused declaration initializeAnnotation2MetadataLegacyPass
The corresponding function definition was removed by:

  commit 773d663e4729f55d23cb04f78a9d003643f2cb37
  Author: Arthur Eubanks <aeubanks@google.com>
  Date:   Mon Feb 27 19:00:37 2023 -0800
2023-06-23 01:32:36 -07:00
Tamás Danyluk
248b85344b [SCCPSolver] Speed up SCCPSolver by avoiding repeated work list elements
If a value is already the last element of the worklist, then I think that we don't have to add it again, it is not needed to process it repeatedly.

For some long Triton-generated LLVM IR, this can cause a ~100x speedup.

Differential Revision: https://reviews.llvm.org/D153561
2023-06-23 10:23:53 +02:00
Alex Zinenko
135e5bf894 [mlir][transform] don't wrap a warning into silenceable failure
Wrapping a warning into a silenceable failure will result in the warning
being interpreted as an error, which it is not.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D153546
2023-06-23 08:20:53 +00:00
Alex Zinenko
c580bd261c [mlir][transform] fix handle invalidation check for reentrant regions
When exiting the scope of a region attached to a transform op, clean up
the handle invalidation checks assocaited with handles defined in this
region. Otherwise, these checks may trigger on the next entry to the
region while there is no incorrect usage.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D153545
2023-06-23 08:20:49 +00:00
Balázs Kéri
dd639eb15a [clang][ASTImporter] Add import of CXXRewrittenBinaryOperator.
Fix for issue #62770.

Reviewed By: donat.nagy

Differential Revision: https://reviews.llvm.org/D153424
2023-06-23 10:04:01 +02:00
Dhruv Chawla
3f77724de7
[TargetLowering] Better code generation for ISD::SADDSAT/SSUBSAT when operand sign is known
When the sign of either of the operands is known, it is possible to
determine what the saturating value will be without having to compute it
using the sign bits.

Differential Revision: https://reviews.llvm.org/D153575
2023-06-23 13:20:36 +05:30
Dhruv Chawla
911df1e8dd
[AArch64] Pre-commit test for D153575 2023-06-23 13:08:26 +05:30
Kazu Hirata
4eb06e57f1 [LegacyPM] Remove LoopAccessLegacyAnalysis
Differential Revision: https://reviews.llvm.org/D153610
2023-06-23 00:36:39 -07:00
Ulrich Weigand
bb0bbed610 Fix bytecode reader/writer on big-endian platforms
This makes the bytecode reader/writer work on big-endian platforms.
The only problem was related to encoding of multi-byte integers,
where both reader and writer code make implicit assumptions about
endianness of the host platform.

This fixes the current test failures on s390x, and in addition allows
to remove the UNSUPPORTED markers from all other bytecode-related
test cases - they now also all pass on s390x.

Also adding a GFAIL_SKIP to the MultiModuleWithResource unit test,
as this still fails due to an unrelated endian bug regarding
decoding of external resources.

Differential Revision: https://reviews.llvm.org/D153567

Reviewed By: mehdi_amini, jpienaar, rriddle
2023-06-23 09:22:55 +02:00
Haojian Wu
7298bcf7f0 [clangd] Store offsets in MacroOccurrence
Remove the existing `Rng` field.

From the review comment: https://reviews.llvm.org/D147034

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D153259
2023-06-23 09:21:08 +02:00
Jean Perier
1fb0707da6 [flang][hlfir] Simplify hlfir::convertToValue
Use hlfir::loadTrivialScalars to dereference pointer, allocatables, and
load numerical and logical scalars.

This has a small fallout on tests:

- load is done on the HLFIR entity (#0 of hlfir.declare) and not the FIR one (#1). This makes no difference at the FIR level (#1 and #0 only differs to account for assumed and explicit shape lower bounds).

- loadTrivialScalars get rids of allocatable fir.box for monomoprhic scalars
  (it is not needed). This exposed a bug in lowering of MERGE with
  a polymorphic and a monomorphic argument: when the monomorphic is not
  a fir.box, the polymorphic fir.class should not be reboxed but its
  address should be read.

Reviewed By: tblah

Differential Revision: https://reviews.llvm.org/D153252
2023-06-23 09:04:25 +02:00
Martin Braenne
efbb4aaace [clang][dataflow] Dump useful debugging information when we crash.
- The AST of the function we're currently analyzing
- The CFG
- The CFG element we're currently processing

Reviewed By: ymandel

Differential Revision: https://reviews.llvm.org/D153549
2023-06-23 06:49:28 +00:00
Kazu Hirata
2ef2c644b6 [mlir] Remove unused forward declaration QuantizedIntegerType
The declaration was added without a corresponding class definition by:

  commit 13bb8f491a1cb429226768cfd4ca6bcea3b938dd
  Author: Stella Laurenzo <laurenzo@google.com>
  Date:   Wed Apr 3 11:16:32 2019 -0700
2023-06-22 23:45:53 -07:00
Kazu Hirata
3f8ed16c67 [Transforms] Remove unused forward declaration PredicateScalarEvolution
The declaration was added without a corresponding class definition by:

  commit a84064bcda1a737658d33e96ca58516d01af70a6
  Author: Florian Hahn <flo@fhahn.com>
  Date:   Wed Dec 21 22:02:31 2022 +0000

It is most likely a misspelling of PredicatedScalarEvolution.
2023-06-22 23:45:52 -07:00
Kazu Hirata
fdd5f695fc [llvm] Use llvm::is_contained (NFC) 2023-06-22 23:45:50 -07:00
Jacques Pienaar
fbb5f73371 [mlir][docgen] Change nested check
Allows for single op nested regions.
2023-06-22 22:05:55 -07:00
Kazu Hirata
7175d6a596 [CodeGen] Remove unused declaration createVLIWSched
The declaration was added without a corresponding function by:

  commit cc3bb85580189d4a004cfd9bd2d6286cd1c1169f
  Author: James Nagurne <j-nagurne@ti.com>
  Date:   Fri Oct 22 17:08:16 2021 -0500
2023-06-22 21:21:29 -07:00
Jon Chesterfield
d4d8cd8446 [libc] Factor specifics of packet type out of process
NFC. Simplifies process slightly, gives more options for testing it.

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D153604
2023-06-23 03:45:23 +01:00
Jon Chesterfield
7e799342e1 [libc] Simplify access permissions, change to composition over inheritance
Private member variable minimises scope of access to Process

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D153603
2023-06-23 02:54:22 +01:00
Oleksii Lozovskyi
be1b2ac948 [compiler-rt][CMake] Multiarch build of XRay libraries
Instead of dumping all sources into RTXray object library with a weird
special case for x86, handle multiarch builds better. Build a separate
object library for each arch with its arch-specific sources, then link
in all those libraries.

This fixes the build on platforms that produce fat binaries, such as new
macOS which expects both x86_64 and aarch64 objects in the same library
since Apple Silicon is a thing.

This only enables building XRay support for Apple Silicon. It does not
actually work yet on macOS, neither on Intel nor on Apple Silicon CPUs.
Thus the tests are still disabled.

Reviewed By: MaskRay, phosek

Differential Revision: https://reviews.llvm.org/D153221
2023-06-22 18:41:07 -07:00
Jon Chesterfield
85c66f5d18 [libc] Instantiate and sanity check rpc class
CMake plumbing cargo culted from other tests.
Minor changes to Process to allow statically allocating a buffer.

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D153594
2023-06-23 02:11:18 +01:00
Amaury Séchet
34d8c5b9ce [DAG] Peek through trunc when combining select into shifts.
This fixes a regression in D127115

Depends on D127115

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D151916
2023-06-23 00:35:39 +00:00
Sheng
65b710efc1 [m68k] Fix incorrect handling of TLS when matching addressing mode.
`TargetGlobalTLSAddress` is not considered and handled correctly when matching addressing mode, which leads to an incorrect result of instruction selection.

fixes #63162.

Reviewed By: myhsu

Differential Revision: https://reviews.llvm.org/D153103
2023-06-23 08:30:53 +08:00
Vitaly Buka
fe6de0be2f [nfc][msan] Clang-format includes 2023-06-22 17:13:50 -07:00
Vitaly Buka
dc4d9d615f [msan] Release origin pages with shadow 2023-06-22 17:07:02 -07:00