Commit Graph

394554 Commits

Author SHA1 Message Date
Carl Ritson 7d4baf25aa [AMDGPU] Add maximum NSA size limit ISA feature
Add maximum NSA size limit as an ISA feature.
Use this to reduce NSA usage on GFX10.1 to avoid stability issues
with 4 and 5 dwords NSA instructions.
Maintain use of longer NSA instructions on GFX10.3.

Note: this also contains some minor fixes for GlobalISel which
did not work correctly with non-NSA form instructions on GFX10.

Reviewed By: foad

Differential Revision: https://reviews.llvm.org/D103348
2021-07-23 16:16:06 +09:00
Dmitry Vyukov a7767171cb tsan: switch atexit mutex to the normal Mutex
Now that Mutex is blocking there is no point in using BlockingMutex.
Switch to Mutex.

Depends on D106379.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D106560
2021-07-23 09:13:37 +02:00
Dmitry Vyukov 0118a64934 tsan: switch to the new sanitizer_common mutex
Now that sanitizer_common mutex has feature-parity with tsan mutex,
switch tsan to the sanitizer_common mutex and remove tsan's custom mutex.

Reviewed By: vitalybuka, melver

Differential Revision: https://reviews.llvm.org/D106379
2021-07-23 09:13:26 +02:00
Dmitry Vyukov 8924d8e37e tsan: disable thread safety analysis in more functions
In preparation for replacing tsan Mutex with sanitizer_common Mutex,
which has thread-safety annotations. Thread safety analysis does not
understand MetaMap::GetAndLock which returns a locked sync object.

Reviewed By: vitalybuka, melver

Differential Revision: https://reviews.llvm.org/D106548
2021-07-23 09:12:59 +02:00
Dmitry Vyukov 3c92eb44d4 tsan: ignore interceptors in few more places
This is preparation to switching to the sanitizer_common Mutex.
Without this change after the switch we will start failing
on existing from the runtime with runtime mutexes held.
Previously it worked because CheckNoLocks did not see sanitizer_common mutexes.

Depends on D106547.

Reviewed By: vitalybuka, melver

Differential Revision: https://reviews.llvm.org/D106558
2021-07-23 09:12:46 +02:00
Dmitry Vyukov cfed8d0faf tsan: rename test Mutex to UserMutex
Rename Mutex class in tests to avoid conflicts with sanitizer_common Mutex.

Reviewed By: vitalybuka, melver

Differential Revision: https://reviews.llvm.org/D106547
2021-07-23 09:12:05 +02:00
Dmitry Vyukov 022439931f sanitizer_common: add deadlock detection to the Mutex2
Copy internal deadlock detector from tsan to sanitizer_common
    (with some cosmetic changes).
    Tsan version will be deleted in subsequent changes.
    This allows us to switch tsan to the sanitizer_common mutex
    and remove tsan's mutex.

Reviewed By: vitalybuka, melver

Differential Revision: https://reviews.llvm.org/D106546
2021-07-23 09:11:52 +02:00
Cullen Rhodes fde7550094 [AArch64][AsmParser] NFC: when creating a token IsSuffix=false should be default
Reviewed By: david-arm

Differential Revision: https://reviews.llvm.org/D106568
2021-07-23 06:36:06 +00:00
Fraser Cormack e8f9540362 [NFC] Fix early line-break in doxygen comment 2021-07-23 07:16:05 +01:00
Craig Topper f26ac73fa9 [X86] Add test case simplified from PR51175. NFC 2021-07-22 23:22:39 -07:00
Fraser Cormack 99ed6ce2bd [SelectionDAG][RISCV] Add tests showing missed scalable-splat optimizations
These tests show missed opportunities in the SelectionDAG layer when
dealing with scalable-vector splats. All of these are handled for the
equivalent `ISD::BUILD_VECTOR` code, and the tests have largely been
translated from the equivalent X86 tests.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D106574
2021-07-23 06:58:16 +01:00
Siva Chandra Reddy c698be47ff [libc] Raise denormal exception if the libc defines __FE_DENORM.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D106604
2021-07-23 05:42:18 +00:00
Johannes Doerfert d12ee28e2e [OpenMP] Simplify the ThreadStackTy for globalization fallback
With D106496 we can make the globalization fallback stack much simpler
and this version doesn't seem to experience the spurious failures and
deadlocks we have seen before.

Differential Revision: https://reviews.llvm.org/D106576
2021-07-22 23:57:46 -05:00
Johannes Doerfert 6ca969353c [Attributor] If provided, only look at simplification callbacks not IR
A simplification callback can mean that the IR value is modified beyond
the apparent IR semantics. That is, a `i1 true` could be replaced by an
`i1 false` based on high-level domain-specific information. If a user
provides a simplification callback we will not look at the IR but
instead give up if the callback returns a nullptr.
2021-07-22 23:57:37 -05:00
Hsiangkai Wang 4b2dd318dd [RISCV] Add FrameSetup/FrameDestroy flag to prologue/epilog instructions.
Differential Revision: https://reviews.llvm.org/D105086
2021-07-23 11:35:19 +08:00
Jacques Pienaar edffb97d1e [mlir] Fix comment typos 2021-07-22 20:04:40 -07:00
Tom Stellard 4cef90d972 cmake: Remove unused property on some targets: LLVM_LINK_LIBS
This doesn't appear to be used anywhere.

Reviewed By: serge-sans-paille

Differential Revision: https://reviews.llvm.org/D100021
2021-07-22 20:00:18 -07:00
Leonard Grey 5acc6d4572 [lld-macho] Disambiguate bitcode files with the same name by archive name/offset in archive
Ported from COFF/ELF; test is adapted from
test/COFF/thinlto-archivecollision.ll

LTO expects every bitcode file to have a unique name. If given multiple bitcode
files with the same name, it errors with "Expected at most one ThinLTO module
per bitcode file".

This change incorporates the archive name, to disambiguate members with the
same name in different archives and the offset in archive to disambiguate
members with the same name in the same archive.

Differential Revision: https://reviews.llvm.org/D106179
2021-07-22 22:50:25 -04:00
Joseph Huber 76c0c0ca86 [OpenMP][NFC] Fix formatting in CUDA plugin 2021-07-22 21:50:40 -04:00
Joseph Huber 3817ba13ae [OpenMP] Add environment variables to change stack / heap size in the CUDA plugin
This patch adds support for two environment variables to configure the device.
``LIBOMPTARGET_STACK_SIZE`` sets the amount of memory in bytes that each thread
has for its stack. ``LIBOMPTARGET_HEAP_SIZE`` sets the amount of heap memory
that can be allocated using malloc / free on the device.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D106627
2021-07-22 21:40:02 -04:00
Nico Weber 4a76bd0e31 [gn build] Allow use_asan=true on macOS
Seems to work.

(I only tried macOS, not iOS, but need to allow both because
the iOS toolchain used to build compiler-rt asserts otherwise.)
2021-07-22 21:38:02 -04:00
Nico Weber 377320fe80 [gn build] Reformat all gn files
Ran `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`.
2021-07-22 21:35:35 -04:00
Nico Weber 393116faad [lld/mac] Remove "else" after return
No behavior change
2021-07-22 21:31:52 -04:00
Giorgis Georgakoudis eaab880e45 [Attributor][Fix] Add overrides for AA2HS analysis 2021-07-22 18:20:14 -07:00
Kai Luo e4ed93cb25 [PowerPC] Implement XL compatible behavior of __compare_and_swap
According to https://www.ibm.com/docs/en/xl-c-and-cpp-aix/16.1?topic=functions-compare-swap-compare-swaplp
XL's `__compare_and_swap` has a weird behavior that

> In either case, the contents of the memory location specified by addr are copied into the memory location specified by old_val_addr.

(unlike c11 `atomic_compare_exchange` specified in http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf)

This patch let clang's implementation follow this behavior.

Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D106344
2021-07-23 01:16:02 +00:00
Giorgis Georgakoudis f8c40ed8f8 [OpenMP] Use AAHeapToStack/AAHeapToShared analysis in SPMDization
SPMDization D102307 detects incompatible OpenMP runtime calls to abort converting a target region to SPMD mode. Calls to memory allocation/de-allocation routines kmpc_alloc_shared, kmpc_free_shared are incompatible unless they are removed by AAHeapToStack/AAHeapToShared analysis. This patch extends SPMDization detection to include AAHeapToStack/AAHeapToShared analysis results for enlarging the scope of possible SPMDized regions detected.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D105634
2021-07-22 18:08:37 -07:00
Vitaly Buka 921c548f11 [compiler-rt] Fix lld dependency for sanitizers
TARGET lld is always false there.
2021-07-22 18:02:19 -07:00
Vitaly Buka 44ba8c691c [NFC][asan] Always pass Dominator Trees into forAllReachableExits 2021-07-22 18:01:38 -07:00
Rob Suderman 286e7bdd3e [mlir][tosa] Make tosa MakeBroadcastable pass handle unreanked tensors.
If this pass executes without shape inference its possible for unranked tensors
to appear in the IR. This pass should gracefully handle unranked tensors.

Differential Revision: https://reviews.llvm.org/D106617
2021-07-22 17:57:05 -07:00
Thomas Johnson 51d8e67e88 [ARC] Add tablegen definition for the Find Leading Set (FLS) instruction
Differential Revision: https://reviews.llvm.org/D106602
2021-07-22 17:42:25 -07:00
Gulfem Savrun Yeniceri e50a38840d [profile] Add binary id into profiles
This patch adds binary id into profiles to easily associate binaries
with the corresponding profiles. There is an RFC that discusses
the motivation, design and implementation in more detail:
https://lists.llvm.org/pipermail/llvm-dev/2021-June/151154.html

Differential Revision: https://reviews.llvm.org/D102039
2021-07-23 00:19:12 +00:00
Fangrui Song 120b18767c [ELF] --gc-sections: allow GC on reserved sections in a group
This generalizes D70146 (SHT_NOTE) to more reserved sections and makes our rules
more consistent. Now SHF_GROUP is more similar to SHF_LINK_ORDER.

For SHT_INIT_ARRAY/SHT_FINI_ARRAY, the rule will be closer to PE/COFF link.exe.

Previously sanitizers use llvm.global_ctors to make module_ctor a GC
root, which is considered an abuse.
https://groups.google.com/g/generic-abi/c/TpleUEkNoQI

We can squeak through on compatibility issues because compilers otherwise don't
use SHF_GROUP special sections.
2021-07-22 17:09:23 -07:00
Fangrui Song 54bc2d812e [ELF][test] Add a test about GCable SHF_LINK_ORDER SHT_INIT_ARRAY 2021-07-22 17:04:54 -07:00
Hongtao Yu ab5ac659c8 [CSSPGO] Fix a typo in SampleContextTracker
Fixing a typo in SampleContextTracker to use debug name when debug linkage name is no present. This should only affect C programs.

Saw 0.6% perf win on Cinder which is mostly C code.

Reviewed By: wenlei, wmi

Differential Revision: https://reviews.llvm.org/D106599
2021-07-22 16:44:50 -07:00
Nico Weber 2d6fb62ef2 [lld/mac] Handle symbols from -U in treatUndefinedSymbol()
In ld64, `-U section$start$FOO$bar` handles `section$start$FOO$bar`
as a regular `section$start` symbol, that is section$start processing
happens before -U processing.

Likely, nobody uses that in practice so it doesn't seem very important
to be compatible with this, but it also moves the -U handling code next
to the `-undefined dynamic_lookup` handling code, which is nice because
they do the same thing. And, in fact, this did identify a bug in a corner
case in the intersection of `-undefined dynamic_lookup` and dead-stripping
(fix for that in D106565).

Vaguely related to PR50760.

No interesting behavior change.

Differential Revision: https://reviews.llvm.org/D106566
2021-07-22 19:43:57 -04:00
Nico Weber 681107e9f0 [gn build] (manually) port f8c6515554 (libLLVMDWP) 2021-07-22 19:38:50 -04:00
Mara Sophie Grosch 5b93e3a75f Add llvm-readobj and binutils symlinks to LLVM_TOOLCHAIN_TOOLS
This patch adds llvm-readobj and the binutils symlink for readelf to
LLVM_TOOLCHAIN_TOOLS.

Tvoid *thread, void *attr,hey are required by some (most?)
autoconf-built libraries, adding these allows me to build newlib with
the toolchain generated this way.

Also opened an issue for that some days ago, see
https://bugs.llvm.org/show_bug.cgi?id=50698

Reviewed By: sbc100

Differential Revision: https://reviews.llvm.org/D104957
2021-07-22 16:33:51 -07:00
Thomas Lively 481084f669 [WebAssembly][NFC] Update test expectations labels after db7efcab7d
Commit db7efcab7d changed the implementations of the wasm_*_extract_lane and
wasm_*_replace_lane intrinsics from using builtin functions to using the
standard vector extensions. This did not change the resulting IR, but it changes
how update_cc_test_checks.py labels values in the IR. This commit simply updates
those labels.

Differential Revision: https://reviews.llvm.org/D106611
2021-07-22 16:31:12 -07:00
Nico Weber 5ae39d4f97 [lld/mac] Fix bug in interaction of -dead_strip and -undefined dynamic_lookup
We lost the `used` bit on the Undefined when we replaced it with a DylibSymbol
in treatUndefined().

Differential Revision: https://reviews.llvm.org/D106565
2021-07-22 19:30:46 -04:00
Christopher Di Bella 0cf65382ad [libcxx][modularisation] properly modularises advance, next, and prev
`__function_like` wasn't being exported, so certain properties of the
`ranges` functions weren't being propagated in modules land.

Differential Revision: https://reviews.llvm.org/D105078
2021-07-22 23:30:02 +00:00
Mircea Trofin 207c4d4d37 [MLGO] Strip TF_PIP cmake variable
This should fix build breaks for 'development' mode. The other modes
were unaffected - 'release' because it doesn't use TFUtils.cpp, and the
mixed mode because the AOT compiled code brings in the necessary include
dirs anyway.
2021-07-22 16:28:13 -07:00
Shilei Tian ea452353c0 [OpenMP] Refined the logic to give a regular task from a hidden helper task
In current implementation, if a regular task depends on a hidden helper task,
and when the hidden helper task is releasing its dependences, it directly calls
`__kmp_omp_task`. This could cause a problem that if `__kmp_push_task` returns
`TASK_NOT_PUSHED`, the task will be executed immediately. However, the hidden
helper threads are assumed to only execute hidden helper tasks. This could cause
problems because when calling `__kmp_omp_task`, the encountering gtid, which is
not the real one of the thread, is passed.

This patch uses `__kmp_give_task`, but because it is a static function, a new
wrapper `__kmpc_give_task` is added.

Reviewed By: AndreyChurbanov

Differential Revision: https://reviews.llvm.org/D106572
2021-07-22 19:21:29 -04:00
Florian Mayer 96c63492cb [hwasan] Use stack safety analysis.
This avoids unnecessary instrumentation.

Reviewed By: eugenis, vitalybuka

Differential Revision: https://reviews.llvm.org/D105703
2021-07-22 16:20:27 -07:00
Geoffrey Martin-Noble be583be23b [Bazel] Rename LLVMDWP to DWP
Since Bazel has packages, we don't prefix target names with LLVM. I
forgot when translating the CMake.
2021-07-22 16:05:43 -07:00
Mircea Trofin 14fad06a36 [docs] Add the compiler-rt requirement to the test suite doc
Differential Revision: https://reviews.llvm.org/D101467
2021-07-22 16:03:45 -07:00
Michael McLoughlin b4f8a000f6 [Bazel] Change external_zlib attribute to string
When using `llvm_zlib_external` rule with `external_zlib` attribute set to a
label referring to the main repository, like `@//third_party/zlib`, it will be
replaced with `//third_party/zlib` after template substitution. This will then
attempt to find `//third_party/zlib` within the local repository
`@llvm_zlib//third_party/zlib`, which does not exist, rather than the intended
reference back to the main repository. The issue appears to be that the
conversion of `Label` type to string with
`str(repository_ctx.attr.external_zlib)`, which is causing the main repository
qualifier to be lost.

This diff fixes the issue by changing the `external_zlib` attribute to
`attr.string` type rather than `attr.label`.

In future a more elegant solution may be possible that preserves use of the
`Label` type, depending on resolution of the issue
https://github.com/bazelbuild/bazel/issues/13731.

Ported from Github PR https://github.com/google/llvm-bazel/pull/236.

Reviewed By: GMNGeoffrey

Differential Revision: https://reviews.llvm.org/D106606
2021-07-22 16:02:37 -07:00
Rob Suderman cf8a1f6208 [mlir][tosa] Quantized Conv2DOp lowering to linalg added.
Includes a version of a quantized conv2D operations with a lowering from TOSA
to linalg with corresponding test. We keep the quantized and quantized variants
as separate named ops to avoid the additional operations for non-quantized
convolutions.

Differential Revision: https://reviews.llvm.org/D106407
2021-07-22 15:42:26 -07:00
George Balatsouras bf281f3647 [dfsan] Add wrappers for v*printf functions
Functions `vsnprintf`, `vsprintf` and `vfprintf` commonly occur in DFSan warnings.

Reviewed By: stephan.yichao.zhao

Differential Revision: https://reviews.llvm.org/D106195
2021-07-22 15:39:17 -07:00
Jose M Monsalve Diaz 68d6278a6e [OpenMP] Renaming RT functions `GetNumberOfBlocksInKernel` and `GetNumberOfThreadsInBlock`
These functions should follow the camel case convention. These are really easy to change
and are needed for D106033.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D106390
2021-07-22 18:17:49 -04:00
Jim Ingham bcce8e0fcc Fix the logic so stop-hooks get run after a breakpoint that ran an expression
Code was added to Target::RunStopHook to make sure that we don't run stop hooks when
you stop after an expression evaluation. But the way it was done was to check that we
hadn't run an expression since the last natural stop. That failed in the case where you
stopped for a breakpoint which had run an expression, because the stop-hooks get run
after the breakpoint actions, and so by the time we got to running the stop-hooks,
we had already run a user expression.

I fixed this by adding a target ivar tracking the last natural stop ID at which we had
run a stop-hook. Then we keep track of this and make sure we run the stop-hooks only
once per natural stop.

Differential Revision: https://reviews.llvm.org/D106514
2021-07-22 15:06:41 -07:00