Commit Graph

455585 Commits

Author SHA1 Message Date
Philip Reames
2cfd06ba67 [BoundsChecking] Don't crash on scalable vector sizes 2023-03-23 08:53:41 -07:00
Felipe de Azevedo Piovezan
c640a146c4 [lldb] Explicitly set libcxx paths when USE_SYSTEM_STDLIB is provided
For tests marked as "USE_SYSTEM_STDLIB", the expectation is that the
system's standard library should be used. However, the implementation of
this flag is such that we simply don't pass _any_ libcxxx-related flags
to Clang; in turn, Clang will use its defaults.

For a Clang/Libcxx pair compiled together, Clang defaults to:
1. The headers of the sibling libcxx.
2. The libraries of the system.

This mismatch is actually a bug in the driver; once fixed, however, (2)
would point to the sibling libcxx as well, which is _not_ what test
authors intended with the USE_SYSTEM_STDLIB flag.

As such, this patch explicitly sets a path to the system's libraries.
This change is done only in Apple platforms so that we can test this
works in this case first.

Differential Revision: https://reviews.llvm.org/D146714
2023-03-23 11:53:13 -04:00
Jan Sjodin
85faee6992 [OpenMP][OMPIRBuilder] Make OffloadEntriesInfoManager a member of OpenMPIRBuilder
This patch adds the OffloadEntriesInfoManager to the OpenMPIRBuilder, and
allows the OffloadEntriesInfoManager to access the Configuration in the
OpenMPIRBuilder.  With the shared Config there is no risk for inconsistencies,
and there is no longer the need for clang to have a separate
OffloadEntriesInfoManager.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D146549
2023-03-23 11:46:28 -04:00
Job Noorman
fd1850b361 Test commit to see if write access works 2023-03-23 16:27:44 +01:00
Philip Reames
5eb9acf9be [HWASAN] Instrument scalable load/store without crashing
We can simply push them down the existing call slowpath with some minor changes to how we compute the size argument.
2023-03-23 08:24:30 -07:00
Kirill Stoimenov
f570bd8f63 [HWASAN] Disable unexpected_format_specifier_test because HWASAN doesn't provide a printf interceptor
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D146647
2023-03-23 15:15:56 +00:00
Archibald Elliott
6194446962 [AArch64] Add Missing Custom Target Operands
I noticed, when examining the generated Asm Matcher table, that some of
these custom immediate operands are missing, and so we are not parsing
some hint aliases into the correct MCInst.

Where this becomes apparent is when you parse e.g. `hint #7` into an
MCInst - without these cases, it becomes the MCInst `(HINT 17)`, which
will always be printed as `hint #17`. With these cases, it becomes the
MCInst `XPACLRI`, which will be printed as `xpaclri` with pauth, or
`hint #17` without, matching how `xpaclri` is parsed.

We only handle some specific hint aliases in this manner, usually where
these hints have specific effects that need to be modelled for accurate
code-generation. Otherwise, we just use the normal `InstAlias` system
to have the aliases parsed into a `(HINT N)` MCInst.

Differential Revision: https://reviews.llvm.org/D146630
2023-03-23 15:14:07 +00:00
Corentin Jabot
82c83d7e41 [Clang] Fix evaluation of parameters of lambda call operator attributes
Fix a regresion introduced by D124351.
Attributes of lambda call operator were evaluated in the
context of the closure object type rather than its operator,
causing an assertion failure.

This was because we temporarily switch to the class lambda to
produce the mangling of the lambda, but we stayed in that
context too long.

Reviewed By: eandrews, aaron.ballman

Differential Revision: https://reviews.llvm.org/D146535
2023-03-23 16:11:58 +01:00
Philip Reames
5bcb4c4da9 [MSAN] Support load and stores of scalable vector types
This adds support for scalable vector types - at least far enough to get basic load and store cases working. It turns out that load/store without origin tracking already worked; I apparently got that working with one of the pre patches to use TypeSize utilities and didn't notice. The code changes here are required to enable origin tracking.

For origin tracking, a 4 byte value - the origin - is broadcast into a shadow region whose size exactly matches the type being accessed. This origin is only written if the shadow value is non-zero. The details of how shadow is computed from the original value being stored aren't relevant for this patch.

The code changes involve two related primitives.

First, we need to be able to perform that broadcast into a scalable sized memory region. This requires the use of a loop, and appropriate bound. The fixed size case optimizes with larger stores and alignment; I did not bother with that for the scalable case for now. We can optimize this codepath later if desired.

Second, we need a way to test if the shadow is zero. The mechanism for this in the code is to convert the shadow value into a scalar, and then zero check that. There's an assumption that this scalar is zero exactly when all elements of the shadow value are zero. As a result, we use an OR reduction on the scalable vector. This is analogous to how e.g. an array is handled. I landed a bunch of cleanup changes to remove other direct uses of the scalar conversion to convince myself there were no other undocumented invariants.

Differential Revision: https://reviews.llvm.org/D146157
2023-03-23 07:37:56 -07:00
khei4
434b0badb5 [AggressiveInstCombine] folding load for constant global patterened arrays and structs by alignment
Differential Revision: https://reviews.llvm.org/D144445
Reviewed By: nikic

fix: wrong arrow
2023-03-23 23:31:22 +09:00
khei4
c7a3284de3 [AggressiveInstCombine] Pre-Commit test for D144445 (NFC)
Differential Revision: https://reviews.llvm.org/D145355

tweak: test
2023-03-23 23:31:22 +09:00
Doru Bercea
0eabf59528 Enable constexpr class members that are device-mapped to not be optimized out.
This patch fixes an issue whereby a constexpr class member which is
mapped to the device is being optimized out thus leading to a runtime
error.

Patch: https://reviews.llvm.org/D146552
2023-03-23 10:17:25 -04:00
Ye Luo
3ab79124db [OpenMP] Add notifyDataUnmapped back in disassociatePtr
Fix regression introduced by https://reviews.llvm.org/D123446

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D146689
2023-03-23 08:57:23 -05:00
David Spickett
5193c4a8b3 [lldb][AArch64] Fix run-qemu.sh when only MTE is enabled.
SVE and MTE both require a CPU with that feature before
you can use the other options, but we only added the "max"
cpu when SVE was enabled too.
2023-03-23 13:48:44 +00:00
Qiongsi Wu
4f9929add5 [AIX][CodeGen] Storage Locations for Constant Pointers
This patch adds an `llc` option `-mroptr` to specify storage locations for constant pointers on AIX.

When the `-mroptr` option is specified, constant pointers, virtual function tables, and virtual type tables are placed in read-only storage. Otherwise, by default, pointers, virtual function tables, and virtual type tables are placed are placed in read/write storage.

https://reviews.llvm.org/D144190 enables the `-mroptr` option for `clang`.

Reviewed By: hubert.reinterpretcast, stephenpeckham, myhsu, MaskRay, serge-sans-paille

Differential Revision: https://reviews.llvm.org/D144189
2023-03-23 09:44:47 -04:00
Alexey Lapshin
fd4aeba307 Revert "[ADT] add ConcurrentHashtable class."
This reverts commit 8482b23806.
2023-03-23 14:42:40 +01:00
Benjamin Kramer
8c7c1f11ff Silence unused variable warning in NDEBUG builds
I usually would fold this into the assert, but the comment there
suggests side effects. NFC.

ModuleMap.cpp:938:9: error: unused variable 'MainFile' [-Werror,-Wunused-variable]
  auto *MainFile = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID());
2023-03-23 14:41:03 +01:00
Simon Pilgrim
320969f505 [X86] LowerVectorAllZero - add 512-bit support with AVX512 vptestnmd+kortestw patterns (REAPPLIED)
Another step toward #53419 - this is also another step towards expanding MatchVectorAllZeroTest to match any pair of vectors and merge EmitAVX512Test into it.
2023-03-23 13:37:09 +00:00
Alexey Lapshin
8482b23806 [ADT] add ConcurrentHashtable class.
ConcurrentHashTable - is a resizeable concurrent hashtable.
The range of resizings is limited up to x2^32. The hashtable allows only concurrent insertions.

Concurrent hashtable is necessary for the D96035 patch.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D132455
2023-03-23 14:32:43 +01:00
Johannes de Fine Licht
a7c574d0c1 [MLIR][LLVM] Move the LLVM inliner interface into a separate file.
A fully fledged LLVM inliner will require a lot of logic. Since
`LLVMDialect.cpp` is large enough as it is, preemptively outline the
inlining logic into a separate `.cpp` file. This will also allow us to
add a `DEBUG_TYPE` for debugging the inliner.

The name `LLVMInlining` was chosen over `LLVMInlinerInterface` to keep
the option open for exposing inlining functionality even when not
invoked through the `DialectInlinerInterface`.

Depends on D146616

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D146628
2023-03-23 14:22:25 +01:00
NAKAMURA Takumi
3f2dbcc27d [Bazel] Rework //llvm:llvm-tblgen and //llvm/unittests:tablegen_tests
`llvm/utils/TableGen/GlobalISel` should be exported.

FYI, after D144351,`tablegen_tests` behaved same
as `llvm-tblgen -print-records`.
It suceeded because stdin is `/dev/null`.
2023-03-23 22:14:26 +09:00
Simon Pilgrim
4738c5f083 [X86] LowerVectorAllZero - early out for masked v2i64 cases without PTEST. NFC. 2023-03-23 13:07:29 +00:00
Job Noorman
d0e2a42853 [RISCV][test] Fix another missed test change from RV64E patch
c39dd7c1db missed a needed change to the
llvm-objdump test.
2023-03-23 13:02:13 +00:00
Job Noorman
e54cdd058e [RISCV][clang][test] Fix missed test
c39dd7c1db missed the appropriate change
to clang/test/Driver/ricv-arch.c.
2023-03-23 12:49:06 +00:00
Iain Sandoe
c6e9823724 [C++20][Modules] Introduce an implementation module.
We need to be able to distinguish individual TUs from the same module in cases
where TU-local entities either need to be hidden (or, for some cases of ADL in
template instantiation, need to be detected as exposures).

This creates a module type for the implementation which implicitly imports its
primary module interface per C++20:
[module.unit/8] 'A module-declaration that contains neither an export-keyword
nor a module-partition implicitly imports the primary module interface unit of
the module as if by a module-import-declaration.

Implementation modules are never serialized (-emit-module-interface for an
implementation unit is diagnosed and rejected).

Differential Revision: https://reviews.llvm.org/D126959
2023-03-23 12:47:44 +00:00
Simon Pilgrim
7fef15edd4 Revert rG6aa7cc037f2f95c237c1d82c523f8857fa3a10c3 - "[X86] LowerVectorAllZero - add 512-bit support with AVX512 vptestnmd+kortestw patterns"
Reverted - I need to adjust the implementation so we can properly refactor it into a "LowerVectorAllEqual" function
2023-03-23 12:37:19 +00:00
Yi Kong
3d65cd405d [llvm-objdump] Fix help message for --print-imm-hex
Commit cc2457ca1b changed the default but forgot to update the help message.
2023-03-23 20:34:20 +08:00
Job Noorman
c39dd7c1db [RISCV][MC] Add support for RV64E
Implement MC support for the recently ratified RV64E base instruction
set.

Differential Revision: https://reviews.llvm.org/D143570
2023-03-23 12:32:25 +00:00
Simon Pilgrim
6aa7cc037f [X86] LowerVectorAllZero - add 512-bit support with AVX512 vptestnmd+kortestw patterns
Another step toward #53419 - this is also another step towards expanding MatchVectorAllZeroTest to match any pair of vectors and merge EmitAVX512Test into it.
2023-03-23 12:18:49 +00:00
Kadir Cetinkaya
43fcfdb1d6 [IncludeCleaner][clangd] Mark umbrella headers as users of private
Private headers inside umbrella files shouldn't be marked as unused.

Differential Revision: https://reviews.llvm.org/D146406
2023-03-23 13:08:07 +01:00
Aaron Ballman
18d56880a8 Revert "libclang: Pass Clang install directory to driver via argv[0]."
This reverts commit 201fdef40d.

There was an issue found in post-commit by:
https://lab.llvm.org/buildbot/#/builders/91/builds/15272
2023-03-23 08:05:58 -04:00
Nico Weber
c2c9de4ae1 [gn] port a282ea4898 2023-03-23 12:56:33 +01:00
Quentin Colombet
0cbfd68af7 [mlir] Fix call of overloaded ‘dropResults(<brace-enclosed initializer list>)’ is ambiguous
NFC
2023-03-23 12:45:54 +01:00
Jacek Caban
a5988034a4 [lld] Fill .text section gaps with INT3 only on x86 targets.
It doesn't make sense on ARM and using default 0 fill is compatible
with MSVC.

(It's more noticeable ARM64EC targets, where additional padding mixed
with alignment is used for entry thunk association, so there are more
gaps).

Reviewed By: mstorsjo

Differential Revision: https://reviews.llvm.org/D145962
2023-03-23 13:43:21 +02:00
Jacek Caban
4fcbf38420 [llvm-lib] Use COFF archive format in llvm-lib (other archive tools don't use this format).
We currently just use GNU format for llvm-lib. This mostly works, but
ARM64EC needs an additional section that does not really fit GNU format.
This patch implements writing in COFF format (as in, it's what archive
reader considers as K_COFF). This mostly requires symbol emitting symbol
map. Note that, just like in case of MSVC, symbols are de-duplicated in
both usual symbol table and the new symbol map.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D143540
2023-03-23 13:43:21 +02:00
Jacek Caban
257dc54be2 [Object][NFC] Don't insert string table into object members vector.
Having string table in members vector does not fit later patches in
this series. Symbol map needs to refer to objects' offsets, but string
table should not be referenced. Also for ARM64EC, the new <ECSYMBOLS>
table is inserted after string table.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D143538
2023-03-23 13:43:21 +02:00
Jacek Caban
67d828fb2c [Object][NFC] Factor out computeHeadersSize.
In preparation for COFF archives support.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D143537
2023-03-23 13:43:21 +02:00
luxufan
f44c7dec67 [Local] Use most generic range if K does not dominate J or K doesn't have a !noundef
Since D141386 has changed the return value of !range from IUB to poison,
metadata !range shouldn't be preserved even if K dominates J.

If this patch was accepted, I plan to adjust metadata !nonnull as well.
BTW, I found that metadata !noundef is not handled in combineMetadata,
is this intentional?

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D142687
2023-03-23 19:31:55 +08:00
LLVM GN Syncbot
20725d34b2 [gn build] Port c2de8ff927 2023-03-23 11:20:20 +00:00
LLVM GN Syncbot
80db8b03a9 [gn build] Port 48f97e5751 2023-03-23 11:20:19 +00:00
Alex Bradbury
da44224d3a [RISCV][test] Fix broken unit test after d25751779b
The patch had missed the RISCVISAInfoTest.cpp change.
2023-03-23 11:17:40 +00:00
Nicolas Vasilache
4dc72d47ce [mlir][Tensor] Add a FoldTensorSubsetOps pass and patterns
These patterns follow FoldMemRefAliasOps which is further refactored for reuse.
In the process, fix FoldMemRefAliasOps handling of strides for vector.transfer ops which was previously incorrect.

These opt-in patterns generalize the existing canonicalizations on vector.transfer ops.
In the future the blanket canonicalizations will be retired.
They are kept for now to minimize porting disruptions.

Differential Revision: https://reviews.llvm.org/D146624
2023-03-23 04:03:27 -07:00
Haojian Wu
002c4b7b95 [clangd] Extend CollectMainFileMacros.
Extend the existing MainFileMacros structure:
- record more information (InConditionalDirective) in MacroOccurrence
- collect macro references inside macro body (fix a long-time FIXME)

So that the MainFileMacros preseve enough information, which allows a
just-in-time convertion to interop with include-cleaner::Macro for
include-cleaer features.

See the context in https://reviews.llvm.org/D146017.

Differential Revision: https://reviews.llvm.org/D146279
2023-03-23 11:59:11 +01:00
Sam McCall
48f97e5751 [FlowSensitive] Log analysis progress for debugging purposes
The goal is to be able to understand how the analysis executes, and what its
incremental and final findings are, by enabling logging and reading the logs.
This should include both framework and analysis-specific information.

Ad-hoc printf-debugging doesn't seem sufficient for my understanding, at least.
Being able to check in logging, turn it on in a production binary, and quickly
find particular analysis steps within complex functions seem important.

This can be enabled programmatically through DataflowAnalysisOptions, or
via the flag -dataflow-log. (Works in unittests, clang-tidy, standalone
tools...)

Important missing pieces here:
 - a logger implementation that produces an interactive report (HTML file)
   which can be navigated via timeline/code/CFG.
   (I think the Logger interface is sufficient for this, but need to prototype).
 - display of the application-specific lattice
 - more useful display for the built-in environment
   (e.g. meaningful & consistent names for values, hiding redundant variables in
   the flow condition, hiding unreachable expressions)

Differential Revision: https://reviews.llvm.org/D144730
2023-03-23 11:36:21 +01:00
Luke Lau
8d16c6809a [RISCV] Increase default vectorizer LMUL to 2
After some discussion and experimentation, we have seen that changing the default number of vector register bits to LMUL=2 strikes a sweet spot.
Whilst we could be clever here and make the vectorizer smarter about dynamically selecting an LMUL that
a) Doesn't affect register pressure
b) Suitable for the microarchitecture
we would need to teach its heuristics about RISC-V register grouping specifics.
Instead this just does the easy, pragmatic thing by changing the default to a safe value that doesn't affect register pressure signifcantly[1], but should increase throughput and unlock more interleaving.

[1] Register spilling when compiling sqlite at various levels of `-riscv-v-register-bit-width-lmul`:

LMUL=1    2573 spills
LMUL=2    2583 spills
LMUL=4    2819 spills
LMUL=8    3256 spills

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D143723
2023-03-23 10:33:50 +00:00
Adam Paszke
61f33def13 [mlir][Vector] Make sure that vector.contract preserves extra attributes while parsing
The old implementation parsed the optional attribute dict, only to replace its
contents by using `assign`.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D146707
2023-03-23 10:31:46 +00:00
Carlos Galvez
b7677846da [clang-tidy][NFC] Fix broken link in Release Notes 2023-03-23 10:30:15 +00:00
Stefan Gränitz
c2de8ff927 [JITLink] Initial AArch32 backend
This first version lays the foundations for AArch32 support in JITLink. ELFLinkGraphBuilder_aarch32 processes REL-type relocations and populates LinkGraphs from ELF object files for both big- and little-endian systems. The ArmCfg member controls subarchitecture-specific details throughout the linking process (i.e. it's passed to ELFJITLinker_aarch32).

Relocation types follow the ABI documentation's division into classes: Data (endian-sensitive), Arm (32-bit little-endian) and Thumb (2x 16-bit little-endian, "Thumb32" in the docs). The implementation of instruction encoding/decoding for relocation resolution is implemented symmetrically and is testable in isolation (see AArch32 category in JITLinkTests).

Callable Thumb functions are marked with a ThumbSymbol target-flag and stored in the LinkGraph with their real addresses. The thumb-bit is added back in when the owning JITDylib requests the address for such a symbol.

The StubsManager can generate (absolute) Thumb-state stubs for branch range extensions on v7+ targets. Proper GOT/PLT handling is not yet implemented.

This patch is based on the backend implementation in ez-clang and has just enough functionality to model the infrastructure and link a Thumb function `main()` that calls `printf()` to dump "Hello Arm!" on Armv7a. It was tested on Raspberry Pi with 32-bit Raspbian OS.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D144083
2023-03-23 11:25:45 +01:00
Job Noorman
d25751779b Bump RV32E version to 2.0
RV32E was recently [ratified](afd613691c) so we should update the version as our MC-layer support is complete.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D144384
2023-03-23 18:12:26 +08:00
Yevgeny Rouban
26d954bd40 [AsmParser] Avoid instantiating LLVMContext if not needed. Try 2.
The deleted copy constructor LLVMContext(LLVMContext &) got its
parameter changed to const to allow the latest clang compiler to
instantiatiate template std::optional<LLVMContext>.

Differential Revision: https://reviews.llvm.org/D142699
2023-03-23 16:57:46 +07:00