platform/upstream/llvm.git
2 years ago[OpenMP] Fix CUDA plugin build after 3817ba13aea3.
Abhinav Gaba [Fri, 23 Jul 2021 06:43:05 +0000 (14:43 +0800)]
[OpenMP] Fix CUDA plugin build after 3817ba13aea3.

The build was broken on machines that don't have Cuda SDK installed.

See https://reviews.llvm.org/D106627 for the original discussion.

2 years ago[MS] Preserve base register %esi around movs[bwl]
namazso [Fri, 23 Jul 2021 07:53:48 +0000 (15:53 +0800)]
[MS] Preserve base register %esi around movs[bwl]

fix for behavior reported in https://bugs.llvm.org/show_bug.cgi?id=51100 workaround for root cause https://bugs.llvm.org/show_bug.cgi?id=16830

similar to https://reviews.llvm.org/D101338

Reviewed By: craig.topper

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

2 years ago[clang-tidy] Improve "common type" diagnostic output in 'bugprone-easily-swappable...
Whisperity [Wed, 21 Jul 2021 14:09:39 +0000 (16:09 +0200)]
[clang-tidy] Improve "common type" diagnostic output in 'bugprone-easily-swappable-parameters'

Make the check handle cases of the "common type" involved in the mix
being non-trivial, e.g. pointers, references, attributes, these things
coming from typedefs, etc.

This results in clearer diagnostics that have more coverage in their
explanation, such as saying `const int &` as common type instead of
`int`.

Reviewed By: aaron.ballman

Differential Revision: http://reviews.llvm.org/D106442

2 years ago[mlir] Async: special handling for parallel loops with zero iterations
Eugene Zhulenev [Fri, 23 Jul 2021 00:05:32 +0000 (17:05 -0700)]
[mlir] Async: special handling for parallel loops with zero iterations

Reviewed By: mehdi_amini

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

2 years ago[libc++][doc] Update the LWG issues.
Mark de Wever [Thu, 22 Jul 2021 06:04:48 +0000 (08:04 +0200)]
[libc++][doc] Update the LWG issues.

Updates the status pages with the LWG issues accepted in the Standard
during the June 2021 plenary session. The LWG papers for this meeting
have been added in D105103.

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

2 years ago[AArch64] Add worst case shuffle costs
David Green [Fri, 23 Jul 2021 08:01:58 +0000 (09:01 +0100)]
[AArch64] Add worst case shuffle costs

This adds some missing single source shuffle costs for AArch64, of i16
and i8 vectors. v4i16 are the same as v4i32 with a worse case cost of 3
coming from the perfect shuffle tables. The larger vector sizes expand
into a constant pool, plus a load (and adrp) and a tbl. I arbitrarily
chose 8 for the cost to be expensive but not too expensive.

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

2 years ago[mlir][Linalg] Fix a missing copy when source of insert_slice is not inplace.
Nicolas Vasilache [Fri, 23 Jul 2021 07:14:11 +0000 (07:14 +0000)]
[mlir][Linalg] Fix a missing copy when source of insert_slice is not inplace.

When the source tensor of a tensor.insert_slice is not equivalent to an inplace buffer an extra copy is necessary. This revision adds the missing copy.

Reviewed By: gysit

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

2 years ago[ConstantFolding] Fold constrained arithmetic intrinsics
Serge Pavlov [Tue, 4 May 2021 13:43:56 +0000 (20:43 +0700)]
[ConstantFolding] Fold constrained arithmetic intrinsics

Constfold constrained variants of operations fadd, fsub, fmul, fdiv,
frem, fma and fmuladd.

The change also sets up some means to support for removal of unused
constrained intrinsics. They are declared as accessing memory to model
interaction with floating point environment, so they were not removed,
as they have side effect. Now constrained intrinsics that have
"fpexcept.ignore" as exception behavior are removed if they have no uses.
As for intrinsics that have exception behavior other than "fpexcept.ignore",
they can be removed if it is known that they do not raise floating point
exceptions. It happens when doing constant folding, attributes of such
intrinsic are changed so that the intrinsic is not claimed as accessing
memory.

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

2 years ago[AMDGPU] Fix running ResourceUsageAnalysis
Sebastian Neubauer [Wed, 21 Jul 2021 17:14:12 +0000 (19:14 +0200)]
[AMDGPU] Fix running ResourceUsageAnalysis

Clear the map when running the analysis multiple times.
The assertion that should ensure that every function is only
analyzed once triggered sometimes (once every ~70 compiles of some
graphics pipelines) when two functions of subsequent runs were allocated
at the same address.

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

2 years ago[gn build] Port 0118a649348b
LLVM GN Syncbot [Fri, 23 Jul 2021 07:19:25 +0000 (07:19 +0000)]
[gn build] Port 0118a649348b

2 years ago[AMDGPU] Add maximum NSA size limit ISA feature
Carl Ritson [Thu, 22 Jul 2021 01:43:25 +0000 (10:43 +0900)]
[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

2 years agotsan: switch atexit mutex to the normal Mutex
Dmitry Vyukov [Thu, 22 Jul 2021 14:40:47 +0000 (16:40 +0200)]
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

2 years agotsan: switch to the new sanitizer_common mutex
Dmitry Vyukov [Tue, 20 Jul 2021 11:31:10 +0000 (13:31 +0200)]
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

2 years agotsan: disable thread safety analysis in more functions
Dmitry Vyukov [Wed, 21 Jul 2021 07:28:48 +0000 (09:28 +0200)]
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

2 years agotsan: ignore interceptors in few more places
Dmitry Vyukov [Thu, 22 Jul 2021 14:32:55 +0000 (16:32 +0200)]
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

2 years agotsan: rename test Mutex to UserMutex
Dmitry Vyukov [Tue, 20 Jul 2021 13:20:29 +0000 (15:20 +0200)]
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

2 years agosanitizer_common: add deadlock detection to the Mutex2
Dmitry Vyukov [Tue, 20 Jul 2021 09:17:00 +0000 (11:17 +0200)]
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

2 years ago[AArch64][AsmParser] NFC: when creating a token IsSuffix=false should be default
Cullen Rhodes [Fri, 23 Jul 2021 06:10:38 +0000 (06:10 +0000)]
[AArch64][AsmParser] NFC: when creating a token IsSuffix=false should be default

Reviewed By: david-arm

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

2 years ago[NFC] Fix early line-break in doxygen comment
Fraser Cormack [Fri, 23 Jul 2021 06:15:27 +0000 (07:15 +0100)]
[NFC] Fix early line-break in doxygen comment

2 years ago[X86] Add test case simplified from PR51175. NFC
Craig Topper [Fri, 23 Jul 2021 06:20:54 +0000 (23:20 -0700)]
[X86] Add test case simplified from PR51175. NFC

2 years ago[SelectionDAG][RISCV] Add tests showing missed scalable-splat optimizations
Fraser Cormack [Thu, 22 Jul 2021 16:06:51 +0000 (17:06 +0100)]
[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

2 years ago[libc] Raise denormal exception if the libc defines __FE_DENORM.
Siva Chandra Reddy [Thu, 22 Jul 2021 22:05:34 +0000 (22:05 +0000)]
[libc] Raise denormal exception if the libc defines __FE_DENORM.

Reviewed By: michaelrj

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

2 years ago[OpenMP] Simplify the ThreadStackTy for globalization fallback
Johannes Doerfert [Thu, 22 Jul 2021 17:18:46 +0000 (12:18 -0500)]
[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

2 years ago[Attributor] If provided, only look at simplification callbacks not IR
Johannes Doerfert [Thu, 22 Jul 2021 05:36:31 +0000 (00:36 -0500)]
[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.

2 years ago[RISCV] Add FrameSetup/FrameDestroy flag to prologue/epilog instructions.
Hsiangkai Wang [Tue, 29 Jun 2021 07:22:18 +0000 (15:22 +0800)]
[RISCV] Add FrameSetup/FrameDestroy flag to prologue/epilog instructions.

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

2 years ago[mlir] Fix comment typos
Jacques Pienaar [Fri, 23 Jul 2021 03:04:40 +0000 (20:04 -0700)]
[mlir] Fix comment typos

2 years agocmake: Remove unused property on some targets: LLVM_LINK_LIBS
Tom Stellard [Fri, 23 Jul 2021 02:58:05 +0000 (19:58 -0700)]
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

2 years ago[lld-macho] Disambiguate bitcode files with the same name by archive name/offset...
Leonard Grey [Fri, 23 Jul 2021 02:47:22 +0000 (22:47 -0400)]
[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

2 years ago[OpenMP][NFC] Fix formatting in CUDA plugin
Joseph Huber [Fri, 23 Jul 2021 01:50:09 +0000 (21:50 -0400)]
[OpenMP][NFC] Fix formatting in CUDA plugin

2 years ago[OpenMP] Add environment variables to change stack / heap size in the CUDA plugin
Joseph Huber [Fri, 23 Jul 2021 01:19:14 +0000 (21:19 -0400)]
[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

2 years ago[gn build] Allow use_asan=true on macOS
Nico Weber [Fri, 23 Jul 2021 01:38:00 +0000 (21:38 -0400)]
[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.)

2 years ago[gn build] Reformat all gn files
Nico Weber [Fri, 23 Jul 2021 01:35:35 +0000 (21:35 -0400)]
[gn build] Reformat all gn files

Ran `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`.

2 years ago[lld/mac] Remove "else" after return
Nico Weber [Fri, 23 Jul 2021 01:31:32 +0000 (21:31 -0400)]
[lld/mac] Remove "else" after return

No behavior change

2 years ago[Attributor][Fix] Add overrides for AA2HS analysis
Giorgis Georgakoudis [Fri, 23 Jul 2021 01:20:14 +0000 (18:20 -0700)]
[Attributor][Fix] Add overrides for AA2HS analysis

2 years ago[PowerPC] Implement XL compatible behavior of __compare_and_swap
Kai Luo [Fri, 23 Jul 2021 00:57:53 +0000 (00:57 +0000)]
[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

2 years ago[OpenMP] Use AAHeapToStack/AAHeapToShared analysis in SPMDization
Giorgis Georgakoudis [Thu, 22 Jul 2021 01:36:17 +0000 (18:36 -0700)]
[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

2 years ago[compiler-rt] Fix lld dependency for sanitizers
Vitaly Buka [Fri, 23 Jul 2021 00:36:32 +0000 (17:36 -0700)]
[compiler-rt] Fix lld dependency for sanitizers

TARGET lld is always false there.

2 years ago[NFC][asan] Always pass Dominator Trees into forAllReachableExits
Vitaly Buka [Fri, 23 Jul 2021 00:07:44 +0000 (17:07 -0700)]
[NFC][asan] Always pass Dominator Trees into forAllReachableExits

2 years ago[mlir][tosa] Make tosa MakeBroadcastable pass handle unreanked tensors.
Rob Suderman [Fri, 23 Jul 2021 00:22:11 +0000 (17:22 -0700)]
[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

2 years ago[ARC] Add tablegen definition for the Find Leading Set (FLS) instruction
Thomas Johnson [Thu, 22 Jul 2021 23:26:46 +0000 (16:26 -0700)]
[ARC] Add tablegen definition for the Find Leading Set (FLS) instruction

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

2 years ago[profile] Add binary id into profiles
Gulfem Savrun Yeniceri [Thu, 6 May 2021 16:09:12 +0000 (16:09 +0000)]
[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

2 years ago[ELF] --gc-sections: allow GC on reserved sections in a group
Fangrui Song [Fri, 23 Jul 2021 00:09:23 +0000 (17:09 -0700)]
[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.

2 years ago[ELF][test] Add a test about GCable SHF_LINK_ORDER SHT_INIT_ARRAY
Fangrui Song [Fri, 23 Jul 2021 00:04:54 +0000 (17:04 -0700)]
[ELF][test] Add a test about GCable SHF_LINK_ORDER SHT_INIT_ARRAY

2 years ago[CSSPGO] Fix a typo in SampleContextTracker
Hongtao Yu [Thu, 22 Jul 2021 21:41:55 +0000 (14:41 -0700)]
[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

2 years ago[lld/mac] Handle symbols from -U in treatUndefinedSymbol()
Nico Weber [Thu, 22 Jul 2021 15:20:36 +0000 (11:20 -0400)]
[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

2 years ago[gn build] (manually) port f8c6515554cc (libLLVMDWP)
Nico Weber [Thu, 22 Jul 2021 23:38:19 +0000 (19:38 -0400)]
[gn build] (manually) port f8c6515554cc (libLLVMDWP)

2 years agoAdd llvm-readobj and binutils symlinks to LLVM_TOOLCHAIN_TOOLS
Mara Sophie Grosch [Thu, 22 Jul 2021 23:33:20 +0000 (16:33 -0700)]
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

2 years ago[WebAssembly][NFC] Update test expectations labels after db7efcab7dd9
Thomas Lively [Thu, 22 Jul 2021 23:31:12 +0000 (16:31 -0700)]
[WebAssembly][NFC] Update test expectations labels after db7efcab7dd9

Commit db7efcab7dd9 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

2 years ago[lld/mac] Fix bug in interaction of -dead_strip and -undefined dynamic_lookup
Nico Weber [Thu, 22 Jul 2021 15:37:29 +0000 (11:37 -0400)]
[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

2 years ago[libcxx][modularisation] properly modularises advance, next, and prev
Christopher Di Bella [Tue, 29 Jun 2021 03:53:44 +0000 (03:53 +0000)]
[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

2 years ago[MLGO] Strip TF_PIP cmake variable
Mircea Trofin [Thu, 22 Jul 2021 23:26:46 +0000 (16:26 -0700)]
[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.

2 years ago[OpenMP] Refined the logic to give a regular task from a hidden helper task
Shilei Tian [Thu, 22 Jul 2021 23:20:57 +0000 (19:20 -0400)]
[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

2 years ago[hwasan] Use stack safety analysis.
Florian Mayer [Thu, 22 Jul 2021 21:19:21 +0000 (14:19 -0700)]
[hwasan] Use stack safety analysis.

This avoids unnecessary instrumentation.

Reviewed By: eugenis, vitalybuka

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

2 years ago[Bazel] Rename LLVMDWP to DWP
Geoffrey Martin-Noble [Thu, 22 Jul 2021 23:05:40 +0000 (16:05 -0700)]
[Bazel] Rename LLVMDWP to DWP

Since Bazel has packages, we don't prefix target names with LLVM. I
forgot when translating the CMake.

2 years ago[docs] Add the compiler-rt requirement to the test suite doc
Mircea Trofin [Wed, 28 Apr 2021 16:09:01 +0000 (09:09 -0700)]
[docs] Add the compiler-rt requirement to the test suite doc

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

2 years ago[Bazel] Change external_zlib attribute to string
Michael McLoughlin [Thu, 22 Jul 2021 23:01:49 +0000 (16:01 -0700)]
[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

2 years ago[mlir][tosa] Quantized Conv2DOp lowering to linalg added.
Rob Suderman [Tue, 20 Jul 2021 21:41:37 +0000 (14:41 -0700)]
[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

2 years ago[dfsan] Add wrappers for v*printf functions
George Balatsouras [Fri, 16 Jul 2021 21:53:32 +0000 (14:53 -0700)]
[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

2 years ago[OpenMP] Renaming RT functions `GetNumberOfBlocksInKernel` and `GetNumberOfThreadsInB...
Jose M Monsalve Diaz [Thu, 22 Jul 2021 22:17:09 +0000 (18:17 -0400)]
[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

2 years agoFix the logic so stop-hooks get run after a breakpoint that ran an expression
Jim Ingham [Thu, 22 Jul 2021 19:03:12 +0000 (12:03 -0700)]
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

2 years ago[AArch64] Regenerate test arm64-ccmp.ll
Eli Friedman [Thu, 22 Jul 2021 22:03:05 +0000 (15:03 -0700)]
[AArch64] Regenerate test arm64-ccmp.ll

2 years ago[Bazel] Update for f8c6515554
Geoffrey Martin-Noble [Thu, 22 Jul 2021 21:51:04 +0000 (14:51 -0700)]
[Bazel] Update for f8c6515554

Update Bazel for
https://github.com/llvm/llvm-project/commit/f8c6515554 by splitting out
an LLVMDWP library target.

2 years ago[DebugInfo] Add -fno-ctor-homing for as counterpart to -fuse-ctor-homing
Amy Huang [Thu, 22 Jul 2021 18:26:03 +0000 (11:26 -0700)]
[DebugInfo] Add -fno-ctor-homing for as counterpart to -fuse-ctor-homing

Add an opt out flag for constructor homing.

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

2 years agoPR51158: Don't emit -Wswitch or -Wcovered-switch-default for empty enums
David Blaikie [Thu, 22 Jul 2021 21:23:32 +0000 (14:23 -0700)]
PR51158: Don't emit -Wswitch or -Wcovered-switch-default for empty enums

An empty enum is used to implement C++'s new-ish "byte" type (to make
sure it's a separate type for overloading, etc - compared to a typedef)
- without any enumerators. Some clang warnings don't make sense in this
sort of situation, so let's skip them for empty enums.

It's arguable that possibly some situations of enumerations without
enumerators might want the previous-to-this-patch behavior (if the enum
is autogenerated and in some cases comes up empty, then maybe a default
in an empty switch would still be considered problematic - so that when
you add the first enumeration you do get a -Wswitch warning). But I
think that's niche enough & this std::byte case is mainstream enough
that we should prioritize the latter over the former.

If someone's got a middle ground proposal to account for both of those
situations, I'm open to patches/suggestions/etc.

2 years ago[dfsan] Make warn_unimplemented off by default
Jianzhou Zhao [Thu, 22 Jul 2021 21:00:45 +0000 (21:00 +0000)]
[dfsan] Make warn_unimplemented off by default

Because almost all internal use cases need to turn warn_unimplemented off.

2 years ago[SimplifyCFG] SimplifyCondBranchToTwoReturns(): really only deal with different ret...
Roman Lebedev [Thu, 22 Jul 2021 21:13:46 +0000 (00:13 +0300)]
[SimplifyCFG] SimplifyCondBranchToTwoReturns(): really only deal with different ret blocks

This function is called when some predecessor of an empty return block
ends with a conditional branch, with both successors being empty ret blocks.

Now, because of the way SimplifyCFG works, it might happen to simplify
one of the blocks in a way that makes a conditional branch
into an unconditional one, since it's destinations are now identical,
but it might not have actually simplified said conditional branch
into an unconditional one yet.

So, we have to check that ourselves first,
especially now that SimplifyCFG aggressively tail-merges
all ret and resume blocks.

Even if it was an unconditional branch already,
`SimplifyCFGOpt::simplifyReturn()` doesn't call `FoldReturnIntoUncondBranch()`
by default.

2 years ago[NFC][LoopDeletion] Autogenerate checlines in simplify-then-delete.ll test
Roman Lebedev [Thu, 22 Jul 2021 21:28:43 +0000 (00:28 +0300)]
[NFC][LoopDeletion] Autogenerate checlines in simplify-then-delete.ll test

2 years ago[NFC][SimplifyCFG] Add test for SimplifyCondBranchToTwoReturns() mishandling
Roman Lebedev [Thu, 22 Jul 2021 21:09:44 +0000 (00:09 +0300)]
[NFC][SimplifyCFG] Add test for SimplifyCondBranchToTwoReturns() mishandling

2 years ago[DWP] Refactoring llvm-dwp in to a library part 2
Alexander Yermolovich [Thu, 22 Jul 2021 21:11:49 +0000 (14:11 -0700)]
[DWP] Refactoring llvm-dwp in to a library part 2

This is follow up to https://reviews.llvm.org/D106198 where llvm-dwp was refactored in to multiple files.
In this patch moving them in to lib/include directories.

Reviewed By: dblaikie

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

2 years ago[asan] Modified ASAN_MEMORY_ACCESS_CALLBACK to use a function call to ReportGenericEr...
Kirill Stoimenov [Wed, 21 Jul 2021 16:20:35 +0000 (16:20 +0000)]
[asan] Modified ASAN_MEMORY_ACCESS_CALLBACK to use a function call to ReportGenericErrorWrapper.

This change eliminate the stack frame for the fast path and improves runtime performance.

Reviewed By: vitalybuka

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

2 years ago[NFC] Fix test build breakage on Darwin
Shu-Chun Weng [Thu, 22 Jul 2021 21:17:58 +0000 (14:17 -0700)]
[NFC] Fix test build breakage on Darwin

2 years agoReland: "[WebAssembly] Deduplicate imports of the same module name, field name, and...
Nick Fitzgerald [Thu, 22 Jul 2021 21:12:50 +0000 (14:12 -0700)]
Reland: "[WebAssembly] Deduplicate imports of the same module name, field name, and type"

When two symbols import the same thing, only one import should be
emitted in the Wasm file.

Fixes https://bugs.llvm.org/show_bug.cgi?id=50938

Reverted in: 16aac493e59519377071e900d119ba2e7e5b525d.

Reviewed By: sbc100

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

2 years ago[mlir] Also update inferReturnTensorTypes (NFC)
Jacques Pienaar [Thu, 22 Jul 2021 20:57:36 +0000 (13:57 -0700)]
[mlir] Also update inferReturnTensorTypes (NFC)

Missed this one in the first go.

2 years ago[lldb] Fix build failure introduced by 3d4cadfb26437bd686ca8177f5454a366fed59eb
Med Ismail Bennani [Thu, 22 Jul 2021 20:54:27 +0000 (20:54 +0000)]
[lldb] Fix build failure introduced by 3d4cadfb26437bd686ca8177f5454a366fed59eb

This patch updates the `ScriptedProcess::GetGenericInteger` return type
to `llvm::Optional<unsigned long long>` to match implementation.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[lldb/Interpreter] Conform ScriptedProcessPythonInterface to SWIG python types
Med Ismail Bennani [Thu, 22 Jul 2021 20:47:25 +0000 (20:47 +0000)]
[lldb/Interpreter] Conform ScriptedProcessPythonInterface to SWIG python types

This patch should address the compiler warnings due to mismatch type
comparaison.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[LLD] [COFF] Make -export-all-symbols work as intended for EXEs
Martin Storsjö [Sun, 18 Jul 2021 19:52:32 +0000 (22:52 +0300)]
[LLD] [COFF] Make -export-all-symbols work as intended for EXEs

If some symbols are marked with dllexport, we still want to export
all symbols if -export-all-symbols is specified. Previously, this
only worked as it should for DLL output, not for EXE.

This should fix downstream bug
https://github.com/msys2/MINGW-packages/issues/9163.

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

2 years ago[MLGO] Correct protobuf path
Mircea Trofin [Thu, 22 Jul 2021 20:24:28 +0000 (13:24 -0700)]
[MLGO] Correct protobuf path

2 years ago[clang-tidy] performance-unnecessary-copy-initialization: Create option to exclude...
Felix Berger [Fri, 16 Jul 2021 18:38:47 +0000 (14:38 -0400)]
[clang-tidy] performance-unnecessary-copy-initialization: Create option to exclude container types from triggering the check.

Add string list option of type names analagous to `AllowedTypes` which lets
users specify a list of ExcludedContainerTypes.

Types matching this list will not trigger the check when an expensive variable
is copy initialized from a const accessor method they provide, i.e.:

```
ExcludedContainerTypes = 'ExcludedType'

void foo() {
  ExcludedType<ExpensiveToCopy> Container;
  const ExpensiveToCopy NecessaryCopy = Container.get();
}
```

Even though an expensive to copy variable is copy initialized the check does not
trigger because the container type is excluded.

This is useful for container types that don't own their data, such as view types
where modification of the returned references in other places cannot be reliably
tracked, or const incorrect types.

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

Reviewed-by: ymandel
2 years ago[WebAssembly] Implementation of global.get/set for reftypes in LLVM IR
Paulo Matos [Thu, 22 Jul 2021 19:11:39 +0000 (21:11 +0200)]
[WebAssembly] Implementation of global.get/set for reftypes in LLVM IR

Reland of 31859f896.

This change implements new DAG notes GLOBAL_GET/GLOBAL_SET, and
lowering methods for load and stores of reference types from IR
globals. Once the lowering creates the new nodes, tablegen pattern
matches those and converts them to Wasm global.get/set.

Reviewed By: tlively

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

2 years ago[NFC][MLGO] Fix vector sizing
Mircea Trofin [Thu, 22 Jul 2021 19:47:49 +0000 (12:47 -0700)]
[NFC][MLGO] Fix vector sizing

The bots only build release mode, and the use of `reserve` instead of
`resize`, while not causing invalid memory accesses, is incorrect.

2 years ago[AIX] Define __LONGDOUBLE64 macro
Jake Egan [Thu, 22 Jul 2021 19:44:26 +0000 (15:44 -0400)]
[AIX] Define __LONGDOUBLE64 macro

This patch defines the macro __LONGDOUBLE64 for AIX when long double is 8 bytes.

Reviewed By: cebowleratibm

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

2 years ago[NFCI][TLI] prepare[US]REMEqFold(): don't add nonsensical 'exact' flag to rotates...
Roman Lebedev [Thu, 22 Jul 2021 19:59:22 +0000 (22:59 +0300)]
[NFCI][TLI] prepare[US]REMEqFold(): don't add nonsensical 'exact' flag to rotates created

As pointed out by Craig Topper.

2 years ago[ms] [llvm-ml] Fix macro case-insensitivity
Eric Astor [Thu, 22 Jul 2021 19:50:37 +0000 (15:50 -0400)]
[ms] [llvm-ml] Fix macro case-insensitivity

We previously had issues identifying macros not registered with a lowercase name.

Reviewed By: mstorsjo, thakis

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

2 years ago[AIX] Generate large code model relocations when mcmodel=medium on AIX
Anjan Kumar Guttahalli Krishna [Thu, 22 Jul 2021 04:20:11 +0000 (00:20 -0400)]
[AIX] Generate large code model relocations when mcmodel=medium on AIX

This patch makes the changes in the driver that converts the medium code
model to large.

Reviewed By: hubert.reinterpretcast

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

2 years agoFix TSAN signal interceptor out-of-bound access
Shu-Chun Weng [Wed, 21 Jul 2021 17:59:09 +0000 (10:59 -0700)]
Fix TSAN signal interceptor out-of-bound access

signal(2) and sigaction(2) have defined behaviors for invalid signal number
(EINVAL) and some programs rely on it.

The added test case also reveals that MSAN is too strict in this regard.

Test case passed on x86_64 Linux and AArch64 Linux.

Reviewed By: vitalybuka

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

2 years ago[LICM][SCCP] Regenerate test checks (NFC)
Nikita Popov [Thu, 22 Jul 2021 19:06:39 +0000 (21:06 +0200)]
[LICM][SCCP] Regenerate test checks (NFC)

2 years ago[AIX] Clang's library integration support for 128-bit long double is incomplete on...
Anjan Kumar Guttahalli Krishna [Thu, 22 Jul 2021 19:32:06 +0000 (15:32 -0400)]
[AIX] Clang's library integration support for 128-bit long double is incomplete on AIX.

Emit the unsupported option error until the Clang's library integration support for 128-bit long double is available for AIX.

Reviewed By: Whitney, cebowleratibm

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

2 years ago[mlir] Update to use ValueShapeRange (NFC)
Jacques Pienaar [Thu, 22 Jul 2021 19:24:48 +0000 (12:24 -0700)]
[mlir] Update to use ValueShapeRange (NFC)

Update to use alias in preparation for changing it to not just be a pure alias.

2 years ago[libomptarget][amdgpu][nfc] Normalise license headers
Jon Chesterfield [Thu, 22 Jul 2021 19:22:49 +0000 (20:22 +0100)]
[libomptarget][amdgpu][nfc] Normalise license headers

Reviewed By: gregrodgers, jdoerfert

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

2 years ago[SimplifyCFG] FoldTwoEntryPHINode(): bailout on inverted logical and/or (PR51149)
Roman Lebedev [Thu, 22 Jul 2021 19:11:46 +0000 (22:11 +0300)]
[SimplifyCFG] FoldTwoEntryPHINode(): bailout on inverted logical and/or (PR51149)

The logical (select) form of and/or will now be a source of problems.
We don't really account for it's inverted form, yet it exists,
and presumably we should treat it just like non-inverted form:
https://alive2.llvm.org/ce/z/BU9AXk

https://bugs.llvm.org/show_bug.cgi?id=51149 reports a reportedly-serious
perf regression that will hopefully be mitigated by this.

2 years ago[NFC][SimplifyCFG] Add some more tests w/ two-entry PHI nodes and
Roman Lebedev [Thu, 22 Jul 2021 19:07:23 +0000 (22:07 +0300)]
[NFC][SimplifyCFG] Add some more tests w/ two-entry PHI nodes and

2 years ago[clang-tidy] performance-unnecessary-copy-initialization: Disable check when variable...
Felix Berger [Wed, 14 Jul 2021 20:11:55 +0000 (16:11 -0400)]
[clang-tidy] performance-unnecessary-copy-initialization: Disable check when variable and initializer have different replaced template param types.

This can happen when a template with two parameter types is instantiated with a
single type. The fix would only be valid for this instantiation but fail for
others that rely on an implicit type conversion.

The test cases illustrate when the check should trigger and when not.

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

2 years ago[nfc] Fix typo in comment, s/node/note
Jon Chesterfield [Thu, 22 Jul 2021 19:16:53 +0000 (20:16 +0100)]
[nfc] Fix typo in comment, s/node/note

2 years ago[CostModel][X86] Adjust shift SSE4 legalized costs based on llvm-mca reports.
Simon Pilgrim [Thu, 22 Jul 2021 19:07:18 +0000 (20:07 +0100)]
[CostModel][X86] Adjust shift SSE4 legalized costs based on llvm-mca reports.

Update shl/lshr/ashr costs based on the worst case costs from the script in D103695 - many of the 128-bit shifts (usually where integer multiplies aren't used) have similar behaviour to AVX1 so we can merge them.

2 years ago[CostModel][X86] Fix funnel shift check prefixes
Simon Pilgrim [Thu, 22 Jul 2021 19:00:05 +0000 (20:00 +0100)]
[CostModel][X86] Fix funnel shift check prefixes

We'd lost AVX1 test coverage due to bulldozer (XOP) trying to use the same check prefixes - we really need to fix the update script to avoid this!

2 years ago[libomptarget][amdgpu][nfc] Replace use of gelf.h with libelf.h
Jon Chesterfield [Thu, 22 Jul 2021 19:04:13 +0000 (20:04 +0100)]
[libomptarget][amdgpu][nfc] Replace use of gelf.h with libelf.h

AMDGPU can assume Elf64 so doesn't need to abstract over Elf32

Drop a few other unused headers at the same time. Now only llvm elf
and libelf are used by the plugin.

Reviewed By: jdoerfert

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

2 years agoCorrectly diagnose taking the address of a register variable in C
Aaron Ballman [Thu, 22 Jul 2021 18:49:21 +0000 (14:49 -0400)]
Correctly diagnose taking the address of a register variable in C

We caught the cases where the user would explicitly use the & operator,
but we were missing implicit conversions such as array decay.

Fixes PR26336. Thanks to Samuel Neves for inspiration for the patch.

2 years ago[gn build] Port 3959c95deb11
LLVM GN Syncbot [Thu, 22 Jul 2021 18:41:45 +0000 (18:41 +0000)]
[gn build] Port 3959c95deb11

2 years ago[X86] Fix SLM FP<->INT throughputs.
Simon Pilgrim [Thu, 22 Jul 2021 18:26:07 +0000 (19:26 +0100)]
[X86] Fix SLM FP<->INT throughputs.

Noticed while trying to clean up the shift costs model for SSE4 targets using the script in D10369 - SLM double-pumps all the 128-bit vector conversion ops and only use FP0 pipe - numbers taken from Intel AOM + Agner.

2 years ago[ARC] Add disassembly for the conditioned RSUB immediate instruction
Thomas Johnson [Thu, 22 Jul 2021 18:15:24 +0000 (11:15 -0700)]
[ARC] Add disassembly for the conditioned RSUB immediate instruction

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