474263 Commits

Author SHA1 Message Date
Felipe de Azevedo Piovezan
26ca2f47c1 [DebugInfo] Parse StrOffsets section if needed
Querying the debug_str_offsets section requires parsing the top level DIE of the
CU (as well as the section itself); the current getter, however, assumes this is
done elsewhere. This patch changes the getter behavior to match what is done in
other getter methods (e.g.  `getCompilationDir` or `getVariableForAddress`), in
other words, `extractDIEsIfNeeded` is now called prior to returning the
debug_str_offsets contributions for the Unit.

One way in which this bug manifested is when `dwarfdump --debug-str-offsets` is
invoked: because the DIEs are never parsed, we incorrectly print an empty
section (with no warnings or errors).

Differential Revision: https://reviews.llvm.org/D159484
2023-09-11 09:59:21 -04:00
Ying Chen
d9c9c9f2d9
[NFC][Clang][RISCV] Fix typos of riscv-v-spec doc in riscv_vector.td (#65944)
Fix index typos, s.t. indexes in comments be same with riscv-v-spec v1.0 doc.
2023-09-11 21:58:51 +08:00
Giuliano Belinassi
0323938d3c Fix warning in MSVC
Currently there is no PrintOnLeft attribute set, which results in an
empty switch-case. When compiling this, MSVC issues a warning saying
that the switch-case is empty. Fix this by using a macro and checking
if this macro is defined or not.

Links to D157394
2023-09-11 06:51:11 -07:00
Michael Halkenhäuser
12ac0f6ede
[OpenMP][DeviceRTL][AMDGPU] Add missing libomptarget build targets (#65964)
Extend CMake variable `all_amdgpu_architectures` by `gfx941` and
`gfx942`.
2023-09-11 15:43:51 +02:00
liqin.weng
3723ede3cf [VP] IR expansion for zext/sext/trunc/fptosi/fptosi/sitofp/uitofp/fptrunc/fpext
Add basic handling for VP ops that can expand to Cast intrinsics

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D159491
2023-09-11 21:14:38 +08:00
liqin.weng
28e74e6180 [VP] IR expansion for abs/smax/smin/umax/umin
Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D159495
2023-09-11 21:14:37 +08:00
Balazs Benics
706afc9778 Fixup "[analyzer] CStringChecker buffer access checks should check the first bytes"
0954dc3fb9214b994623f5306473de075f8e3593 broke a build bot:
https://lab.llvm.org/buildbot/#/builders/245/builds/13891

  clang/test/Analysis/string.c
  Line 74: incompatible redeclaration of library function 'memcpy'
  Line 74: 'memcpy' is a builtin with type 'void *(void *, const void *, unsigned int)'

Differential Revision: https://reviews.llvm.org/D159109
2023-09-11 15:01:22 +02:00
Matthias Springer
5b96fcb5b8
[mlir][Interfaces][NFC] DestinationStyleOpInterface: Improve documentation (#65927)
Mention that sizes of dynamic dims of tied OpResults/operands match at
runtime.
2023-09-11 15:00:31 +02:00
Martin Lücke
6d2b2b8eaf [MLIR][PDL] Add Bytecode support for negated native constraints
Differential Revision: https://reviews.llvm.org/D153878
2023-09-11 12:57:41 +00:00
Sameer Sahasrabuddhe
08da343750
[Convergence] allow non-convergent ops before entry and loop intrinsics (#65939)
The only real requirement is that entry and loop intrinsics should not
be preceded by convergent operations in the same basic block. They do
not need to be the first in the block.

Relaxing the constraint on the entry and loop intrinsics avoids having
to make changes in the construction of LLVM IR, such as
getFirstInsertionPt(). It also avoids added complexity in the lowering
to Machine IR, where COPY instructions may be added to the start of the
basic block.
2023-09-11 18:26:07 +05:30
Guray Ozen
ad4411230a
[MLIR] Make SM_90 integration tests use TargetAttr (#65926)
The 'TargetAttr' workflow was recently introduced to serialization for
'MLIR->LLVM->PTX'. #65857 removes previous passes (gpu::Serialization*
passes) because they are duplicates.

This PR removes the use of gpu::Serialization* passes in SM_90
integration tests, and enables the 'TargetAttr' workflow.

It also moves the transform dialect specific test to a new folder.
2023-09-11 14:34:03 +02:00
Balazs Benics
0954dc3fb9 [analyzer] CStringChecker buffer access checks should check the first bytes
By not checking if the first byte of the buffer is accessible,
we missed some reports in the Juliet benchmark.

(Juliet CWE-124 Buffer Underwrite: memcpy, memmove)
https://discourse.llvm.org/t/patches-inspired-by-the-juliet-benchmark/73106

Depends on D159108

Differential Revision: https://reviews.llvm.org/D159109
2023-09-11 14:19:33 +02:00
Balazs Benics
c3a87ddad6 [analyzer] CStringChecker should check the first byte of the destination of strcpy, strncpy
By not checking if the first byte of the destination of strcpy and
strncpy is writable, we missed some reports in the Juliet benchmark.

(Juliet CWE-124 Buffer Underwrite: strcpy, strncpy)
https://discourse.llvm.org/t/patches-inspired-by-the-juliet-benchmark/73106

Differential Revision: https://reviews.llvm.org/D159108
2023-09-11 14:19:33 +02:00
Sergio Afonso
4b9259b947
Revert "[Flang][OpenMP][Sema] Support propagation of REQUIRES information across program units"
Changes in this commit make some gfortran tests crash the compiler. It is
likely trying to dereference undefined symbol pointers.

This reverts commit 3787fd942f3927345320cc97a479f13e44355805.
2023-09-11 13:01:29 +01:00
Max Iyengar
dbeb3d029d Add missing vrnd intrinsics
This patch adds 8 missing intrinsics as specified in the Arm ACLE document section 2.12.1.1 : [[ https://arm-software.github.io/acle/neon_intrinsics/advsimd.html#rounding-3 | https://arm-software.github.io/acle/neon_intrinsics/advsimd.html#rounding-3]]

The intrinsics implemented are:

  - vrnd32z_f64
  - vrnd32zq_f64
  - vrnd64z_f64
  - vrnd64zq_f64
  - vrnd32x_f64
  - vrnd32xq_f64
  - vrnd64x_f64
  - vrnd64xq_f64

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D158626
2023-09-11 12:59:18 +01:00
Hristo Hristov
623bb5c2c2 [libc++][ranges][NFC] Status page: Adds enumerate_view patch 2023-09-11 14:43:19 +03:00
Matthias Springer
339753de12
[mlir][vector][NFC] isDisjointTransferIndices: Use getConstantIntValue (#65931)
Use `getConstantIntValue` instead of matching for `arith::ConstantOp`.
2023-09-11 13:30:36 +02:00
Mikhail Goncharov
24846789f2
updated buildkite pipeline generation (#65574)
- fixed build for linux (clang was missing)

- removed /monolithic-.. from build directory - it does not add anything
and makes path longer for windows which is not great;

- added env-based configuration to control cache and agent targeting;

- print (s)ccache stats to file not to pullute normal log.
2023-09-11 13:20:34 +02:00
David Spickett
825adbe558 [lldb] Don't tab complete stop-hook delete beyond 1st argument
This already applies to enable and disable, delete was missing
a check.

This cannot be tested properly with the current completion tests,
but it will be when I make them more strict in a follow up patch.
2023-09-11 11:00:57 +00:00
Simon Pilgrim
ef87d43834 Revert rGa8cef6b58e2d41f04ed4fa63c3f628eac1a28925 "[X86] promoteExtBeforeAdd - add support for or/xor 'addlike' patterns"
Investigating reports of issues with second stage clang builds
2023-09-11 11:52:25 +01:00
jeanPerier
8b13775d6a
[flang] Improve length information in character transformational (#65771)
Intrinsic resolution currently does not resolve constant length
information for character transformational (with "sameChar") where the
argument has constant length but is not a variable or a constant
expression.

It is not required to fold those expressions (only inquiry on constant
expression or variable with constant length is required to be a constant
expression).

But constant length information for character is valuable for lowering,
so I think this is a nice and easy to have.
2023-09-11 12:52:11 +02:00
Jeremy Morse
6942c64e81 [NFC][RemoveDIs] Prefer iterator-insertion over instructions
Continuing the patch series to get rid of debug intrinsics [0], instruction
insertion needs to be done with iterators rather than instruction pointers,
so that we can communicate information in the iterator class. This patch
adds an iterator-taking insertBefore method and converts various call sites
to take iterators. These are all sites where such debug-info needs to be
preserved so that a stage2 clang can be built identically; it's likely that
many more will need to be changed in the future.

At this stage, this is just changing the spelling of a few operations,
which will eventually become signifiant once the debug-info bearing
iterator is used.

[0] https://discourse.llvm.org/t/rfc-instruction-api-changes-needed-to-eliminate-debug-intrinsics-from-ir/68939

Differential Revision: https://reviews.llvm.org/D152537
2023-09-11 11:48:45 +01:00
Sergio Afonso
3787fd942f
[Flang][OpenMP][Sema] Support propagation of REQUIRES information across program units
This patch adds support for storing OpenMP REQUIRES information in the
semantics symbols for programs/subprograms and modules/submodules, and
populates them during directive resolution. A pass is added to name resolution
that makes sure this information is also propagated across top-level programs,
functions and subprograms.

Storing REQUIRES information inside of semantics symbols will also allow
supporting the propagation of this information across Fortran modules. This
will come as a separate patch.

The `bool DirectiveAttributeVisitor::Pre(const parser::SpecificationPart &x)`
method is removed since it resulted in specification parts being visited twice.

This is patch 3/5 of a series splitting D149337 to simplify review.

Differential Revision: https://reviews.llvm.org/D157983
2023-09-11 11:48:07 +01:00
David Sherwood
7d574ffa09 [NFC][Analysis] Run update_analyze_test_checks.py on Analysis/CostModel/AArch64/sve-ldst.ll 2023-09-11 10:39:22 +00:00
Andrzej Warzyński
718af88376
[mlir][vector] Extend mask calculation for vector.contract (#65733)
Make sure that when calculating the expected mask for `vector.contract`,
scalable sizes are correctly taken into account.

Depends on: #65724
2023-09-11 11:34:47 +01:00
Timm Bäder
4b5fe9c42d [clang][Interp] Check floating results for NaNs
Differential Revision: https://reviews.llvm.org/D156506
2023-09-11 12:21:36 +02:00
Michael Halkenhäuser
53602e6193
[OpenMP][OMPT] Fix device identifier collision during callbacks (#65595)
Fixes: https://github.com/llvm/llvm-project/issues/65104
When a user assigns devices to target regions it may happen that
different identifiers will map onto the same id within different
plugins. This will lead to situations where callbacks will become much
harder to read, as ambiguous identifiers are reported.

We fix this by collecting the index-offset upon general RTL
initialization. Which in turn, allows to calculate the unique,
user-observable device id.
2023-09-11 12:11:44 +02:00
Timm Bäder
87461d6696 [clang][Interp] Implement __builtin_offsetof
Differential Revision: https://reviews.llvm.org/D156400
2023-09-11 12:03:47 +02:00
Guillaume Chatelet
6632882a38
[libc][bazel] Add CPP tests (#65941)
This PR adds tests for the `src/__support/CPP` folder to the bazel build
system.
2023-09-11 11:52:05 +02:00
Guillaume Chatelet
88348252a6
[libc] Add missing add_lvalue_reference_t (#65940) 2023-09-11 11:31:37 +02:00
Kiran Chandramohan
0677a9d559
[Flang][OpenMP] Minor changes in reduction to work with HLFIR (#65775)
Changes are to work correctly in the presence of hlfir.declare, and
hlfir.assign (instead of fir.store).
2023-09-11 10:30:01 +01:00
Simon Pilgrim
a8cef6b58e [X86] promoteExtBeforeAdd - add support for or/xor 'addlike' patterns
Fold zext(addlike(x, C)) --> add(zext(x), C_zext) if its likely to help us create LEA instructions

Addresses some regressions exposed by D155472
2023-09-11 10:17:34 +01:00
Simon Pilgrim
79941c3a0d [X86] lea-2.ll - add test showing failure to fold shl(zext(or(x,c1)),c2) 'addlike' into LEA instruction 2023-09-11 10:17:33 +01:00
Nathan Gauër
56396b25f1 [SPIRV-V] Add SPIR-V logical triple to llc
This commits adds the minimal required bits to build a logical SPIR-V
compute shader using LLC.
- Skip OpenCL-only capabilities & extensions for Logical SPIR-V.
- Generate required metadata for entrypoints from HLSL frontend.
- Fix execution mode to GLCompute in logical.

The main issue is the lack of "vulkan" bit in the triple.
This might need to be added as a vendor?
Because as-is, SPIRV32/64 assumes OpenCL, and then, SPIRV assumes
Vulkan. This is ok-ish today, but not correct.

Differential Revision: https://reviews.llvm.org/D156424
2023-09-11 10:31:50 +02:00
Cullen Rhodes
38eb55a130
[mlir][llvm] Return failure from type converter for n-D scalable vectors (#65450)
This patch changes vector type conversion to return failure on n-D
scalable vector types instead of asserting.

This is an alternative approach to #65261 that aims to enable lowering
of Vector ops directly to ArmSME intrinsics where possible, and seems
more consistent with other type conversions. It's trivial to hit the
assert at the moment and it could be interpreted as n-D scalable vector
types being a bug, when they're valid types in the Vector dialect.

By returning failure it will generally fail more gracefully,
particularly for release builds or other builds where assertions are
disabled.
2023-09-11 09:31:48 +01:00
Viktoriia Bakalova
13e5fafb55 [clangd] Fix buildbot breakages from stemming from 64366d4935d3c56ce5906a321edb2e91d4f886bc 2023-09-11 08:30:06 +00:00
Nathan Gauër
53b6a169e4 [SPIR-V] Add SPIR-V logical triple.
Clang implements SPIR-V with both Physical32 and Physical64 addressing
models. This commit adds a new triple value for the Logical
addressing model.

Differential Revision: https://reviews.llvm.org/D155978
2023-09-11 10:15:24 +02:00
Carl Ritson
3bff611068 [PHIElimination] Handle subranges in LiveInterval updates
Add handling for subrange updates in LiveInterval preservation.
This requires extending MachineBasicBlock::SplitCriticalEdge
to also update subrange intervals.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D158144
2023-09-11 17:15:09 +09:00
Andrzej Warzyński
7ec8fd4cc7
[mlir][Vector] Make vector.contract work with scalable vectors (#65724)
This is just a small fix that makes sure that `vector.contract` works
with scalable vectors.

Rather than duplicating all the roundtrip tests for vector.contract, I'm
treating scalable vectors as an edge case and just adding a couple to
verify that this works.
2023-09-11 09:14:25 +01:00
Matthew Mirvish
4af340a6af
[clangd] Forward --target to system include extraction (#65824)
Some clang multilib configurations (such as the one currently used in
the [beta ARM LLVM
toolchain](https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm))
wind up only reporting the C++ include paths properly if they get passed
the correct target. This patch ensures the `--target` (or `-target`)
arguments are correctly sent to the queried driver.
2023-09-11 04:11:37 -04:00
Jingu Kang
5474d49f1f [AArch64] Remove copy instruction between uaddlv and urshr
If there are copy instructions between uaddlv and urshr for transfer from gpr
to fpr, and vice versa, try to remove them.

Differential Revision: https://reviews.llvm.org/D159265
2023-09-11 09:06:09 +01:00
Julian Schmidt
94b14355e2 [clangd] allow extracting to variable for lambda expressions
Support for extracting lambda expressions, e.g. extracting a lambda from a callexpr (e.g. algorithms/ranges) to a named variable.

Reviewed By: nridge

Differential Revision: https://reviews.llvm.org/D141757
2023-09-11 04:03:38 -04:00
Viktoriia Bakalova
64366d4935 [clangd] Rollforward include-cleaner library usage in symbol collector.
Differential Revision: https://reviews.llvm.org/D156659
2023-09-11 07:57:35 +00:00
martinboehme
2757085e90
[clang][dataflow][NFC] Delete unused function. (#65602)
I'm not sure why we had this originally, but the function seems to have
a pretty
onerous contract anyway for a function that is externally available, so
it seems
better not to keep it around.
2023-09-11 09:54:50 +02:00
David Spickett
2d670fab4c [clang][AArch64] Fix supported extensions test case
Added in 90db4193f82937bff68c8f8a1481320f245f04ff.
Typo in the if, should have been "riscv-...".
2023-09-11 07:50:52 +00:00
Nathan Gauër
d837795946 [NFC] test commit
Testing commit access.
2023-09-11 09:48:29 +02:00
Fangrui Song
fcc761bd0e [ELF][test] Make tests less sensitive to addresses/number of sections 2023-09-11 00:26:22 -07:00
David Spickett
90db4193f8
[clang][AArch64] Add --print-supported-extensions support (#65466)
This follows the RISC-V work done in
4b40ced4e5ba10b841516b3970e7699ba8ded572.

This uses AArch64's target parser instead. We just list the names,
without the "+" on them, which matches RISC-V's format.

```
$ ./bin/clang -target aarch64-linux-gnu --print-supported-extensions
clang version 18.0.0 (https://github.com/llvm/llvm-project.git 154da8aec20719c82235a6957aa6e461f5a5e030)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: <...>
All available -march extensions for AArch64

        aes
        b16b16
        bf16
        brbe
        crc
        crypto
        cssc
        <...>
```

Since our extensions don't have versions in the same way there's just
one column with the name in.

Any extension without a feature name (including the special "none") is
not listed as those cannot be passed to -march, they're just for the
backend. For example the MTE extension can be added with "+memtag" but
MTE2 and MTE3 do not have feature names so they cannot be added to
-march.

This does not attempt to tackle the fact that clang allows invalid
combinations of AArch64 extensions, it simply lists the possible
options. It's still up to the user to ask for something sensible.

Equally, this has no context of what CPU is being selected. Neither does
the RISC-V option, the user has to be aware of that.

I've added a target parser test, and a high level clang test that checks
RISC-V and AArch64 work and that Intel, that doesn't support this, shows
the correct error.
2023-09-11 08:25:02 +01:00
Brad Smith
00add6ed24
[Driver] Remove duplicate -e on DragonFly (#65867)
62281227bf7ca48d0101e4c9d11f71600208c7df was commited, but I noticed one
spot was missed in the DragonFly Driver.
2023-09-11 03:21:44 -04:00
Owen Pan
b908123c3c [clang-format][NFC] Minor cleanup of token annotator and test cases 2023-09-11 00:18:57 -07:00