469183 Commits

Author SHA1 Message Date
Florian Mayer
fdac98a7f3 Remove stable-runtime from many tests
They pass on x86_64 host, arm64 host, and Android.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D156273
2023-07-25 17:29:03 -07:00
Florian Mayer
17db2a1044 Re-enable lto.c test on ARM64
Tested on Android and ARM Linux and it passes.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D156269
2023-07-25 17:29:00 -07:00
Fangrui Song
eb52fee248 [unittest] Remove some tests from f5ae7e3489f317ce8c60df7258dbe31c8f988aa9 that current GlobPattern cannot handle 2023-07-25 17:26:53 -07:00
Fangrui Song
6a684dbc44 [Support] Remove llvm::is_trivially_{copy/move}_constructible
This restores D132311, which was reverted in
29c841ce93e087fa4e0c5f3abae94edd460bc24a (Sep 2022) due to certain files
not buildable with GCC 7.3.0. The previous attempt was reverted by
6cd9608fb37ca2418fb44b57ec955bb5efe10689 (Dec 2020).

This time, GCC 7.3.0 has existing build errors for a long time due to
structured bindings for many files, e.g.

```
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9098:13: error: cannot decompose class type ‘std::pair<llvm::Value*, const llvm::SCEV*>’: both it and it
s base class ‘std::pair<llvm::Value*, const llvm::SCEV*>’ have non-static data members
   for (auto [_, Stride] : Legal->getLAI()->getSymbolicStrides()) {
             ^~~~~~~~~~~
```

... and also some `error: duplicate initialization of` instances due to llvm/Transforms/IPO/Attributor.h.

---

GCC 7.5.0 has a bug that, without this change, certain `SmallVector` with a `std::pair` element type like `SmallVector<std::pair<Instruction * const, Info>, 0> X;` lead to spurious

```
/tmp/opt/gcc-7.5.0/include/c++/7.5.0/type_traits:878:48: error: constructor required before non-static data member for ‘...’ has been parsed
```

Switching to std::is_trivially_{copy/move}_constructible fixes the error.
2023-07-25 17:21:16 -07:00
Vitaly Buka
2d0ac43df4 [test][hwasan] Remove mistaken XFAIL from test
OnUnmap tags to zero already.
2023-07-25 17:10:53 -07:00
Andrés Villegas
a8016e296e [sancov] Switch to OptTable from llvm::cl
Switch the parse of command line options from llvm::cl to OptTable.

The motivation for this change is to continue adding llvm based tools
to the llvm driver multicall. For more information about the proposal
and motivation, please see https://discourse.llvm.org/t/rfc-llvm-busybox-proposal/58494

Reviewed By: leonardchan

Differential Revision: https://reviews.llvm.org/D155119
2023-07-26 00:04:36 +00:00
Ziqing Luo
cfcf76c6ad [-Wunsafe-buffer-usage] Ignore the FixableGadgets that will not be fixed at an earlier stage
`FixableGadget`s are not always associated with variables that are unsafe
(warned). For example, they could be associated with variables whose
unsafe operations are suppressed or that are not used in any unsafe
operation. Such `FixableGadget`s will not be fixed. Removing these
`FixableGadget` as early as possible helps improve the performance
and stability of the analysis.

Reviewed by: NoQ (Artem Dergachev), t-rasmud (Rashmi Mudduluru)

Differential revision: https://reviews.llvm.org/D155524
2023-07-25 16:58:27 -07:00
Alfred Persson Forsberg
c1ce7c8341 [libc] pthread.h.def: add PTHREAD_MUTEX_INITIALIZER
Adds PTHREAD_MUTEX_INITIALIZER for compiler-rt's builtins/emutls.c

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D156276
2023-07-25 16:47:15 -07:00
Michael Jones
49eb1aed89 [libc] Add back report_assertion_failure
It's necessary for the assert_fail function, so it needs to stay in for
the moment.

Reviewed By: alfredfo

Differential Revision: https://reviews.llvm.org/D156275
2023-07-25 16:34:53 -07:00
Shubham Sandeep Rastogi
b66b176dc3 Emit DW_RLE_base_addressx + DW_RLE_offset_pairs
instead of DW_ELE_start_length in debug_rnglists section

This patch tries to reduce the size of the debug_rnglist section by
replacing the DW_RLE_start_length opcodes currently emitted by dsymutil
in favor of using DW_RLE_base_addressx + DW_RLE_offset_pair instead.

The DW_RLE_start_length is one AddressSize followed by a ULEB per entry,
whereas, the DW_RLE_base_addressx + DW_RLE_offset_pair will use one ULEB
for the base address, and then the DW_RLE_offset_pair is a pair of
ULEBs. This will be more efficient.

Differential Revision: https://reviews.llvm.org/D156166
2023-07-25 16:17:53 -07:00
Vitaly Buka
8ccc8b19a1 [test] Added test for secondary allocator shadow release 2023-07-25 16:14:33 -07:00
Qi Hu
ddd7d35c6c [RegAlloc] Fix assertion failure caused by inline assembly
When inline assembly code requests more registers than available, the
MachineInstr::emitError function in the RegAllocFast pass emits an error
but doesn't stop the pass, and then the compiler crashes later with an
assertion failure. This commit, mimicking the RegAllocGreedy pass, assigns
a random physical register, and therefore avoids the crash after producing
the diagnostic. This problem has been observed for both rustc and clang,
while it doesn't occur in gcc.
2023-07-25 19:21:03 -04:00
Fangrui Song
f5ae7e3489 [unittest] Improve GlobPattern tests
They cover some interesting cases when I was developing
https://reviews.llvm.org/D156046
2023-07-25 16:10:38 -07:00
River Riddle
0e6000f647 [mlir:bytecode] Only visit the all regions path if the op has regions
Zero region operations return true for both isBeforeAllRegions and
isAfterAllRegions when using WalkStage. The bytecode walk only
expects region holding operations in the after regions path, so
guard against that.
2023-07-25 16:06:33 -07:00
Fangrui Song
16d79d26b3 [clangd] Use xxh3_64bits for background index file digests
Many sources show that xxh3 is much better than xxh64. This particular
instance may or may not have noticeable difference, but this change
moves us toward removing xxHash64.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D155992
2023-07-25 16:02:54 -07:00
Richard Smith
61c7a9140b Commit to a primary definition for a class when we load its first
member.

Previously, we wouldn't do this if the first member loaded is within a
definition that's added to a class via an update record, which happens
when template instantiation adds a class definition to a declaration
that was imported from an AST file.

This would lead to classes having member functions whose getParent
returned a class declaration that wasn't the primary definition, which
in turn caused the vtable builder to build broken vtables.

I don't yet have a reduced testcase for the wrong-code bug here, because
the setup required to get us into the broken state is very subtle, but
have confirmed that this fixes it.
2023-07-25 15:59:21 -07:00
River Riddle
4af01bf956 [mlir:bytecode] Support lazy loading dynamically isolated regions
We currently only support lazy loading for regions that
statically implement the IsolatedFromAbove trait, but that
limits the amount of operations that can be lazily loaded. This review
lifts that restriction by computing which operations have isolated
regions when numbering, allowing any operation to be lazily loaded
as long as it doesn't use values defined above.

Differential Revision: https://reviews.llvm.org/D156199
2023-07-25 15:55:34 -07:00
River Riddle
5ab6589551 [mlir:bytecode] Fix bytecode lazy loading for ops with multiple regions
We currently encode each region as a separate section, but
the reader expects all of the regions to be in the same section.
This updates the writer to match the behavior that the reader
expects.

Differential Revision: https://reviews.llvm.org/D156198
2023-07-25 15:55:34 -07:00
Alex Langford
a809720102 [lldb][NFCI] Change logic to find clang resource dir in standalone builds
As of 0beffb854209a41f31beb18f9631258349a99299 there is a CMake
function to actually calculate the relative path to the clang resource
directory. Currently we have some bespoke logic that looks in a few
places, but with this new function we should be able to eliminate some
complexity here.

Also, I moved the functionality from LLDBConfig to LLDBStandalone since
it is only used in standalone builds.

Differential Revision: https://reviews.llvm.org/D156270
2023-07-25 15:52:33 -07:00
Vitaly Buka
03399a928f [test] Disable the test without pointer tagging
In aliasing mode we tag only heap, not mmap, and can't pass.
Still it's not clear why the test didn't fail before.
2023-07-25 15:52:07 -07:00
Nick Desaulniers
d1199808af [clang][ConstExprEmitter] handle ArrayToPointerDecay ImplicitCastExpr of StringLiterals
Consider the following statement:
    const char* foo = "foo";

For the sub-AST:
    `-ImplicitCastExpr <col:19> 'const char *' <NoOp>
      `-ImplicitCastExpr <col:19> 'char *' <ArrayToPointerDecay>
        `-StringLiteral <col:19> 'char[4]' lvalue "foo"

The address of the StringLiteral can be emitted as the Constant.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D156185
2023-07-25 15:27:08 -07:00
Mehdi Amini
e1bdf3219f Add release notes for MLIR
Differential Revision: https://reviews.llvm.org/D156253
2023-07-25 15:24:52 -07:00
Vitaly Buka
2af86213a8 Fix typo in b9863430 2023-07-25 15:24:09 -07:00
Nicolas Vasilache
44e6318cea [mlir][transforms] Revamp the implementation of mapping loops to GPUs
This revision significantly simplifies the specification and implementation of mapping loops to GPU ids.

Each type of mapping (block, warpgroup, warp, thread) now comes with 2 mapping modes:
  1. a 3-D "grid-like" mode, subject to alignment considerations on threadIdx.x, on which predication
     may occur on a per-dimension 3-D sub-rectangle basis.
  2. a n-D linearized mode, on which predication may only occur on a linear basis.

In the process, better size and alignment requirement inference are introduced along with improved runtime verification messages.

The `warp_dims` attribute was deemed confusing and is removed from the transform in favor of better size inference.

Differential Revision: https://reviews.llvm.org/D155941
2023-07-26 00:09:08 +02:00
DianQK
2ee4d0386c
[Verifier] definition subprograms cannot be nested within DICompositeType when enabling ODR.
Resolve https://github.com/llvm/llvm-project/issues/61932. We should add the validation.

LLVM can't handle IR where subprogram definitions are nested within DICompositeType when doing LTO builds, because there's no good way to cross the CU boundary to insert a nested DISubprogram definition in one CU into a type defined in another CU.

The test cases `cross-cu-inlining-2.ll` and `cross-cu-inlining-ranges.ll` can be deleted. In the `cross-cu-inlining-2.ll`, the low pc and high pc of the CU are also incorrect.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D152095
2023-07-26 06:08:32 +08:00
Vitaly Buka
b9863430ec [NFC] Remove Win specific Destroy from ThreadStart 2023-07-25 15:02:42 -07:00
Valentin Clement
6674e578b9
[mlir][openacc] Fix acc.declare attribute on operation
The attribute on operations in ops.mlir were not DeclareAttr but
DataClauseAttr with the acc.declare attribute name. Update the test
and the verifier to work correctly with the expected DeclareAttr.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D156262
2023-07-25 15:02:20 -07:00
Richard Smith
b6847edfc2 For #64088: mark vtable as used if we might emit a reference to it. 2023-07-25 14:42:10 -07:00
Chia-hung Duan
774b614417 [scudo] Acquire FLLock in mergeGroupsToReleaseBack
This removes the need of ScopedUnlock and make the future use of
condition variable easier to wake up waiting threads.

Reviewed By: cferris

Differential Revision: https://reviews.llvm.org/D156147
2023-07-25 21:41:11 +00:00
Anna Thomas
eaf6117f33 [LV] Complete load groups and release store groups in presence of dependency
This is a complete fix for CompleteLoadGroups introduced in
D154309. We need to check for dependency between A and every member of
the load Group of B.
This patch also fixes another miscompile seen when we incorrectly sink stores
below a depending load (see testcase in
interleaved-accesses-sink-store-across-load.ll). This is fixed by
releasing store groups correctly.

Differential Revision: https://reviews.llvm.org/D155520
2023-07-25 17:32:09 -04:00
Nick Desaulniers
ef103adf60 [clang][CodeGenModule] remove declaration of GetAddrOfConstantString
It looks like the definition was removed in cd21d541397e but the
declaration was not.  Surprisingly (to me), that doesn't seem to produce
any kind of diagnostic.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D156182
2023-07-25 14:25:25 -07:00
Nick Desaulniers
15a484bf69 [clang][ConstExprEmitter] handle IntegerLiterals
Improves the ability of ConstExprEmitter to evaluate constants.

Found by adding asserts to ConstantEmitter::tryEmitPrivate to find cases
where ConstExprEmitter::Visit() fails to resolve (obvious) constants.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D156154
2023-07-25 14:12:50 -07:00
Rashmi Mudduluru
070358ec92 [-Wunsafe-buffer-usage] Fix a fallthrough case in UPCStandalonePointer getFixits
Differential Revision: https://reviews.llvm.org/D155526
2023-07-25 13:40:33 -07:00
Fangrui Song
1b162fabe8 [Support] Change SetVector's default template parameter to SmallVector<*, 0>
Similar to D156016 for MapVector.

This brings back commit fae7b98c221b5b28797f7b56b656b6b819d99f27 with a
fix to llvm/unittests/Support/ThreadPool.cpp's `_WIN32` code path.
2023-07-25 13:13:35 -07:00
Fernando
a0b9f1f84b [scudo] set/check invalid cache entries
made checking for invalid cache entries and setting invalid cache
entries more implicit and clear.

Reviewed By: cferris

Differential Revision: https://reviews.llvm.org/D155983
2023-07-25 19:26:32 +00:00
Fernando
4c6b8bb87b [scudo] seperate cache retrieval logic
Split cache::retrieve() into separate functions. One that retrieves
the cached block and another that sets the header and MTE environment.
These were split so that the retrieve function could be more easily
changed in the future and so that the retrieve function had the sole
purpose of retrieving a CachedBlock.

Reviewed By: cferris

Differential Revision: https://reviews.llvm.org/D155660
2023-07-25 19:26:32 +00:00
Corbin Robeck
7a4968b5a3 [AMDGPU] Add dynamic stack bit info to kernel-resource-usage Rpass output
In code object 5 (https://llvm.org/docs/AMDGPUUsage.html#code-object-v5-metadata) the AMDGPU backend added the .uses_dynamic_stack bit to the kernel meta data to identity kernels which have compile time indeterminable stack usage (indirect function calls and recursion mainly). This patch adds this information to the output of the kernel-resource-usage remarks.

Reviewed By: arsenm

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

Author:    Corbin Robeck <corbin.robeck@amd.com>
2023-07-25 12:20:13 -07:00
Vitaly Buka
45f9f3f710 [NFC] Remove redundant branch
memset already covers the case.

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D156183
2023-07-25 12:12:25 -07:00
John Harrison
3ab73a3984 [lldb-vsocde] Add a 'continued' event for programmatic continue events.
When the process is contiuned using an lldb command expression the thread state in VS Code is never informed and will be out of sync with the current state of the process. The new event will fire whenever the process is continued and keeps the debugger in sync with the dap client.

Reviewed By: wallace

Differential Revision: https://reviews.llvm.org/D154989
2023-07-25 14:46:17 -04:00
Michael Jones
65fe1ac30a [libc][NFC] Simplify assert message generation
Previously displaying a failed assert would involve a runtime integer to
string conversion. This patch changes that to be a compile time string
conversion.

This was inspired by a comment by JonChesterfield on https://reviews.llvm.org/D155899

Reviewed By: lntue, sivachandra, JonChesterfield

Differential Revision: https://reviews.llvm.org/D156168
2023-07-25 11:45:45 -07:00
Christian Trott
488c3db245 [libc++][mdspan] Fix uglification, categorize asserts and move tests
Fixes uglification in mdspan deduction guides, which CI
did not test for until recently. The CI modification
and mdspan testing overlapped, so mdspan landed with green
CI, and the CI modification landed too.

Make most assertions in mdspan and its helper classes
trigger during a hardened build in order to catch
out of bounds access errors.

Also moves all mdspan assertions tests from libcxx/test/std
to libcxx/test/libcxx.

Differential Revision: https://reviews.llvm.org/156181
2023-07-25 12:39:35 -06:00
Mehdi Amini
e7f8b45953 Add an MLIR example of some mimimal example of MLIR setup
These may serve as example and showcase of the MLIR binary footprint.

Right now a release build of these tools on a linux machine shows:

- mlir-cat: 2MB
  This includes the Core IR, the textual parser/printer, the support for
  bytecode.
- mlir-minimal-opt: 3MB
  This adds all the tooling for an mlir-opt tool: the pass infrastructure
  and all the instrumentation associated with it.
- mlir-miminal-opt-canonicalize: 4.8MB
  This add the canonicalizer pass, which pulls in all the pattern/rewrite
  machinery, including the PDL compiler and intepreter.

Differential Revision: https://reviews.llvm.org/D156218
2023-07-25 11:38:19 -07:00
Piotr Zegar
b530eeea5e [clang-tidy] Add --enable-module-headers-parsing option
Change default behavior in Clang-tidy and skip by default
module headers parsing. That functionality is buggy and
slow in C++20, and provide tiny benefit.

Reviewed By: carlosgalvezp

Differential Revision: https://reviews.llvm.org/D156161
2023-07-25 18:31:17 +00:00
Quinn Dawkins
24567dd4ba [mlir][GPU] Fix missing CMake dependency
Fixes buildbot failure from ff8775f

Differential Revision: https://reviews.llvm.org/D156252
2023-07-25 14:28:16 -04:00
V Donaldson
7ba2ac2828 [flang] test update 2023-07-25 11:27:51 -07:00
LLVM GN Syncbot
074998d733 [gn build] Port 3397dae69e09 2023-07-25 18:09:38 +00:00
V Donaldson
f1ada999e2 [flang] build test failure 2023-07-25 11:08:34 -07:00
Goran Flegar
118f95b394 [bazel][mlir] Port ff8775f3fffea787922eb238c0af3ed5715485d9 2023-07-25 19:59:44 +02:00
Kazuki Sakamoto
8c61c9b02b [lldb][LocateModuleCallback] Call locate module callback in Platform too
This is an enhancement for the locate module callback.
https://discourse.llvm.org/t/rfc-python-callback-for-target-get-module/71580/6

On Android remote platform, module UUID is resolved by
Platform::GetRemoteSharedModule. Which means the current
Target::CallLocateModuleCallbackIfSet() call undesirably is not able to pass the
module UUID to the locate module callback.

This diff moves the CallLocateModuleCallbackIfSet() implementation from Target
to Platform to allows both Target and Platform can call it. One is from the
current Target call site, and second is from Platform after resolving the module
UUID.

As the result of this change, the locate module callback may be called twice
for a same module on remote platforms. And it should be ok.

- First, without UUID.
  - The locate module callback is allowed to return an error
    if the callback requires UUID.
- Second, with UUID, if the first callback call did not return a module.

Differential Revision: https://reviews.llvm.org/D156066
2023-07-25 10:57:50 -07:00
V Donaldson
ba531a55c6 [flang] Implement procedure IEEE_COPY_SIGN with mlir::math::CopySignOp 2023-07-25 10:52:48 -07:00