Commit Graph

398890 Commits

Author SHA1 Message Date
LLVM GN Syncbot 7c76cefd7c [gn build] Port 2c8e784915 2021-09-14 00:27:49 +00:00
Lang Hames 3ca6eee2a9 [ORC] Fix self-assignment.
We want to read the page size from EPI->PageSize. Thanks to Simon Pilgrim for
spotting this.
2021-09-14 10:21:49 +10:00
Lang Hames 2c8e784915 [ORC] Add Shared/OrcRTBridge, and TargetProcess/OrcRTBootstrap.
This is a small first step towards reorganization of the ORC libraries:

Declarations for types and function names (as strings) to be found in the
"ORC runtime bootstrap" set are moved into OrcRTBridge.h / OrcRTBridge.cpp.

The current implementation of the "ORC runtime bootstrap" functions is moved
into OrcRTBootstrap.h and OrcRTBootstrap.cpp. It is likely that this code will
eventually be moved into ORT-RT proper (in compiler RT).

The immediate goal of this change is to make these bootstrap functions usable
for clients other than SimpleRemoteEPC/SimpleRemoteEPCServer. The first planned
client is a new RuntimeDyld::MemoryManager that will run over EPC, which will
allow us to remove the old OrcRemoteTarget code.
2021-09-14 10:19:45 +10:00
Brendon Cahoon 42dace9c5b [Hexagon] Use getTypeAllocSize to compute difference between objects
The code was using getTypeStoreSize to calculate the difference
between consecutive objects. The calculation was incorrect due
to padding that is added between consecutive objects. The
getTypeAllocSize includes the padding amount. For example,
if the type is [19 x i8], the difference between consecutive
objects is 32 bytes, not 19 bytes.

A second case for getTypeAllocSize is needed when computing
the pointer values for the vector accesses. The calculation needs
to account for the padding as well.

Differential Revision: https://reviews.llvm.org/D109403
2021-09-13 19:04:59 -05:00
Ankit Aggarwal a72763af67 [Hexagon] Handle bitcast of i64/i128 -> v64i1/v128i1 2021-09-13 18:52:30 -05:00
Nico Weber b7bac5a172 [clang] Revert gcc-driver part of 648feabc65
See discussion on https://reviews.llvm.org/D109624
2021-09-13 19:04:29 -04:00
Arthur Eubanks 096d9814aa [opt] Remove some legacy PM flags
Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D109664
2021-09-13 15:50:03 -07:00
Kuba Mracek e80ee4cbd9 [GlobalDCE] In VFE support for relative pointers, allow GEP references to the base symbol
This is for Swift VFE support. In some vtable forms that Swift emits, the "base" of a relative pointer is not the global symbol itself directly, but a GEP into it -- so the pointer is relative to a particular field in the global. So getPointerAtOffset() needs to be able to see through the GEP and allow it in a SUB expression, to correctly recognize the offset as a vtable slot.

Differential Revision: https://reviews.llvm.org/D109169
2021-09-13 15:22:11 -07:00
Thomas Lively b2032f18c9 [lld][WebAssembly] Relax limitations on multithreaded instantiation
For multithreaded modules (i.e. modules with a shared memory), lld injects a
synthetic Wasm start function that is automatically called during instantiation
to initialize memory from passive data segments. Even though the module will be
instantiated separately on each thread, memory initialization should happen only
once. Furthermore, memory initialization should be finished by the time each
thread finishes instantiation. Since multiple threads may be instantiating their
modules at the same time, the synthetic function must synchronize them.

The current synchronization tries to atomically increment a flag from 0 to 1 in
memory then enters one of two cases. First, if the increment was successful, the
current thread is responsible for initializing memory. It does so, increments
the flag to 2 to signify that memory has been initialized, then notifies all
threads waiting on the flag. Otherwise, the thread atomically waits on the flag
with an expected value of 1 until memory has been initialized. Either the
initializer thread finishes initializing memory (i.e. sets the flag to 2) first
and the waiter threads do not end up blocking, or the waiter threads succesfully
start waiting before memory is initialized so they will be woken by the
initializer thread once it has finished.

One complication with this scheme is that there are various contexts on the Web,
most notably on the main browser thread, that cannot successfully execute a
wait. Executing a wait in these contexts causes a trap, and in this case would
cause instantiation to fail. The embedder must therefore ensure that these
contexts win the race and become responsible for initializing memory, since that
is the only code path that does not execute a wait.

Unfortunately, since only one thread can win the race and initialize memory,
this scheme makes it impossible to have multiple threads in contexts that cannot
wait. For example, it is not currently possible to instantiate the module on
both the main browser thread as well as in an AudioWorklet. To loosen this
restriction, this commit inserts an extra check so that the wait will not be
executed at all when memory has already been initialized, i.e. when the flag
value is 2. After this change, the module can be instantiated on threads in
non-waiting contexts as long as the embedder can guarantee either that the
thread will win the race and initialize memory (as before) or that memory has
already been initialized when instantiation begins. Threads in contexts that can
wait can continue racing to initialize memory.

Fixes (or at least improves) PR51702.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D109722
2021-09-13 15:03:51 -07:00
Jian Cai ce6d512015 [mlir][doc] fix typos.
Also wrap some function/class names in backticks.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D109723
2021-09-13 14:48:58 -07:00
Heejin Ahn c55b6c593b [WebAssembly] Handle _setjmp and _longjmp in SjLj
In some platforms `_setjmp` and `_longjmp` are used instead of `setjmp`
and `longjmp`. This CL adds support for them.

Fixes https://github.com/emscripten-core/emscripten/issues/14999.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D109669
2021-09-13 14:20:04 -07:00
Heejin Ahn b7b4ebbcfa [WebAssembly] Rethrow longjmp in EH handling if EmSjLj is enabled
This is a fix on top of D106525's Case 2. In D106525, in
`runEHOnFunction` which handles Emscripten EH, We rethrow `longjmp` only
when the module has any usage of `setjmp` or `longjmp`. But now Wasm
object files are linked using wasm-ld, the module this pass sees is not
the whole program, and even if this module does not contain any
`longjmp`, another file can contain it and can be linked with the
current module. This enables the rethrowing of longjmp whenever
Emscripten SjLj is enabled, regardless of whether it is used in this
module or not.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D109670
2021-09-13 14:15:25 -07:00
Geoffrey Martin-Noble 095bbc3a5a [Bazel][mlir] Simplify test/BUILD.bazel with globs
This reduces the maintenance burden by using globs, which is the
tradeoff we make in the other LLVM Bazel build files as well.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D109720
2021-09-13 13:45:23 -07:00
Fangrui Song e69d359841 [lldb] Actually fix format specifier after D108233
And revert c4fa2c8aa4
2021-09-13 13:40:37 -07:00
Fangrui Song 0867c017e5 [ClangScanDeps][test] Add -fmodules-cache-path=DIR/cache to make diagnostics.c hermetic
Otherwise it may access sys::path::cache_directory/clang/ModuleCache which may not be writable.
2021-09-13 13:17:55 -07:00
David Carlier dc08cfae09 [Sanitizers] intercept accept4 on freebsd 2021-09-13 21:15:07 +01:00
Florian Mayer 0a22510f3e [value-tracking] see through returned attribute.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D109675
2021-09-13 20:52:26 +01:00
Florian Mayer 5b5d774f5d [hwasan] Respect returns attribute when tracking values.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D109233
2021-09-13 20:52:24 +01:00
Arnamoy Bhattacharyya b9a8f34d47 [flang][OpenMP] Add parsing support for nontemporal clause.
This patch adds parsing support for the nontemporal clause.  Also adds a couple of test cases.

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D106896
2021-09-13 15:25:47 -04:00
Fehr Mathieu b39f6a79ee [ADT] Extend EnableIfCallable for callables with incomplete returns
std::is_convertible has no defined behavior when its arguments
are incomplete, even if they are equal. In practice, it returns false.
Adding std::is_same allows us to use the constructor using a callable,
even if the return value is incomplete. We also check the case where
we convert a T into a const T.

Reviewed By: DaniilSuchkov

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

Committer: Daniil Suchkov <dsuchkov@azul.com>
2021-09-13 19:16:16 +00:00
Benoit Jacob 340314c4dc Reorder mmt4d shapes:
* Revert https://reviews.llvm.org/D107307 so that both LHS and RHS have
  the same layout with K0 as the innermost dimension.

* Continuing from https://reviews.llvm.org/D107003, move also 'K'
  to the outer side, so that now the inter-tile dimensions as all outer,
  and the intra-tile dimensions are all inner.

Reviewed By: asaadaldien

Differential Revision: https://reviews.llvm.org/D109692
2021-09-13 12:09:22 -07:00
David Carlier b8f6c1fd96 [Sanitizers] intercept getgrouplist on Linux and FreeBSD.
Reviewed By: vitalyb

Differential Revision: https://reviews.llvm.org/D109641
2021-09-13 18:42:43 +01:00
Alex Langford c4fa2c8aa4 [lldb] Fix warning in MinidumpFileBuilder.cpp
Fixes the following warning:

$llvm_project/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp:744:11: warning:
format specifies type 'long' but the argument has type 'lldb::offset_t' (aka 'unsigned long long') [-Wformat]
          m_data.GetByteSize());
          ^~~~~~~~~~~~~~~~~~~~
2021-09-13 10:37:45 -07:00
Jon Chesterfield 6775ad2025 [openmp] Apply test change from D109500 2021-09-13 18:36:29 +01:00
Jon Chesterfield 71052ea1e3 [openmp] Apply code change from D109500 2021-09-13 18:33:53 +01:00
Jon Chesterfield bfcf979978 Revert "[openmp] Fix 51647, corrupt bitcode on amdgpu"
This reverts commit d5c049a3f6.
Going to re-commit it in pieces for easier application to 13
2021-09-13 18:25:07 +01:00
Philip Reames 6fec6552f5 Revert "[IndVars] Replace PHIs if loop exits on 1st iteration"
This reverts commit 5a6dfb27ca.  See original review for why.
2021-09-13 10:11:18 -07:00
Philip Reames 5746c76f3f Revert "[IndVars] Break backedge and replace PHIs if loop exits on 1st iteration"
This reverts commit d9ca444835.  See review for why.
2021-09-13 10:10:49 -07:00
Nico Weber 1a56a291c5 [gn build] Fix typos in config visibility lists
GN https://gn-review.googlesource.com/c/gn/+/12140 identified these
typos. Fix them.

No effective behavior change.
2021-09-13 12:50:33 -04:00
vnalamot 726b5d3416 [RegScavenger][NFC] Refer to the already initialized local variable for spill slot index
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D109501
2021-09-13 21:55:33 +05:30
Nicolas Vasilache 181d18ef53 [mlir][Linalg] Insert static buffers as high as possible during ComprehensiveBufferization.
This revision allows hoisting static alloc/dealloc pairs as high as possible during ComprehensiveBufferization.
This also aligns such allocated buffers to 128B by default.

This change exhibited some issues wrt insertion points and a missing copy that are also fixed in this revision; tests are updated accordingly.

Differential Revision: https://reviews.llvm.org/D109684
2021-09-13 15:59:03 +00:00
Kazu Hirata abca4c012f [Utils] Use make_early_inc_range (NFC) 2021-09-13 08:57:23 -07:00
Simon Camphausen ec92f788f3 [mlir][emitc] Print signed integers properly
Previously negative integers were printed as large unsigned values.

Reviewed By: marbre

Differential Revision: https://reviews.llvm.org/D109690
2021-09-13 15:29:30 +00:00
Simon Pilgrim 9db20822f7 [APInt] Add APIntOps::ScaleBitMask helper
APInt is used to describe a bit mask in a variety of value tracking and demanded bits/elts functions.

When traversing through dst/src operands, we have a number of places where these masks need to widened/narrowed to translate through bitcasts, reductions etc. to a different type.

This patch add a APIntOps::ScaleBitMask common helper, adds unit test coverage, and updates a number of cases to use the the helper instead of their own implementation.

This came up on D109065 where we currently have to add yet another implementation of the same code.

Differential Revision: https://reviews.llvm.org/D109683
2021-09-13 16:27:12 +01:00
vnalamot 0fc3ebb70a [SelectionDAG][NFC] Fix typo in VerifyDAGDiverence() function name
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D109674
2021-09-13 20:48:04 +05:30
Jonas Paulsson 5f781ddffc [MLIR] Mark test case XFAIL on SystemZ for now.
mlir-cpu-runner/math_polynomial_approx.mlir

This test case is currently failing on SystemZ, but it does not appear to
necessarily be a target specific problem. See discussion at
https://bugs.llvm.org/show_bug.cgi?id=51204.
2021-09-13 16:48:31 +02:00
Guillaume Chatelet cc84ce9129 Revert "[libc] Some clean work with memmove."
This reverts commit b659b789c0.
2021-09-13 14:32:08 +00:00
dpalermo d5c049a3f6 [openmp] Fix 51647, corrupt bitcode on amdgpu
Patch by @dpalermo

The corrupt bitcode reported in https://bugs.llvm.org/show_bug.cgi?id=51647 seems to be a result of a later pass changing the workfn variable to addrspace(5) (thread private, on the stack). That seems reasonable for an alloca without an address space so it's an open question why that can crash the bitcode reader.

This change puts it in the thread private address space to begin with which means whatever misfired further down the pipeline does not break it. That matches the codegen from clang where stack variables are always annotated (5) and then addrspace cast prior to following use.

This therefore patches around whatever unsuccessfully moved the alloca variable to addrspace(5). That solves the problem of openmp opt producing code that crashes the bitcode reader. It should be possible to create a minimal repro for the underlying bug based on some handwritten IR that uses an alloca in a generic address space.

Reviewed By: ronlieb, jdoerfert, dpalermo-phab

Differential Revision: https://reviews.llvm.org/D109500
2021-09-13 15:24:48 +01:00
Nico Weber 80b60580df [gn build] (semi-manually) port 4247381e26 2021-09-13 10:03:29 -04:00
Michał Górny dd58083304 [lldb] [test] Remove parent output checks from follow-child tests
Remove the parent output checks, as they make the test flaky while
serving no real purpose.  If the parent crashed/hanged, it will never
resume the child and the test would fail anyway.
2021-09-13 15:50:00 +02:00
Muiez Ahmed 4247381e26 [SystemZ][z/OS] Missing wchar functions libc++
The aim is to add the missing z/OS specific implementations for mbsnrtowcs and wcsnrtombs, as part of libc++.

Differential Revision: https://reviews.llvm.org/D98207
2021-09-13 09:43:21 -04:00
Matthias Springer 7c9b6a3355 [mlir][linalg] ComprehensiveBufferize: Do not copy InitTensorOps
Do not copy InitTensorOps or casts thereof.

Differential Revision: https://reviews.llvm.org/D109656
2021-09-13 22:31:54 +09:00
Florian Hahn 4b342268c0
[VPlan] Add test that requires duplicating recipe for sinking. 2021-09-13 14:21:20 +01:00
Pavel Labath c82dbc2924 [lldb] Skip TestGuiBasicDebug due to pr51833 2021-09-13 15:11:28 +02:00
Anna Thomas b4e787d8f4 [InstCombining] Refactor checks for TryToSinkInstruction. NFC
Moved out the checks for profitability of TryToSinkInstructions
into a lambda function.
This will also allow us to easily add checks for bailing out if the
transform is not profitable.

Tests-Run: instCombine tests.
2021-09-13 09:04:34 -04:00
Kristóf Umann 9d359f6c73 [analyzer] MallocChecker: Add notes from NoOwnershipChangeVisitor only when a function "intents", but doesn't change ownership, enable by default
D105819 Added NoOwnershipChangeVisitor, but it is only registered when an
off-by-default, hidden checker option was enabled. The reason behind this was
that it grossly overestimated the set of functions that really needed a note:

std::string getTrainName(const Train *T) {
  return T->name;
} // note: Retuning without changing the ownership of or deallocating memory
// Umm... I mean duh? Nor would I expect this function to do anything like that...

void foo() {
  Train *T = new Train("Land Plane");
  print(getTrainName(T)); // note: calling getTrainName / returning from getTrainName
} // warn: Memory leak

This patch adds a heuristic that guesses that any function that has an explicit
operator delete call could have be responsible for deallocating the memory that
ended up leaking. This is waaaay too conservative (see the TODOs in the new
function), but it safer to err on the side of too little than too much, and
would allow us to enable the option by default *now*, and add refinements
one-by-one.

Differential Revision: https://reviews.llvm.org/D108753
2021-09-13 15:01:20 +02:00
Stefan Gränitz 9691851582 [JITLink] Factor out forEachRelocation() function from addRelocations() in ELF Aarch64 backend (NFC)
First step in reducing redundancy in `addRelocations()` implementations across ELF JITLink backends. The patch factors out common logic for ELF relocation traversal into the new helper function `forEachRelocation()` in the `ELFLinkGraphBuilder` base class. For now, this is applied to the Aarch64 implementation. Others may follow soon.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D109516
2021-09-13 14:59:38 +02:00
Nico Weber 648feabc65 [clang] Make the driver not diagnose errors on nonexistent linker inputs
When nonexistent linker inputs are passed to the driver, the linker
now errors out, instead of the compiler. If the linker does not run,
clang now emits a "warning: linker input unused" instead of an error
for nonexistent files.

The motivation for this change is that I noticed that
`clang-cl /winsysroot sysroot main.cc ole32.lib` emitted a
"ole32.lib not found" error, even though the linker finds it just fine when
I run `clang-cl /winsysroot sysroot main.cc /link ole32.lib`.

The same problem occurs if running `clang-cl main.cc ole32.lib` in a
non-MSVC shell.

The problem is that DiagnoseInputExistence() only looked for libs in %LIB%,
but MSVCToolChain uses much more involved techniques.

For this particular problem, we could make DiagnoseInputExistence() ask
the toolchain to see if it can find a .lib file, but in general the
driver can't know what the linker will do to find files, so it shouldn't
try. For example, if we implement PR24616, lld-link will look in the
registry to determine a good default for %LIB% if it isn't set.

This is less or a problem for the gcc driver, since .a paths there are
either passed via -l flags (which honor -L), or via a qualified path
(that doesn't honor -L) -- but for example ld.lld's --chroot flag
can also trigger this problem. Without this patch,
`clang -fuse-ld=lld -Wl,--chroot,some/dir /file.o` will complain that
`/file.o` doesn't exist, even though
`clang -fuse-ld=lld -Wl,--chroot,some/dir -Wl,/file.o` succeeds just fine.

This implements rnk's suggestion on the old bug PR27234.

Differential Revision: https://reviews.llvm.org/D109624
2021-09-13 08:57:38 -04:00
Tim Northover 5d070c8259 SwiftAsync: use runtime-provided flag for extended frame if back-deploying
When back-deploying Swift async code we can't always toggle the flag showing an
extended frame is present because it will confuse unwinders on systems released
before this feature. So in cases where the code might run there, we `or` in a
mask provided by the runtime (as an absolute symbol) telling us whether the
unwinders can cope.

When deploying only for newer OSs, we can still hard-code the bit-set for
greater efficiency.
2021-09-13 13:54:46 +01:00
Andrew Savonichev 6377426b4a Revert "[clang] Check unsupported types in expressions"
This reverts commit ec6c847179.

Fails on check-openmp:

/b/1/openmp-clang-x86_64-linux-debian/llvm.build/projects/openmp/runtime/test/lock/Output/omp_init_lock.c.tmp
--
Exit Code: -11
2021-09-13 15:34:21 +03:00