485242 Commits

Author SHA1 Message Date
Schrodinger ZHU Yifan
2bc994456c
[libc] major refactor of startup library (#76092)
* separate initialization routines into _start and do_start for all
architectures.
* lift do_start as a separate object library to avoid code duplication.
* (addtionally) address the problem of building hermetic libc with
-fstack-pointer-*

The `crt1.o` is now a merged result of three components:

```
___
  |___ x86_64
  |      |_______ start.cpp.o    <- _start (loads process initial stack and aligns stack pointer)
  |      |_______ tls.cpp.o      <- init_tls, cleanup_tls, set_thread_pointer (TLS related routines) 
  |___ do_start.cpp.o            <- do_start (sets up global variables and invokes the main function) 
```
2024-01-04 12:51:14 -08:00
Piotr Zegar
d67c2d8554 [clang-tidy][NFC] Code format - leftover after #66169
Manually formating code via clang-format after previous
commit merge.
2024-01-04 20:48:41 +00:00
Chris Cotter
03ef103235
[clang-tidy] Fix bug in modernize-use-emplace (#66169)
emplace_back cannot construct an aggregate with arguments used to
initialize the aggregate.
Closes #62387

Test plan: Added test test from #62387 which contains code that should
not be replaced by the check.
2024-01-04 21:47:14 +01:00
Maksim Levental
a0c19bd455
[mlir][RegionBranchOpInterface] explicitly check for existance of block terminator (#76831) 2024-01-04 14:43:52 -06:00
Michael Maitland
58f1640635
[RISCV][llvm-mca] Use correct LMUL and SEW for strided loads and stores (#76869)
The pseudos for strided loads and stores use the SEW coming from the
name. For example, vlse8 has SEW=8 and vlse16 has SEW=16.

When llvm-mca tries to lookup (VLSE8_V, SEW=S, LMUL=L) in the inverse
pseudo table, a result will only be found when S=8, where S was set from
the previous vsetvli instruction. Instead, for a match to be found, we
must lookup (VLSE8_V, SEW=8, LMUL=L') where L' is the EMUL which was
calculated by scaling the LMUL and SEW from the previous vsetvli and the
SEW=8.
2024-01-04 15:40:30 -05:00
Florian Hahn
2ab5c47c87
[VPlan] Don't replace scalarizing recipe with VPWidenCastRecipe.
Don't replace a scalarizing recipe with a VPWidenCastRecipe. This would
introduce wide (vectorizing) recipes when interleaving only.

Fixes https://github.com/llvm/llvm-project/issues/76986
2024-01-04 20:39:44 +00:00
Oleksandr "Alex" Zinenko
71c17424b5
[mlir][TD] update more tests to use the "main" interpreter pass (#76963)
Update several tests under mlir/test/Dialect/Transform to use the "main"
transform interpreter pass with named entry points rather than the test
interpreter pass.

This helped discover a logic error in the expensive checks mechanism
that was exiting too early.
2024-01-04 21:33:51 +01:00
Petr Hosek
c398923f32
[CMake][runtimes] Check LLVM_ENABLE_PROJECTS for libc (#76845)
Only some targets may be building llvm-libc in which case the top-level
LLVM_ENABLE_RUNTIMES variable won't contain libc. Rather, we can check
LLVM_ENABLE_PROJECTS since libc is required to be included there for
libc-hdrgen to be built (and when LLVM_ENABLE_RUNTIMES contains libc, we
automatically include libc in LLVM_ENABLE_PROJECTS as well).
2024-01-04 12:14:32 -08:00
Krzysztof Drewniak
cd3942059e
[SeperateConstOffsetFromGEP] Pre-commit tests for or disjoint handling (#76972)
1. Adds tests for the existing interpretation of `or` as `add` in
SeperateConstOffsetFromGEP.
2. Pre-commits a test for `or disjoint`.
2024-01-04 14:08:30 -06:00
Jonathan Thackray
9d829784d4
[AArch64] Correct features for Arm Cortex-A78C, Cortex-X1C and Cortex-X2 (#76932)
Remove AArch64::AEK_FP16ML from Arm Cortex-A78C definition, as
this is not supported, according to the Technical Reference Manual:
   https://developer.arm.com/documentation/102226/latest/

Also add AArch64::AEK_FLAGM (Flag Manipulation) to Arm Cortex-X1C
and Arm Cortex-X2 as these were missing previously, but are
supported, according to the Technical Reference Manuals:
   https://developer.arm.com/documentation/101968/latest/
   https://developer.arm.com/documentation/101803/latest/

Fixes #62383
2024-01-04 20:06:47 +00:00
ChipsSpectre
b5a3e96392
[Clang][Parser] Fix crash of clang when using C++ constructs like :: in C code (#74926)
Ensure we do not try to parse a nested-name-specifier when parsing an ill-formed file in C mode.

Fixes #73559
2024-01-04 21:04:54 +01:00
Craig Topper
45651c357a [RISCV] Fix indentation in riscv_sifive_vector.td. NFC 2024-01-04 11:56:38 -08:00
Tom Stellard
166bd4e1f1
[workflows] Build a container for running CI on github actions (#75286)
Using a container will allow us to have similar testing environments on
both the GitHub hosted runners and the self-hosted runners.
2024-01-04 11:30:57 -08:00
Felipe de Azevedo Piovezan
8f40783944
[lldb][nfc] Mark function as const (#76974)
This function has no mutable behavior
2024-01-04 16:30:49 -03:00
David Goldblatt
852596d804
[BasicAA] Guess reasonable contexts for separate storage hints (#76770)
The definition of the pointer of the memory location being queried is
always one such context. Even this conservative guess can be better than
no guess at all in some cases.

Fixes #64666

Co-authored-by: David Goldblatt <davidgoldblatt@meta.com>
2024-01-04 11:29:00 -08:00
Tom Stellard
05216544a3
[llvm] Add support for running tests as root (#75285)
There are a few test that check access permissions, so they need to be
disabled when running the tests as root.

The most common use case for running tests as root is inside of a
container. GitHub Actions, for example, only supports running the root
user inside of containers, so this change is necessary in order to run
the tests inside of a container running in the GitHub Actions
environment.
2024-01-04 11:25:09 -08:00
madanial0
0b45c7722c
[Flang] make ppc unsupported for x86_64 test case (NFC) (#73903)
The test case is for x86_64 adding powerpc as unsupported.

Co-authored-by: Mark Danial <mark.danial@ibm.com>
2024-01-04 14:18:43 -05:00
Alan Phipps
8b2bdfbca7 [Coverage][clang] Enable MC/DC Support in LLVM Source-based Code Coverage (3/3)
Part 3 of 3. This includes the MC/DC clang front-end components.

Differential Revision: https://reviews.llvm.org/D138849
2024-01-04 12:29:18 -06:00
Valentin Clement
85939e5e24
[mlir][openacc][NFC] Rename custom parser from WaitOperands to DeviceTypeOperandsWithSegment 2024-01-04 10:28:37 -08:00
Adrian Prantl
c041fa1093 XFAIL test with dsymutil 2024-01-04 10:25:47 -08:00
Pete Steinfeld
4f59a38821
Revert #76194 (#76987)
[Flang] Revert "Allow Intrinsic simpification with min/maxloc dim
and…scalar result (#76194)"

This reverts commit 9b7cf5bfb08b6e506216ef354dfd61adb15acbff.

See merge request #76194.

This change was causing several failures in our internal tests. I'm
reverting now and will work on creating a test that David Green can use
to reproduce the problem.
2024-01-04 10:19:50 -08:00
Craig Topper
a960703466
[RISCV] Remove incomplete PRE_DEC/POST_DEC code for XTHeadMemIdx. (#76922)
As far as I can tell if getIndexedAddressParts received an ISD::SUB, the
constant would be negated. So `IsInc` should be set to true since the
SUB was effectively converted to ADD. This means we should never use
PRE_DEC/POST_DEC.

No tests are affected because DAGCombine aggressively turns SUB with
constant into ADD so no lit test has a SUB reach getIndexedAddressParts.
2024-01-04 09:48:40 -08:00
Zequan Wu
4004f655ce [LLDB][NativePDB] Fix use-after-free error detected by asan. 2024-01-04 12:32:40 -05:00
刘雨培
e78a1f491c
[Clang] Fix the instantiation of return type requirements in lambda bodies (#76967)
Currently, due to the incomplete implementation of p0588r1, the
instantiation of lambda expressions leads to the instantiation of the
body. And `EvaluateConstraints` is false during the instantiation of the
body, which causes crashes during the instantiation of the return type
requirement:

```cpp
template<typename T> concept doesnt_matter = true;

template<class T>
concept test = 
    []{
        return requires(T t) {
            { t } -> doesnt_matter; // crash
        };
    }();

static_assert(test<int>);
```

Although a complete implementation of p0588r1 can solve these crashes,
it will take some time. Therefore, this pull request aims to fix these
crashes first.

Fixes https://github.com/llvm/llvm-project/issues/63808
Fixes https://github.com/llvm/llvm-project/issues/64607
Fixes https://github.com/llvm/llvm-project/issues/64086
2024-01-05 01:32:10 +08:00
Adrian Prantl
9f9dd6be0d Wrap local type declarations in anonymous namespace to fix modules build. 2024-01-04 09:30:00 -08:00
Nishant Mittal
79a2e2b9e8
[libc][math] Fix is_quiet_nan function in FPBits (#76931) 2024-01-04 12:24:54 -05:00
Andrzej Warzyński
db9a16eaed
[mlir][nfc] Update comments in the Linalg vectoriser (#76797) 2024-01-04 17:24:22 +00:00
Simon Pilgrim
2cbf652615 [X86] avx512-pmovxrm.ll - replace X32 checks with X86. NFC.
We try to use X32 for gnux32 triples only.
2024-01-04 17:17:08 +00:00
Simon Pilgrim
63e3074781 [X86] aligned-variadic.ll - replace X32 checks with X86. NFC.
We try to use X32 for gnux32 triples only.
2024-01-04 17:17:07 +00:00
Simon Pilgrim
ce4459d590 [X86] 64-bit-shift-by-32-minus-y.ll - replace X32 checks with X86. NFC.
We try to use X32 for gnux32 triples only.
2024-01-04 17:17:07 +00:00
Simon Pilgrim
076dbc0272 [X86] SimplifyDemandedVectorEltsForTargetNode - add X86ISD::VZEXT_LOAD handling.
Simplify to a scalar_to_vector(load()) if we don't demand any of the upper vector elements.
2024-01-04 17:17:07 +00:00
Simon Pilgrim
5cd3cf1072 [X86] cvtv2f32.ll - replace X32 checks with X86. NFC.
We try to use X32 for gnux32 triples only.
2024-01-04 17:17:06 +00:00
Joseph Huber
c12a9fc279
[ELF] Correctly set the nvptx triple from makeTriple() (#76970)
Summary:
The ELFObject file should be able to handle `nvptx` objects but we
currently list them as unknown. This patch should now make it return
`nvptx64--` correctly.
2024-01-04 11:14:46 -06:00
Adrian Prantl
917b404e2c
Add support for inline DWARF source files. (#75880)
LLVM supports DWARF 5 linetable extension to store source files inline
in DWARF. This is particularly useful for compiler-generated source
code. This implementation tries to materialize them as temporary files
lazily, so SBAPI clients don't need to be aware of them.

rdar://110926168
2024-01-04 09:04:05 -08:00
Sam Tebbs
a7a78fd427
Revert "[Clang][SME] Add IsStreamingOrSVE2p1" (#76973)
Reverts llvm/llvm-project#75958

I mistakenly included a commit from my local main after rebasing.
2024-01-04 16:53:14 +00:00
Sam Tebbs
8f8152091c
[Clang][SME] Add IsStreamingOrSVE2p1 (#75958)
This patch adds IsStreamingOrSVE2p1 to the applicable builtins and a
warning for when those builtins are not used in a streaming or sve2p1
function.
2024-01-04 16:50:31 +00:00
Dmitry Vasilyev
569ec185f5 [llvm-cxxfilt] Added the option --no-params (#75348)
Added -p / --no-params flag to skip demangling function parameters
similar to how it is supported by GNU c++filt tool.

There are cases when users want to demangle a large number of symbols in
bulk, for example, at startup, and do not care about function parameters
and overloads at that time. Skipping the demangling of parameter types
led to a measurable improvement in performance. Our users reported about
15% speed up with GNU c++filt and we expect similar results with
llvm-cxxfilt with this patch.
2024-01-04 20:42:51 +04:00
Krystian Stasiowski
640ef55bbb
Reapply "[Clang][Sema] Diagnose unexpanded packs in the template argument lists of function template specializations" (#76876) (#76915)
This reapplies f034044ad94d6f7ccec13d89f08acac257ed28bb after it was
reverted by 687396b5f4ba0713d103ebd172b308e92eb930cc due to a test
failure in clang-doc.

The test in question declares a partial specialization of a function
template, as well as an explicit specialization of the same function
template. Both declarations are now set as invalid, meaning neither is
emitted by clang-doc.

Since this is the sole test of function template specializations in
clang-doc, I presume the intent is for the partial specialization to
actually be the primary template. Doing so results in the expected
output.
2024-01-04 17:30:48 +01:00
Jakub Kuderski
9215741726
[mlir] Make fold result type check more verbose (#76867)
Print the op and its types when the fold type check fails. This is to
speed up debuging as it should be trivial to map the offending op to its
folder based on the op name.
2024-01-04 11:08:36 -05:00
Gabriel Baraldi
a87fa7f0ca
[InstCombine] Dont throw away noalias/alias scope metadata when inlining memcpys (#74805)
This was found in julia when we changed some operations from explicit
loads + stores to memcpys. While applying it to both the src and the
dest seems weird, thats what we do for normal TBAA.
2024-01-04 17:04:31 +01:00
Oleksandr "Alex" Zinenko
b336ab42dc
[mlir] add a way to query non-property attributes (#76959)
This helps support generic manipulation of operations that don't (yet)
use properties to store inherent attributes.

Use this mechanism in type inference and operation equivalence.

Note that only minimal unit tests are introduced as all the upstream
dialects seem to have been updated to use properties and the
non-property behavior is essentially deprecated and untested.
2024-01-04 16:40:13 +01:00
Krzysztof Drewniak
2aff7f3919
[mlir][LLVM] Add !invariant.load metadata support to llvm.load (#76754)
Add support for !invariant.load metadata (by way of a unit attribute) to
the MLIR representation of llvm.load.
2024-01-04 09:33:09 -06:00
Matt Arsenault
460ffcddd9
AMDGPU: Make bf16/v2bf16 legal types (#76215)
There are some intrinsics are using i16 vectors in place of bfloat
vectors.
Move towards making bf16 vectors legal so these can migrate. Leave the
larger vectors for a later change.

Depends #76213 #76214
2024-01-04 22:31:18 +07:00
Guillaume Chatelet
d02471ede5
[libc][NFC] Simplify FPBits (#76835)
This patch reduces the scope of `FPBits` exported variables and
functions.
It also moves storage up into `FPRep` and tries to make the default and
specialized versions of `FPBits` more uniform.

The next step is to move the specialization from `FPBits` to `FPRep` so
we can manipulate floating point representations through `FPType` 
alone - that is - independently from the host architecture.
2024-01-04 16:14:28 +01:00
Alexey Bataev
79e62315be [SLP]Use revectorized value for extracts from buildvector, beeing
vectorized.

When trying to reuse the extractelement instruction, emitted for the
insertelement instruction, need to check, if the this insertelement
instruction was vectorized. In this case, need to use vectorized value,
not the original insertelement.
2024-01-04 06:45:26 -08:00
Simon Camphausen
96c23ebd3b
[mlir][EmitC] Use declarative assembly format for opaque types and attributes (#76066)
The parser and printer of string attributes were changed to handle
escape sequences. Therefore, we no longer require a custom parser and
printer. Verification is moved from the parser to the verifier
accordingly.
2024-01-04 15:43:33 +01:00
Pol M
901a8160a8
[clang] Optimize castToDeclContext for 2% improvement in build times (#76825)
Optimize castToDeclContext for 2% improvement in build times
castToDeclContext is a heavily used function, and as such, it needs to
be kept as slim as feasible to preserve as much performance as possible.
To this end, it was observed that the function was generating suboptimal
assembly code, and putting the most common execution path in the longest
sequence of instructions. This patch addresses this by guiding the
compiler towards generating a lookup table of offsets, which can be used
to perform an addition on the pointer. This results in a 1-2%
improvement on debug builds (and a negligible improvement on release).

To achieve this, the switch was simplified to flatten the if statements
in the default branch. In order to make the values of the switch more
compact, encouraging LLVM to generate a look-up table instead of a jump
table, the AST TableGen generator was modified so it can take order
priority based on class inheritance. This combination allowed for a more
optimal generation of the function. Of note, 2 other functions with an
equivalent structure also needed to be modified.

Fixes #76824
2024-01-04 15:42:35 +01:00
Mirko Brkusanin
e947b63516 [AMDGPU][NFC] Update alias test
Alias test should contain alternative names in check lines
2024-01-04 15:34:11 +01:00
Mauro Baladés
4e281e2cb7
[NFC][Clang] Avoid copying Param and Constr (#65488) 2024-01-04 15:22:54 +01:00
Nikita Popov
db34a94710 [ConstraintElim] Add tests for shl nsw decomposition (NFC) 2024-01-04 15:13:10 +01:00