502518 Commits

Author SHA1 Message Date
JoelWee
52bec3e362
Revert f5c2ef2597 2024-06-21 14:18:40 +01:00
Nikita Popov
48ef912e2b [VFS] Avoid <stack> include (NFC)
Directly use a vector instead of wrapping it in a stack, like we
do in most places.
2024-06-21 15:17:41 +02:00
zhijian lin
df86fb069e
[llvm-objdump] enable file-headers option of llvm-objdump for XCOFF object files (#96104)
the patch enable file-headers option of llvm-objdump for XCOFF object
files
2024-06-21 09:17:04 -04:00
JoelWee
f5c2ef2597
Fix bazel build after bc82793b 2024-06-21 14:12:06 +01:00
OverMighty
b5efd21429
[libc][math][c23] Add {ldexp,scalbn,scalbln}f16 C23 math functions (#94797)
Part of #93566.
2024-06-21 09:01:47 -04:00
Nikita Popov
c399aeacf6 [lldb] Remove YAMLTraits.h include (NFC)
The YAML functionality was dropped in
70599d70273b671b1b2e6a0e0b9c11e413209647, but this include was
left behind.
2024-06-21 14:56:26 +02:00
Aviad Cohen
cb8bd6f772
Introduce new Unroll And Jam loop transform for SCF/Affine loops (#94142)
Unroll And Jam was supported in affine dialect long time ago using pass.
This commit exposes the pattern using transform and in addition adds
partial support for SCF loops.
2024-06-21 15:48:11 +03:00
Hugo Trachino
9f0aa05bfb
[mlir][vector] Add ElementwiseToOuterproduct (#93664)
1D multi-reduction are lowered to arith which can prevent some
optimisations. I propose `ElementwiseToOuterproduct` matching a series of
ops to generate `vector.outerproduct`.
As part of some `ElementwiseToVectorOpsPatterns`, it could allow to fuse
other elementwiseOps to vector dialect.
Originally discussed
https://discourse.llvm.org/t/on-improving-arm-sme-lowering-resilience-in-mlir/78543/24.

quote @MacDue
```
%lhsBcast = vector.broadcast %lhsCast : vector<[4]xf32> to vector<[4]x[4]xf32>
%lhsT = vector.transpose %lhsBcast, [1, 0] : vector<[4]x[4]xf32> to vector<[4]x[4]xf32>
%rhsBcast = vector.broadcast %rhs : vector<[4]xf32> to vector<[4]x[4]xf32>
%mul = arith.mulf %lhsT, %rhsBcast : vector<[4]x[4]xf32>
```

Can be rewritten as:

```
%mul = vector.outerproduct $lhs, $rhs : vector<[4]xf32>, vector<[4]xf32>
```

---------

Co-authored-by: Han-Chung Wang <hanhan0912@gmail.com>
2024-06-21 13:34:37 +01:00
earnol
138ea7d1fb
Revert "[ubsan] Display correct runtime messages for negative _BitInt" (#96239)
Reverts llvm/llvm-project#93612 due to the issues with ppc64le platform.
2024-06-21 08:33:46 -04:00
Simon Pilgrim
8cf39881d1 [X86] combineConcatVectorOps - add pmaddwd/pmaddubsw handling 2024-06-21 13:25:29 +01:00
Oleksandr T
9b50a88853
[Clang] skip alignment checks on incomplete types to avoid an assertion failure while parsing lambda used as default argument (#94542)
Fixes #93512
2024-06-21 08:18:14 -04:00
Nikita Popov
9c4944095d [lldb] Add missing <stack> includes (NFC) 2024-06-21 14:05:36 +02:00
Nikita Popov
b23fe1088f [bolt] Add missing <stack> include (NFC) 2024-06-21 14:02:15 +02:00
Matt Arsenault
c026024ff9
AMDGPU: Legalize v2f16 atomicrmw fadd for buffer fat pointers (#95929)
Unfortunately the v2bf16 case is complicated because gfx90a
doesn't support it, while it does for global/flat.
2024-06-21 13:55:06 +02:00
Andrzej Warzyński
1c85c711aa
[mlir][vector] Refactor vector-transfer-flatten.mlir (nfc) (2/n) (#95744)
The main goal of this and subsequent PRs is to unify and categorize
tests in:
  * vector-transfer-flatten.mlir
  
This should make it easier to identify the edge cases being tested (and
how they differ), remove duplicates and to add tests for scalable
vectors.

Below are the main contributions of this PR

1. Two tests duplicated
  `@transfer_{read|write}_dims_mismatch_non_contiguous_slice`:
    * `@transfer_{read|write}_dims_mismatch_non_contiguous` and
    * `@transfer_read_flattenable_negative` duplicated
  `@transfer_{read|write}_dims_mismatch_non_contiguous_slice`.
  
   These tests are removed (the original test is preserved).

2. `@transfer_read_flattenable_negative2` is replaced with
   two tests with more descriptive names:
    * `@transfer_read_non_contiguous_src` (for `xfer_read`) and
    * `@transfer_write_non_contiguous_src` (for `xfer_write`)
2024-06-21 12:48:26 +01:00
Nikita Popov
f1075a34ab [FileSystem] Avoid <stack> include (NFC)
The standard pattern in LLVM is to directly use vectors for stacks,
without an additional std::stack wrapper to rename some methods.
2024-06-21 13:44:46 +02:00
Mehdi Amini
bc82793b30
[mlir] load dialects for non-namespaced attrs (#96242)
The mlir-translate tool calls into the parser without loading registered
dependent dialects, and the parser only loads attributes if the
fully-namespaced attribute is present in the textual IR. This causes
parsing to break when an op has an attribute that prints/parses without
the namespaced attribute.

Co-authored-by: Jeremy Kun <jkun@google.com>
2024-06-21 13:23:45 +02:00
Alexis Engelke
739a960567
[RegAlloc] Don't call always-true ShouldAllocClass (#96296)
Previously, there was at least one virtual function call for every
allocated register. The only users of this feature are AMDGPU and RISC-V
(RVV), other targets don't use this. To easily identify these cases,
change the default functor to nullptr and don't call it for every
allocated register.
2024-06-21 13:18:35 +02:00
Timm Bäder
c7c636189a [clang][Interp] Don't try to decay non-pointers to pointers 2024-06-21 13:15:35 +02:00
Nikita Popov
f12655ac1e [HLSLResource] Don't include Metadata.h (NFC)
This is only used for a single assert, so move it out of line.
This avoids a dependency on Metadata.h from large parts of clang.
2024-06-21 13:02:47 +02:00
Balázs Kéri
0290a0e64f
[clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (#89887)
In some situations a new `VarTemplateSpecializationDecl` (for the same
template) can be added during import of another one. The "insert
position" that is used to insert the current object into the list of
specializations is stored at start of the import and is used later. If
the list changes before the insertion the position is not valid any
more.
2024-06-21 12:51:43 +02:00
Alexis Engelke
0ae6cfc599
[RegAllocFast] Handle single-vdef instrs faster (#96284)
On x86, many instructions have tied operands, so allocateInstruction
uses the more complex assignment strategy, which computes the assignment
order of virtual defs first. This involves iterating over all register
classes (or register aliases for physical defs) to compute the possible
number of defs per register class.

However, this information is only used for sorting virtual defs and
therefore not required when there's only one virtual def -- which is a
very common case. As iterating over all register classes/aliases is not
cheap, do this only when there's more than one virtual def.
2024-06-21 12:30:59 +02:00
Sander de Smalen
b1ec1a2dc8 [AArch64] NFCI: More sensible implementation of isLegalMaskedGatherScatter.
Gather/Scatter instructions are only available if the whole of SVE
is available.
2024-06-21 10:29:44 +00:00
Alexis Engelke
cba4dfdd2f [RegAllocFast] Use unsigned for operand indices
MachineInstr operand indices can be up 24 bits currently. Use unsigned
as consistent data type for operand indices instead of uint16_t.
2024-06-21 10:25:28 +00:00
Nikita Popov
53a059ca76 [PassInstrumentation] Use DenseMap to store class->pass map (NFC)
It's okay to store the StringRef for the class name without
creating a separate copy inside the map, so use DenseMap instead
of StringMap.
2024-06-21 12:23:14 +02:00
Simon Pilgrim
57c083ecfb [X86] combine-pmadd.ll - add tests for concatenations of pmaddwd/pmaddubsw subvectors 2024-06-21 11:22:21 +01:00
Tom Eccles
0637778af4
[mlir][LLVMIR][OpenMP] fix dominance for reduction init block (#96052)
It was incorrect to set the insertion point to the init block after
inlining the initialization region because the code generated in the
init block depends upon the value yielded from the init region. When
there were multiple reduction initialization regions each with multiple
blocks, this could lead to the initilization region being inlined after
the init block which depends upon it.

Moving the insertion point to before inlining the initialization block
turned up further issues around the handling of the terminator for the
initialization block, which are also fixed here.

This fixes a bug in #92430 (but the affected code couldn't compile
before #92430 anyway).
2024-06-21 11:10:12 +01:00
David Spickett
906316eaba [lldb] More descriptive name for register flags logging functions
This was requested on a review for enum code that added new log
functions.
2024-06-21 10:05:48 +00:00
Andrzej Warzyński
34de7fd428
[mlir][vector] Refactor vector-transfer-flatten.mlir (nfc) (1/n) (#95743)
The main goal of this and subsequent PRs is to unify and categorize
tests in:
  * vector-transfer-flatten.mlir
  
This should make it easier to identify the edge cases being tested (and
how they differ), remove duplicates and to add tests for scalable
vectors.

The main contributions of this PR:
  * split tests that covered `xfer_read` + `xfer_write` into separate
tests (majority of the existing tests check _one_ xfer Op at a time),
  * organise tests for `xfer_read` and `xfer_write` into separate
    groups (separate with a big bold comment).

Note, all tests (i.e. test cases) are preserved and some new tests are
added. Deletions that you will see in `git diff` correspond to
`xfer_write` and `xfer_read` Ops being extracted to separate functions
(so that there's one xfer Op per function). In particular, the number of
test functions has grown from 26 to 30.

In addition, this PR unifies the tests so that:
  * input variable names are consistent (e.g. make sure that the input
    memref is always `arg`)
  * CHECK lines use similar indentations
  * 2 x tabs are always used for function arguments, 1 x tab for
    function body

Finally, changes in "VectorTransferOpTransforms.cpp" are merely meant to
unify comments and logic between
  * `FlattenContiguousRowMajorTransferWritePattern` and
  * `FlattenContiguousRowMajorTransferReadPattern`.
2024-06-21 10:55:45 +01:00
Chuanqi Xu
d4d95ee651 [Serialization] Register identifiers in ahead and don't emit predefined decls
See the added test for the motivation example. In that example, we add a
new function declaration in `a.cppm` and this is not used in the reduced
BMI of `b.cppm`. We expect that the change won't affect the BMI of
`b.cppm`. But it is the not the case.

There are 2 reason for unexpected result:
1. We would register the interesting identifiers in a pretty late phase.
   This may cause some some predefined identifier ID change due to we
   insert other identifiers during emitting decls and types.
2. In `GenerateNameLookup`, we would generate information for predefined
   decls. This may not be intended. Since every predefined decl doesn't
   belong to any module.

And this patch solves the first issue by registering the identifiers in
the very early posititon to make sure the ID won't get affected by the
process to emit decls and types. And we solve the second question by
filtering predefined decls simply.
2024-06-21 17:50:30 +08:00
Vlad Serebrennikov
2b5d1fb889
[clang] Add test for CWG2811 "Clarify "use" of main" (#96168)
This patch covers
[CWG2811](https://cplusplus.github.io/CWG/issues/2811.html) "Clarify
"use" of main", basically adding a test for `-Wmain`, focusing on usages
of `main` in unevaluated contexts.

To my understanding, the diagnostic message is based on the wording, so
I updated it based on the new wording. I also replaces "ISO C++
requires" with a phrasing that explicitly says "extension".
2024-06-21 13:50:03 +04:00
Vlad Serebrennikov
bc4d50f02d
[clang] Implement CWG2877 "Type-only lookup for using-enum-declarator" (#95399)
This patch implements 2024-05-31 resolution of a tentatively ready issue
[CWG2877](https://cplusplus.github.io/CWG/issues/2877.html) "Type-only
lookup for using-enum-declarator", which supersedes earlier
[CWG2621](https://cplusplus.github.io/CWG/issues/2621.html) "Kind of
lookup for `using enum` declarations".

Now we perform type-only lookup (not to be confused with type-only
context) for `elaborated-enum-declarator`. This is the same kind of
lookup that elaborated type specifiers and base specifiers undergo.

I also found out (and fixed) that one of our existing tests claimed that
a dependent type can be used in `elaborated-enum-declarator`, but that's
not the case:
> The
[using-enum-declarator](http://eel.is/c++draft/enum.udecl#nt:using-enum-declarator)
shall designate a non-dependent type with a reachable
[enum-specifier](http://eel.is/c++draft/dcl.enum#nt:enum-specifier)[.](http://eel.is/c++draft/enum.udecl#1.sentence-2)
2024-06-21 13:49:43 +04:00
Vlad Serebrennikov
aed989157d
[clang] Cover CWG issues about export template (#94876)
This PR covers the following Core issues:
[CWG204](https://cplusplus.github.io/CWG/issues/204.html) "Exported
class templates"
[CWG323](https://cplusplus.github.io/CWG/issues/323.html) "Where must
`export` appear?"
[CWG335](https://cplusplus.github.io/CWG/issues/335.html) "Allowing
`export` on template members of nontemplate classes"
[CWG820](https://cplusplus.github.io/CWG/issues/820.html) "Deprecation
of `export`"

I believe the list above is entirety of Core issues that are dedicated
solely to `export template`.

I believe we have two main points of view here, which command what this
PR should do:
1. (easy) Removal of `export template` was done as a defect report in
CWG820, and the rest are effectively superseded by it, because we apply
defect reports retroactively.
2. (harder) Those Core issues are testable individually, so we should
test them for the behavior Core wanted at the time.

This PR implements the first option, making our C++ DR status page
greener.
I think I can be persuaded to go with the second option, if reviewers
have strong preference for it.
2024-06-21 13:49:04 +04:00
Nikita Popov
b23bd529c3 [PassInstrumentation] Use try_emplace() (NFC)
To avoid a duplicate hash map lookup.
2024-06-21 11:48:06 +02:00
David Green
e887624aca
[AArch64][GlobalISel] Add fp128 and i128 fptosi/fptoui handling. (#95528)
Any fp128 need to end up as libcall, as will f32->i128 and f64->i128.
f16 are a bit special as the maximum range of the result fits in a i17,
so can be shrank to an i64. Vector with i128/fp128 types are scalarized.
2024-06-21 10:24:57 +01:00
Abid Qadeer
c2a22f1a72
[flang][debug] Cleanup tests. (NFC) (#96189)
@kiranchandramohan mentioned
[here](https://github.com/llvm/llvm-project/pull/91582#discussion_r1606046605)
that LLVM IR tests should go in the Integration folder. He also
mentioned
[here](https://github.com/llvm/llvm-project/pull/91582#discussion_r1606684034)
that tests for `add-debug-info` pass should test that pass only. There
were some tests which were added before his comments so I have cleaned
them in this PR. The following changes were made.

1. Move LLVM IR tests to `Integration` folder.
2. Change tests from f90 to fir and only test changes done by
`add-debug-info` pass.
2024-06-21 10:16:53 +01:00
Sander de Smalen
a078416a85 [AArch64] Fix up failing test that should have been caught by precommit
Not sure why Github precommit tests didn't show this. Do they not build
for all targets?
2024-06-21 08:54:18 +00:00
Noah Goldstein
ef16f7ac1b [CodeGenPrepare] Add missing static decl on matchIncrement(); NFC 2024-06-21 16:41:03 +08:00
Anton Sidorenko
d59a4cac5f
[RISCV] Add Syntacore SCR3 processor definition (#95953)
Syntacore SCR3 is a microcontroller-class processor core. Overview:
https://syntacore.com/products/scr3
This PR introduces two CPUs:
  * 'syntacore-scr3-rv32' which is rv32imc
  * 'syntacore-scr3-rv64' which is rv64imac

---------

Co-authored-by: Dmitrii Petrov <dmitrii.petrov@syntacore.com>
2024-06-21 11:40:10 +03:00
Alexandros Lamprineas
7c946f04cf
[GlobalOpt] Don't resolve aliased ifuncs with undefined resolvees. (#96220)
Fixes https://github.com/llvm/llvm-project/issues/96197.

A global alias should always point to a definition. Ifuncs are
definitions, so far so good. However an ifunc may be statically resolved
to a function that is declared but not defined in the translation unit.

With this patch we perform static resolution if:
 * the resolvee is defined, else if
 * none of the ifunc users is a global alias
2024-06-21 09:33:41 +01:00
David Green
c6a257fe0f [AArch64] Fix || Add brackets for || inside of assert
Fixes:
llvm/lib/Target/AArch64/AArch64GenRegisterBankInfo.def:185:12: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
assert(!Size.isScalable() || MinSize >= 128
                             ~~~~~~~~~~~~~~
       && "Scalable vector types should have size of at least 128 bits");
2024-06-21 09:26:45 +01:00
David Green
09cdbd2a5c [AArch64] Use AArch64ISD::UADDLP over aarch64_neon_uaddlp. NFC 2024-06-21 09:26:45 +01:00
David Green
b635d690ed [NFC] Fix laod -> load typos. NFC 2024-06-21 09:26:44 +01:00
Noah Goldstein
db03d9d33a Recommit "[Inliner] Propagate callee argument memory access attributes before inlining" (2nd Try)
In the re-commit, just dropping the propagation of `writeonly` as that
is the only attribute that can play poorly with call slot optimization
(see issue: #95152 for more details).

Closes #95888
2024-06-21 16:14:28 +08:00
Timm Baeder
0adecfbc39
[clang][test] Enable a commented-out test (#96195)
This doesn't seem to crash anymore.
2024-06-21 09:35:25 +02:00
Timm Bäder
ae41232191 [clang][Interp] Fix Descriptor::getElemQualType() for complex/vectors
We handle them like arrays but still need to differentiate between
array/vector/complex types when dealing with QualTypes.
2024-06-21 09:34:18 +02:00
Matthias Springer
0255c48188
[mlir][Transforms] Dialect conversion: Remove workaround (#96186)
This commit removes a `FIXME` in the code base that was in place because
of patterns that used the dialect conversion API incorrectly. Those
patterns have been fixed and the workaround is no longer needed.
2024-06-21 09:13:52 +02:00
Sander de Smalen
b39f523af7
[Clang][AArch64] Expose compatible SVE intrinsics with only +sme (#95787)
This allows code with SVE intrinsics to be compiled with +sme,+nosve,
assuming the encompassing function is in the correct mode (see #93802)
2024-06-21 08:13:18 +01:00
Andrzej Warzyński
218f07014a
[mlir][vector] Update tests for collapse 4/n (nfc) (#96214)
The main goal of this PR (and subsequent PRs), is to add more tests with
scalable vectors to:
  * vector-transfer-collapse-inner-most-dims.mlir

There's quite a few cases to consider, hence this is split into multiple
PRs. In this PR, `@outer_dyn_drop_inner_most_dim` is replaced with:
  * `@contiguous_inner_most_dynamic_outer`

I am also adding a similar test for scalable vectors. In addition,
  * `@drop_two_inner_most_dim` and
    `@drop_two_inner_most_dim_scalable_inner_dim`,

are renamed as `@contiguous_inner_most` and 
`@contiguous_inner_most_scalable_inner_dim`, respectively, to match
their counterpart for `xfer_read`.

NOTE: This PR is limited to tests for `vector.transfer_write`

This is a follow-up for: #94490, #94604, #94906
2024-06-21 08:04:40 +01:00
Fangrui Song
874dcaea09
[Serialization] Use stable hash functions
clangSerialization currently uses hash_combine/hash_value from
Hashing.h, which are not guaranteed to be deterministic.
Replace these uses with xxh3_64bits.

Pull Request: https://github.com/llvm/llvm-project/pull/96136
2024-06-20 23:53:07 -07:00