platform/upstream/llvm.git
3 years agoRevert "Add indented raw_ostream class"
Jacques Pienaar [Sat, 3 Oct 2020 16:41:35 +0000 (09:41 -0700)]
Revert "Add indented raw_ostream class"

This reverts commit 78530ce65375fa02bc96019e5cc9d73db8adaca4.

Fails on shared_lib build.

3 years ago[InstCombine] Add or(shl(v,and(x,bw-1)),lshr(v,bw-and(x,bw-1))) rotate tests
Simon Pilgrim [Sat, 3 Oct 2020 16:10:44 +0000 (17:10 +0100)]
[InstCombine] Add or(shl(v,and(x,bw-1)),lshr(v,bw-and(x,bw-1))) rotate tests

If we know the shift amount is less than the bitwidth we should be able to convert this to a rotate/funnel shift

3 years agoAdd indented raw_ostream class
Jacques Pienaar [Sat, 3 Oct 2020 15:53:43 +0000 (08:53 -0700)]
Add indented raw_ostream class

Class simplifies keeping track of the indentation while emitting. For every new line the current indentation is simply prefixed (if not at start of line, then it just emits as normal). Add a simple Region helper that makes it easy to have the C++ scope match the emitted scope.

Use this in op doc generator and rewrite generator.

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

3 years ago[ARM] Fix pointer offset when splitting stores from VMOVDRR
David Green [Sat, 3 Oct 2020 15:47:50 +0000 (16:47 +0100)]
[ARM] Fix pointer offset when splitting stores from VMOVDRR

We were not accounting for the pointer offset when splitting a store from
a VMOVDRR node, which could lead to incorrect aliasing info. In this
case it is the fneg via integer arithmetic that gives us a store->load
pair that we started getting wrong.

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

3 years ago[InstCombine] recognizeBSwapOrBitReverseIdiom - add vector support
Simon Pilgrim [Sat, 3 Oct 2020 15:26:29 +0000 (16:26 +0100)]
[InstCombine] recognizeBSwapOrBitReverseIdiom - add vector support

Add basic vector handling to recognizeBSwapOrBitReverseIdiom/collectBitParts - this works at the element level, all vector element operations must match (splat constants etc.) and there is no cross-element support (insert/extract/shuffle etc.).

3 years agoAdd a break statement to appease the build bots; NFC
Aaron Ballman [Sat, 3 Oct 2020 15:10:26 +0000 (11:10 -0400)]
Add a break statement to appease the build bots; NFC

3 years ago[InstCombine] recognizeBSwapOrBitReverseIdiom - use generic CreateIntegerCast
Simon Pilgrim [Sat, 3 Oct 2020 14:29:05 +0000 (15:29 +0100)]
[InstCombine] recognizeBSwapOrBitReverseIdiom - use generic CreateIntegerCast

Try to appease buildbots breakages due to D88578

3 years ago[flang][NFC] Fix build errors for clang-10
Andrzej Warzynski [Fri, 2 Oct 2020 08:53:35 +0000 (09:53 +0100)]
[flang][NFC] Fix build errors for clang-10

This patch fixes one worning. Since Flang sets `-Werror`, that's
sufficient for a build to fail. As per flang/README.md, Clang-10 is one
of the officially supported compilers.

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

3 years agomodernize-use-trailing-return-type fix for PR44206
Bernhard Manfred Gruber [Sat, 3 Oct 2020 14:08:44 +0000 (10:08 -0400)]
modernize-use-trailing-return-type fix for PR44206

Prevent rewrite when an unqualified id in a typedef type collides
with a function argument name. Fixes PR44206.

3 years ago[InstCombine] recognizeBSwapOrBitReverseIdiom - support for 'partial' bswap patterns...
Simon Pilgrim [Sat, 3 Oct 2020 13:52:25 +0000 (14:52 +0100)]
[InstCombine] recognizeBSwapOrBitReverseIdiom - support for 'partial' bswap patterns (PR47191) (Reapplied)

If we're bswap'ing some bytes and zero'ing the remainder we can perform this as a bswap+mask which helps us match 'partial' bswaps as a first step towards folding into a more complex bswap pattern.

Reapplied with early-out if recognizeBSwapOrBitReverseIdiom collects a source wider than the result type.

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

3 years ago[NFCI][clang-tidy] FunctionCognitiveComplexityCheck::check(): try to fix windows...
Roman Lebedev [Sat, 3 Oct 2020 13:01:48 +0000 (16:01 +0300)]
[NFCI][clang-tidy] FunctionCognitiveComplexityCheck::check(): try to fix windows arm build bots

http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/1482/steps/build-llvm-project/logs/stdio
http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/3285/steps/build-llvm-project/logs/stdio

3 years ago[Sema] List conversion validate character array.
Mark de Wever [Sat, 3 Oct 2020 12:31:46 +0000 (14:31 +0200)]
[Sema] List conversion validate character array.

The function `TryListConversion` didn't properly validate the following
part of the standard:

    Otherwise, if the parameter type is a character array [... ]
    and the initializer list has a single element that is an
    appropriately-typed string literal (8.5.2 [dcl.init.string]), the
    implicit conversion sequence is the identity conversion.

This caused the following call to `f()` to be ambiguous.
    void f(int(&&)[1]);
    void f(unsigned(&&)[1]);

    void g(unsigned i) {
      f({i});
    }

This issue only occurs when the initializer list had one element.

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

3 years ago[ARM] Test to show incorrect pointer info. NFC
David Green [Sat, 3 Oct 2020 11:25:34 +0000 (12:25 +0100)]
[ARM] Test to show incorrect pointer info. NFC

3 years ago[MemCpyOpt] Make moveUp() a member method (NFC)
Nikita Popov [Sat, 3 Oct 2020 09:27:33 +0000 (11:27 +0200)]
[MemCpyOpt] Make moveUp() a member method (NFC)

So we don't have to pass through more parameters in the future.

3 years ago[MemCpyOpt] Remove unnecessary -dse from test (NFC)
Nikita Popov [Sat, 3 Oct 2020 08:37:36 +0000 (10:37 +0200)]
[MemCpyOpt] Remove unnecessary -dse from test (NFC)

This one doesn't even have any dead stores to eliminate...

3 years ago[X86] Key Locker instructions should use VR128 regclass not VR128X.
Craig Topper [Sat, 3 Oct 2020 02:10:29 +0000 (19:10 -0700)]
[X86] Key Locker instructions should use VR128 regclass not VR128X.

3 years ago[PATCH] Fix typo (NFC)
Evandro Menezes [Fri, 2 Oct 2020 21:30:39 +0000 (16:30 -0500)]
[PATCH] Fix typo (NFC)

3 years ago[Driver] Move detectLibcxxIncludePath to ToolChain
Petr Hosek [Tue, 22 Sep 2020 08:01:16 +0000 (01:01 -0700)]
[Driver] Move detectLibcxxIncludePath to ToolChain

This helper method is useful even outside of Gnu toolchains, so move
it to ToolChain so it can be reused in other toolchains such as Fuchsia.

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

3 years ago[X86] Move MWAITX_DAG ISD opcode so it is not in the strict FP range.
Craig Topper [Sat, 3 Oct 2020 01:19:51 +0000 (18:19 -0700)]
[X86] Move MWAITX_DAG ISD opcode so it is not in the strict FP range.

Add a comment to hopefully prevent anyone else from making the
same mistake.

3 years ago[X86] Add missing intrinsic test for aesdecwide128kl and aesdecwide256kl. Capture...
Craig Topper [Sat, 3 Oct 2020 00:06:05 +0000 (17:06 -0700)]
[X86] Add missing intrinsic test for aesdecwide128kl and aesdecwide256kl. Capture all output values in keylocker tests. NFC

The aesdec/enc instructions produce a flag output and one or eight
xmm regsiter outputs. The test were not capturing the xmm outputs.

Also add nounwind to tests to remove .cfi directives

3 years agoRevert "[lsan] Share platform allocator settings between ASan and LSan"
Roland McGrath [Sat, 3 Oct 2020 01:12:57 +0000 (18:12 -0700)]
Revert "[lsan] Share platform allocator settings between ASan and LSan"

This reverts commit 1c897e9d72979730f7555e77dd54fe892a461637.

It broke builds for 32-bit targets.

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

3 years ago[lsan] Share platform allocator settings between ASan and LSan
Roland McGrath [Wed, 23 Sep 2020 01:27:03 +0000 (18:27 -0700)]
[lsan] Share platform allocator settings between ASan and LSan

This moves the platform-specific parameter logic from asan into
lsan_common.h to lsan can share it.

Reviewed By: vitalybuka

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

3 years agoFix the test case in D88686
Jianzhou Zhao [Sat, 3 Oct 2020 00:21:58 +0000 (00:21 +0000)]
Fix the test case in D88686

Adjusted when to check RSS.

3 years ago[Sparc] Remove cast that truncates immediate operands to 32 bits.
Brad Smith [Sat, 3 Oct 2020 00:05:09 +0000 (20:05 -0400)]
[Sparc] Remove cast that truncates immediate operands to 32 bits.

Patch by: Mark Kettenis

Test provided by Jessica Clarke.

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

3 years ago[CMake] Don't use CMakePushCheckState
Petr Hosek [Fri, 2 Oct 2020 21:16:27 +0000 (14:16 -0700)]
[CMake] Don't use CMakePushCheckState

When we call cmake_pop_check_state, we undo any changes to REQUIRED
variables performed by HandleLLVMOptions which is undesirable. Rather
use replacement which is what we've used prior to 8d26760a.

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

3 years ago[gn build] Port ace644030e6
LLVM GN Syncbot [Fri, 2 Oct 2020 23:59:59 +0000 (23:59 +0000)]
[gn build] Port ace644030e6

3 years agoRevert "[Driver] Move detectLibcxxIncludePath to ToolChain"
Petr Hosek [Fri, 2 Oct 2020 23:59:28 +0000 (16:59 -0700)]
Revert "[Driver] Move detectLibcxxIncludePath to ToolChain"

This reverts commit a594fd28e373cb7cd348cf01f6a90e055bf6cf6d which
is failign on some bots.

3 years agoDiagnose invalid target ID for AMDGPU toolchain for assembler
Yaxun (Sam) Liu [Wed, 30 Sep 2020 00:23:03 +0000 (20:23 -0400)]
Diagnose invalid target ID for AMDGPU toolchain for assembler

AMDGPU toolchain currently only diagnose invalid target ID for OpenCL
source compilation. Invalid target ID is not diagnosed for assembler.

This patch fixes that.

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

3 years ago[fuzzer] Remove unused variable
Julian Lettner [Fri, 2 Oct 2020 23:18:15 +0000 (16:18 -0700)]
[fuzzer] Remove unused variable

`TempAutoDictionary` is never used.  Maybe a leftover of a previous
experiment?

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

3 years ago[CUDA][HIP] Fix bound arch for offload action for fat binary
Yaxun (Sam) Liu [Wed, 30 Sep 2020 00:16:32 +0000 (20:16 -0400)]
[CUDA][HIP] Fix bound arch for offload action for fat binary

Currently CUDA/HIP toolchain uses "unknown" as bound arch
for offload action for fat binary. This causes -mcpu or -march
with "unknown" added in HIPToolChain::TranslateArgs or
CUDAToolChain::TranslateArgs.

This causes issue for https://reviews.llvm.org/D88377 since
HIP toolchain needs to check -mcpu in HIPToolChain::TranslateArgs.

The bound arch of offload action for fat binary is not really
used, therefore set it to CudaArch::UNUSED.

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

3 years agoFix the test case from D88686
Jianzhou Zhao [Fri, 2 Oct 2020 22:58:30 +0000 (22:58 +0000)]
Fix the test case from D88686

It seems that one buildnot RSS value is much higher after munmap than
local run.

3 years ago[MetaRenamer][NewPM] Port metarenamer to NPM
Arthur Eubanks [Thu, 1 Oct 2020 18:49:45 +0000 (11:49 -0700)]
[MetaRenamer][NewPM] Port metarenamer to NPM

Reviewed By: asbirlea

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

3 years ago[test][Coro][NewPM] Fix coro-elide.ll under NPM
Arthur Eubanks [Fri, 2 Oct 2020 22:39:15 +0000 (15:39 -0700)]
[test][Coro][NewPM] Fix coro-elide.ll under NPM

3 years agoDon't reject calls to MinGW's unusual _setjmp declaration.
Richard Smith [Fri, 2 Oct 2020 20:34:46 +0000 (13:34 -0700)]
Don't reject calls to MinGW's unusual _setjmp declaration.

We now recognize this function as a builtin despite it having an
unexpected number of parameters; make sure we don't enforce that it has
only 1 argument for its 2 parameters.

3 years ago[HIP] Align device binary
Yaxun (Sam) Liu [Fri, 25 Sep 2020 16:34:38 +0000 (12:34 -0400)]
[HIP] Align device binary

To facilitate faster loading of device binaries and share them among processes,
HIP runtime favors their alignment being 4096 bytes. HIP runtime can load
unaligned device binaries, however, aligning them at 4096 bytes results in
faster loading and less shared memory usage.

This patch adds an option -bundle-align to clang-offload-bundler which allows
bundles to be aligned at specified alignment. By default it is 1, which is NFC
compared to existing format.

This patch then aligns embedded fat binary and device binary inside fat binary
at 4096 bytes.

It has been verified this change does not cause significant overall file size increase
for typical HIP applications (less than 1%).

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

3 years ago[libc++] Fix the build with GCC < 10
Louis Dionne [Fri, 2 Oct 2020 21:30:42 +0000 (17:30 -0400)]
[libc++] Fix the build with GCC < 10

For now, we still need to support older GCCs, so work around the lack of
__is_constructible on older GCCs.

3 years ago[NFC][MSAN] Extract llvm.abs handling into a function
Vitaly Buka [Tue, 29 Sep 2020 21:55:46 +0000 (14:55 -0700)]
[NFC][MSAN] Extract llvm.abs handling into a function

Reviewed By: eugenis

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

3 years ago[clang] Implement objc_non_runtime_protocol to remove protocol metadata
Nathan Lanza [Thu, 27 Feb 2020 23:57:44 +0000 (15:57 -0800)]
[clang] Implement objc_non_runtime_protocol to remove protocol metadata

Summary:
Motivated by the new objc_direct attribute, this change adds a new
attribute that remotes metadata from Protocols that the programmer knows
isn't going to be used at runtime. We simply have the frontend skip
generating any protocol metadata entries (e.g. OBJC_CLASS_NAME,
_OBJC_$_PROTOCOL_INSTANCE_METHDOS, _OBJC_PROTOCOL, etc) for a protocol
marked with `__attribute__((objc_non_runtime_protocol))`.

There are a few APIs used to retrieve a protocol at runtime.
`@protocol(SomeProtocol)` will now error out of the requested protocol
is marked with attribute. `objc_getProtocol` will return `NULL` which
is consistent with the behavior of a non-existing protocol.

Subscribers: cfe-commits

Tags: #clang

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

3 years ago[clang-tidy] Implement readability-function-cognitive-complexity check
Roman Lebedev [Thu, 17 Aug 2017 15:57:00 +0000 (18:57 +0300)]
[clang-tidy] Implement readability-function-cognitive-complexity check

Currently, there is basically just one clang-tidy check to impose
some sanity limits on functions - `clang-tidy-readability-function-size`.
It is nice, allows to limit line count, total number of statements,
number of branches, number of function parameters (not counting
implicit `this`), nesting level.

However, those are simple generic metrics. It is still trivially possible
to write a function, which does not violate any of these metrics,
yet is still rather unreadable.

Thus, some additional, slightly more complicated metric is needed.
There is a well-known [[ https://en.wikipedia.org/wiki/Cyclomatic_complexity | Cyclomatic complexity]], but certainly has its downsides.
And there is a [[ https://www.sonarsource.com/docs/CognitiveComplexity.pdf | COGNITIVE COMPLEXITY by SonarSource ]], which is available for opensource on https://sonarcloud.io/.

This check checks function Cognitive Complexity metric, and flags
the functions with Cognitive Complexity exceeding the configured limit.
The default limit is `25`, same as in 'upstream'.

The metric is implemented as per [[ https://www.sonarsource.com/docs/CognitiveComplexity.pdf | COGNITIVE COMPLEXITY by SonarSource ]] specification version 1.2 (19 April 2017), with two notable exceptions:
   * `preprocessor conditionals` (`#ifdef`, `#if`, `#elif`, `#else`,
     `#endif`) are not accounted for.
      Could be done. Currently, upstream does not account for them either.
   * `each method in a recursion cycle` is not accounted for.
      It can't be fully implemented, because cross-translational-unit
      analysis would be needed, which is not possible in clang-tidy.
      Thus, at least right now, i completely avoided implementing it.

There are some further possible improvements:
* Are GNU statement expressions (`BinaryConditionalOperator`) really free?
  They should probably cause nesting level increase,
  and complexity level increase when they are nested within eachother.
* Microsoft SEH support
* ???

Reviewed By: aaron.ballman, JonasToth, lattner

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

3 years ago[Driver] Move detectLibcxxIncludePath to ToolChain
Petr Hosek [Tue, 22 Sep 2020 08:01:16 +0000 (01:01 -0700)]
[Driver] Move detectLibcxxIncludePath to ToolChain

This helper method is useful even outside of Gnu toolchains, so move
it to ToolChain so it can be reused in other toolchains such as Fuchsia.

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

3 years ago[libc++] Allow retries on some slightly flaky mutex tests
Louis Dionne [Fri, 2 Oct 2020 20:44:43 +0000 (16:44 -0400)]
[libc++] Allow retries on some slightly flaky mutex tests

3 years ago[Hexagon] Move selection of HVX multiply from lowering to patterns
Krzysztof Parzyszek [Thu, 1 Oct 2020 16:01:07 +0000 (11:01 -0500)]
[Hexagon] Move selection of HVX multiply from lowering to patterns

Also, change i32*i32 to V6_vmpyieoh + V6_vmpyiewuh_acc, which works
on V60 as well.

3 years ago[llvm-objcopy][NFC] refactor error handling. part 3.
Alexey Lapshin [Sat, 19 Sep 2020 15:53:44 +0000 (18:53 +0300)]
[llvm-objcopy][NFC] refactor error handling. part 3.

Remove usages of special error reporting functions(error(),
reportError()). Errors are reported as Expected<>/Error returning
values. This part is for ELF subfolder of llvm-objcopy.

Testing: check-all.

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

3 years agoRelease the shadow memory used by the mmap range at munmap
Jianzhou Zhao [Thu, 1 Oct 2020 18:05:34 +0000 (18:05 +0000)]
Release the shadow memory used by the mmap range at munmap

When an application does a lot of pairs of mmap and munmap, if we did
not release shadoe memory used by mmap addresses, this would increase
memory usage.

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D88686

3 years ago[flang][NFC] Fix mis-matched struct/class declarations
Tim Keith [Fri, 2 Oct 2020 20:08:49 +0000 (13:08 -0700)]
[flang][NFC] Fix mis-matched struct/class declarations

The template `ListDirectedStatementState` was declared as a struct and then as a class.
Fix it so they match.

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

3 years ago[lldb] Add a "design" section to the documentation.
Jonas Devlieghere [Fri, 2 Oct 2020 19:56:38 +0000 (12:56 -0700)]
[lldb] Add a "design" section to the documentation.

Create a "Design" section for the LLDB documentation. The goal is to
have design documents that describe how the LLDB internals work.

Currently similar pages  are mixed together under the "Development". The
existing pages describing the architecture, the reproducers, the
structured data plugins, and the SB API could be housed here. I hope
we'd see more pages being added here in the future.

Differential revision: https://reviews.llvm.org/D88516

3 years ago[MemCpyOpt] Add helper to erase instructions (NFC)
Nikita Popov [Fri, 2 Oct 2020 18:42:22 +0000 (20:42 +0200)]
[MemCpyOpt] Add helper to erase instructions (NFC)

Next to erasing the instruction, we also always want to remove
it from MSSA and MD. Use a common function to do so.

This is a refactoring split out from D26739.

3 years ago[MemCpyOpt] Avoid double invalidation (NFCI)
Nikita Popov [Fri, 2 Oct 2020 19:47:03 +0000 (21:47 +0200)]
[MemCpyOpt] Avoid double invalidation (NFCI)

The removal of the cpy instruction is left to the caller of
performCallSlotOptzn(), including the invalidation of MD. Both
call-sites already do this.

Also handle incrementation of NumMemCpyInstr consistently at the
call-site. One of the call-site was already doing this, which
ended up incrementing the statistic twice.

This fix was part of D26739.

3 years agoRelax newly added opcode alias check to check only for a number instead of a specific...
Douglas Yung [Fri, 2 Oct 2020 19:13:51 +0000 (12:13 -0700)]
Relax newly added opcode alias check to check only for a number instead of a specific opcode.

3 years ago[MLIR][SPIRV] Add initial support for OpSpecConstantComposite.
ergawy [Fri, 2 Oct 2020 18:56:17 +0000 (14:56 -0400)]
[MLIR][SPIRV] Add initial support for OpSpecConstantComposite.

This commit adds support to SPIR-V's composite specialization constants.
These are specialization constants which are composed of other spec
constants (whehter scalar or composite), regular constatns, or undef
values.

This commit adds support for parsing, printing, verification, and
(De)serialization.

A few TODOs are still in order:
- Supporting more types of constituents; currently, only scalar spec constatns are supported.
- Extending `spv._reference_of` to support composite spec constatns.

Reviewed By: antiagainst

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

3 years ago[libc++] NFCI: Remove the _LIBCPP_DEBUG_MODE helper macro
Louis Dionne [Fri, 2 Oct 2020 19:07:40 +0000 (15:07 -0400)]
[libc++] NFCI: Remove the _LIBCPP_DEBUG_MODE helper macro

It was used inconsistently and the name was pretty confusing, so we might
as well use `#if _LIBCPP_DEBUG_LEVEL == 2` consistently everywhere.

3 years ago[libc++] NFCI: Simplify macro definitions for the debug mode
Louis Dionne [Fri, 2 Oct 2020 19:02:52 +0000 (15:02 -0400)]
[libc++] NFCI: Simplify macro definitions for the debug mode

The debug mode always had three possibilities:
- _LIBCPP_DEBUG is undefined => no assertions
- _LIBCPP_DEBUG == 0         => some assertions
- _LIBCPP_DEBUG == 1         => some assertions + iterator checks

This was documented that way, however the code did not make this clear
at all. The discrepancy between _LIBCPP_DEBUG and _LIBCPP_DEBUG_LEVEL
was especially confusing. I reworked how the various macros are defined
without changing anything else to make the code clearer.

3 years ago[docs] Update ControlFlowIntegrity.rst.
Evgenii Stepanov [Tue, 15 Sep 2020 19:49:18 +0000 (12:49 -0700)]
[docs] Update ControlFlowIntegrity.rst.

Expand the list of targets that support cfi-icall.
Add ThinLTO everywhere LTO is mentioned. AFAIK all CFI features are
supported with ThinLTO.

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

3 years ago[llc] Initialize TargetOptions after Triple is available
Fangrui Song [Fri, 2 Oct 2020 18:43:17 +0000 (11:43 -0700)]
[llc] Initialize TargetOptions after Triple is available

Some targets have different defaults. This patch defers initialization of `TargetOptions` so that a future patch can pass `TargetOptions` to `InitTargetOptionsFromCodeGenFlags`

Reviewed By: jasonliu

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

3 years agoUpdate legalizer-info-validation.mir test to test all opcodes.
Amara Emerson [Fri, 2 Oct 2020 18:26:22 +0000 (11:26 -0700)]
Update legalizer-info-validation.mir test to test all opcodes.

The test doesn't fail if we add opcodes to the end of the opcodes definition
list, so we were missing some.

3 years ago[libc++] NFCI: Remove _LIBCPP_EXTERN_TEMPLATE2
Louis Dionne [Fri, 2 Oct 2020 18:29:48 +0000 (14:29 -0400)]
[libc++] NFCI: Remove _LIBCPP_EXTERN_TEMPLATE2

This seems to have been added a long time ago as a temporary help
for debugging some <regex> issue, but it's really the same as
_LIBCPP_EXTERN_TEMPLATE.

3 years ago[MemCpyOpt] Add tests from D40802 (NFC)
Nikita Popov [Fri, 2 Oct 2020 17:16:37 +0000 (19:16 +0200)]
[MemCpyOpt] Add tests from D40802 (NFC)

Even though that patch didn't stick, we should retain the test
coverage.

3 years ago[DAE] MarkLive in MarkValue(MaybeLive) if any use is live
Arthur Eubanks [Wed, 30 Sep 2020 05:29:26 +0000 (22:29 -0700)]
[DAE] MarkLive in MarkValue(MaybeLive) if any use is live

While looping through all args or all return values, we may mark a use
of a later iteration as live. Previously when we got to that later value
it would ignore that and continue adding to Uses instead of marking it
live. For example, when looping through arg#0 and arg#1,
MarkValue(arg#0, Live) may cause some use of arg#1 to be live, but
MarkValue(arg#1, MaybeLive) will not notice that and continue adding
into Uses.

Now MarkValue(RA, MaybeLive) will MarkLive(RA) if any use is live.

Fixes PR47444.

Reviewed By: rnk

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

3 years agoscudo: Simplify AtomicOptions::setFillContentsMode. NFCI.
Peter Collingbourne [Fri, 2 Oct 2020 17:20:31 +0000 (10:20 -0700)]
scudo: Simplify AtomicOptions::setFillContentsMode. NFCI.

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

3 years agoReland [AlwaysInliner] Update BFI when inlining
Arthur Eubanks [Fri, 25 Sep 2020 17:59:20 +0000 (10:59 -0700)]
Reland [AlwaysInliner] Update BFI when inlining

Reviewed By: davidxl

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

3 years ago[gn build] Don't define CINDEX_EXPORTS
Arthur Eubanks [Fri, 2 Oct 2020 17:31:56 +0000 (10:31 -0700)]
[gn build] Don't define CINDEX_EXPORTS

This causes
../../clang/include\clang-c/Platform.h(23,11): warning: 'CINDEX_EXPORTS' macro redefined [-Wmacro-redefined]
  #define CINDEX_EXPORTS

3 years agoRevert "[AlwaysInliner] Update BFI when inlining"
Arthur Eubanks [Fri, 2 Oct 2020 17:34:51 +0000 (10:34 -0700)]
Revert "[AlwaysInliner] Update BFI when inlining"

This reverts commit b1bf24667fc3ec5dc4b541148d0d722ffa28a6df.

3 years ago[AlwaysInliner] Update BFI when inlining
Arthur Eubanks [Fri, 25 Sep 2020 17:59:20 +0000 (10:59 -0700)]
[AlwaysInliner] Update BFI when inlining

Reviewed By: davidxl

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

3 years agoRevert rG3d14a1e982ad27 - "[InstCombine] recognizeBSwapOrBitReverseIdiom - support...
Simon Pilgrim [Fri, 2 Oct 2020 17:16:55 +0000 (18:16 +0100)]
Revert rG3d14a1e982ad27 - "[InstCombine] recognizeBSwapOrBitReverseIdiom - support for 'partial' bswap patterns (PR47191)"

This reverts commit 3d14a1e982ad27111346471564d575ad5efc6419.

This is breaking on some 2stage clang buildbots

3 years ago[mlir][vector] Add canonicalization patterns for extractMap/insertMap
Thomas Raoux [Fri, 2 Oct 2020 17:11:22 +0000 (10:11 -0700)]
[mlir][vector] Add canonicalization patterns for extractMap/insertMap

Add basic canonicalization patterns for the extractMap/insertMap to allow them
to be folded into Transfer ops.
Also mark transferRead as memory read so that it can be removed by dead code.

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

3 years ago[InstCombine] Add trunc(bswap(trunc/zext(x))) vector tests
Simon Pilgrim [Fri, 2 Oct 2020 17:04:56 +0000 (18:04 +0100)]
[InstCombine] Add trunc(bswap(trunc/zext(x))) vector tests

3 years ago[libc++] Remove unnecessary usage of <iostream> in the test suite
Louis Dionne [Mon, 21 Sep 2020 21:08:53 +0000 (17:08 -0400)]
[libc++] Remove unnecessary usage of <iostream> in the test suite

Tests should strive to be as minimal as possible, since it makes them
relevant on platforms where <iostream> does not work.

3 years ago[lldb] Fix bug in fallback logic for finding the resource directory.
Jonas Devlieghere [Fri, 2 Oct 2020 16:53:30 +0000 (09:53 -0700)]
[lldb] Fix bug in fallback logic for finding the resource directory.

Both of the if-clauses modify the raw_path variable and only one of them
was resetting the variable for the fallback. Avoid future bugs like that
by always resetting the variable.

Differential revision: https://reviews.llvm.org/D88704

3 years ago[VPlan] Use isa<> instead of directly checking VPRecipeID (NFC).
Florian Hahn [Fri, 2 Oct 2020 16:36:22 +0000 (17:36 +0100)]
[VPlan] Use isa<> instead of directly checking VPRecipeID (NFC).

getVPRecipeID is intended to be only used in `classof` helpers. Instead
of checking it directly, use isa<> with the correct recipe type.

3 years ago[MemCpyOpt] Regnerate test checks (NFC)
Nikita Popov [Thu, 1 Oct 2020 20:42:14 +0000 (22:42 +0200)]
[MemCpyOpt] Regnerate test checks (NFC)

3 years ago[mlir] Add Float Attribute, Integer Attribute and Bool Attribute subclasses to python...
zhanghb97 [Wed, 30 Sep 2020 06:11:46 +0000 (14:11 +0800)]
[mlir] Add Float Attribute, Integer Attribute and Bool Attribute subclasses to python bindings.

Based on PyAttribute and PyConcreteAttribute classes, this patch implements the bindings of Float Attribute, Integer Attribute and Bool Attribute subclasses.
This patch also defines the `mlirFloatAttrDoubleGetChecked` C API which is bound with the `FloatAttr.get_typed` python method.

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

3 years ago[MLIR] Better message for FuncOp type mismatch
Stephen Neuendorffer [Thu, 30 Jul 2020 21:47:42 +0000 (14:47 -0700)]
[MLIR] Better message for FuncOp type mismatch

Previously the actual types were not shown, which makes the message
difficult to grok in the context of long lowering chains.  Also, it
appears that there were no actual tests for this.

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

3 years ago[CostModel] move default handling after switch; NFC
Sanjay Patel [Fri, 2 Oct 2020 16:24:02 +0000 (12:24 -0400)]
[CostModel] move default handling after switch; NFC

We will need to add intrinsics to the switch (such as
the ones that are currently in the switch above this
one) that deal with special cases and then break to
the default handling.

3 years agoRevert "[WebAssembly] Emulate v128.const efficiently"
Stella Stamenova [Fri, 2 Oct 2020 16:26:21 +0000 (09:26 -0700)]
Revert "[WebAssembly] Emulate v128.const efficiently"

This reverts commit 542523a61a21c13e7f244bcf821b0fdeb8c6bb24.

3 years ago[InstCombine] recognizeBSwapOrBitReverseIdiom - support for 'partial' bswap patterns...
Simon Pilgrim [Fri, 2 Oct 2020 16:15:32 +0000 (17:15 +0100)]
[InstCombine] recognizeBSwapOrBitReverseIdiom - support for 'partial' bswap patterns (PR47191)

If we're bswap'ing some bytes and zero'ing the remainder we can perform this as a bswap+mask which helps us match 'partial' bswaps as a first step towards folding into a more complex bswap pattern.

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

3 years agoTruncInstCombine.cpp - fix header include ordering to fix llvm-include-order clang...
Simon Pilgrim [Fri, 2 Oct 2020 14:30:48 +0000 (15:30 +0100)]
TruncInstCombine.cpp - fix header include ordering to fix llvm-include-order clang-tidy warning. NFCI.

3 years agoTruncInstCombine.cpp - use auto * to fix llvm-qualified-auto clang-tidy warning....
Simon Pilgrim [Fri, 2 Oct 2020 14:29:21 +0000 (15:29 +0100)]
TruncInstCombine.cpp - use auto * to fix llvm-qualified-auto clang-tidy warning. NFCI.

3 years ago[AArch64] Generate dot for v16i8 sum reduction to i32
Vinay Madhusudan [Fri, 2 Oct 2020 16:11:02 +0000 (17:11 +0100)]
[AArch64] Generate dot for v16i8 sum reduction to i32

Convert VECREDUCE_ADD( EXTEND(v16i8_type) ) to VECREDUCE_ADD( DOTv16i8(v16i8_type) ) whenever the result type is i32. This gains in one of the SPECCPU 2017 benchmark.

This partially solves the bug: https://bugs.llvm.org/show_bug.cgi?id=46888
Meta ticket: https://bugs.llvm.org/show_bug.cgi?id=46929

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

3 years ago[clangd] Add bencmark for measuring latency of DecisionForest model.
Utkarsh Saxena [Wed, 30 Sep 2020 12:57:47 +0000 (14:57 +0200)]
[clangd] Add bencmark for measuring latency of DecisionForest model.

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

3 years ago[mlir] Fix call op conversion in bare-ptr calling convention
Diego Caballero [Fri, 2 Oct 2020 15:42:13 +0000 (08:42 -0700)]
[mlir] Fix call op conversion in bare-ptr calling convention

We hit an llvm_unreachable related to unranked memrefs for call ops
with scalar types. Removing the llvm_unreachable since the conversion
should gracefully bail out in the presence of unranked memrefs. Adding
tests to verify that.

Reviewed By: ftynse

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

3 years ago[mlir] Attempt to appease gcc-5 const char* -> StringLiteral conversion issu
Nicolas Vasilache [Fri, 2 Oct 2020 14:02:53 +0000 (10:02 -0400)]
[mlir] Attempt to appease gcc-5 const char* -> StringLiteral conversion issu

3 years agoFix interaction between stack alignment and inline-asm stack clash protection
serge-sans-paille [Thu, 23 Jul 2020 14:22:48 +0000 (16:22 +0200)]
Fix interaction between stack alignment and inline-asm stack clash protection

As reported in https://github.com/rust-lang/rust/issues/70143 alignment is not
taken into account when doing the probing. Fix that by adjusting the first probe
if the stack align is small, or by extending the dynamic probing if the
alignment is large.

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

3 years ago[Statepoints][ISEL] visitGCRelocate: chain to current DAG root.
Denis Antrushin [Thu, 1 Oct 2020 08:09:57 +0000 (15:09 +0700)]
[Statepoints][ISEL] visitGCRelocate: chain to current DAG root.

This is similar to D87251, but for CopyFromRegs nodes.
Even for local statepoint uses we generate CopyToRegs/CopyFromRegs
nodes.  When generating CopyFromRegs in visitGCRelocate, we must chain
to current DAG root, not EntryNode, to ensure proper ordering of copy
w.r.t. statepoint node producing result for it.

Reviewed By: reames

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

3 years agoFix failure in test hip-macros.hip
Yaxun (Sam) Liu [Fri, 2 Oct 2020 14:32:52 +0000 (10:32 -0400)]
Fix failure in test hip-macros.hip

requires amdgpu-registered-target.

3 years ago[compiler-rt] [netbsd] Improve the portability of ThreadSelfTlsTcb
Kamil Rytarowski [Fri, 2 Oct 2020 14:13:09 +0000 (16:13 +0200)]
[compiler-rt] [netbsd] Improve the portability of ThreadSelfTlsTcb

Use __lwp_gettcb_fast() and __lwp_getprivate_fast(), as _lwp_getprivate()
can be a biased pointer and invalid for use in this function on all CPUs.

3 years ago[gn build] Port 0c1bb4f8851
LLVM GN Syncbot [Fri, 2 Oct 2020 14:24:01 +0000 (14:24 +0000)]
[gn build] Port 0c1bb4f8851

3 years ago[TableGen] New backend to print detailed records.
Paul C. Anagnostopoulos [Tue, 22 Sep 2020 17:58:54 +0000 (13:58 -0400)]
[TableGen] New backend to print detailed records.
Pertinent lints are fixed.

3 years agoEmit predefined macro for wavefront size for amdgcn
Yaxun (Sam) Liu [Sun, 27 Sep 2020 02:28:04 +0000 (22:28 -0400)]
Emit predefined macro for wavefront size for amdgcn

Also fix the issue of multiple -m[no-]wavefrontsize64
options to make the last one wins.

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

3 years ago[clangd] Extend the rename API.
Haojian Wu [Fri, 2 Oct 2020 14:01:25 +0000 (16:01 +0200)]
[clangd] Extend the rename API.

several changes:
- return a structure result in rename API;
- prepareRename now returns more information (main-file occurrences);
- remove the duplicated detecting-touch-identifier code in prepareRename (which is implemented in rename API);

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

3 years ago[Analysis] Drop local maxAPInt/minAPInt helpers. NFCI.
Simon Pilgrim [Fri, 2 Oct 2020 13:55:53 +0000 (14:55 +0100)]
[Analysis] Drop local maxAPInt/minAPInt helpers. NFCI.

Use standard APIntOps::smax/smin helpers instead.

3 years ago[LLD] Fix /time formatting for very long runs. NFC.
Alexandre Ganea [Fri, 2 Oct 2020 13:53:43 +0000 (09:53 -0400)]
[LLD] Fix /time formatting for very long runs. NFC.

3 years ago[LLD][COFF] Add more type record information to /summary
Alexandre Ganea [Fri, 2 Oct 2020 13:36:11 +0000 (09:36 -0400)]
[LLD][COFF] Add more type record information to /summary

This adds the following two new lines to /summary:

      21351 Input OBJ files (expanded from all cmd-line inputs)
         61 PDB type server dependencies
         38 Precomp OBJ dependencies
 1420669231 Input type records         <<<<
78665073382 Input type records bytes   <<<<
    8801393 Merged TPI records
    3177158 Merged IPI records
      59194 Output PDB strings
   71576766 Global symbol records
   25416935 Module symbol records
    2103431 Public symbol records

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

3 years ago[libc++] Move the weak symbols list to libc++abi
Louis Dionne [Thu, 1 Oct 2020 00:05:41 +0000 (20:05 -0400)]
[libc++] Move the weak symbols list to libc++abi

Those symbols are exported from libc++abi in the first place, so it
makes more sense to have them there.

3 years agoBlockFrequencyInfoImpl.h - use const references to avoid FrequencyData copies. NFCI.
Simon Pilgrim [Fri, 2 Oct 2020 12:56:13 +0000 (13:56 +0100)]
BlockFrequencyInfoImpl.h - use const references to avoid FrequencyData copies. NFCI.

3 years agoLoopAccessAnalysis.cpp - use const reference in for-range loops. NFCI.
Simon Pilgrim [Fri, 2 Oct 2020 12:53:21 +0000 (13:53 +0100)]
LoopAccessAnalysis.cpp - use const reference in for-range loops. NFCI.

3 years ago[SLP] Add test where reduction result is used in PHI.
Florian Hahn [Fri, 2 Oct 2020 12:31:23 +0000 (13:31 +0100)]
[SLP] Add test where reduction result is used in PHI.

Test case for PR47670.

3 years ago[InstCombine] Add partial bswap vector test from D88578
Simon Pilgrim [Fri, 2 Oct 2020 12:19:02 +0000 (13:19 +0100)]
[InstCombine] Add partial bswap vector test from D88578

3 years ago[AArch64] Add CPU Cortex-R82
Sjoerd Meijer [Thu, 1 Oct 2020 14:47:31 +0000 (15:47 +0100)]
[AArch64] Add CPU Cortex-R82

This adds support for -mcpu=cortex-r82. Some more information about this
core can be found here:

https://www.arm.com/products/silicon-ip-cpu/cortex-r/cortex-r82

One note about the system register: that is a bit of a refactoring because of
small differences between v8.4-A AArch64 and v8-R AArch64.

This is based on patches from Mark Murray and Mikhail Maltsev.

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

3 years ago[clangd] Make PopulateSwitch a fix.
Sam McCall [Fri, 2 Oct 2020 10:18:31 +0000 (12:18 +0200)]
[clangd] Make PopulateSwitch a fix.

It fixes the -Wswitch warning, though we mark it as a fix even if that is off.
This makes it the "recommended" action on an incomplete switch, which seems OK.

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

3 years ago[PhaseOrdering] Add test that requires peeling before vectorization.
Florian Hahn [Tue, 29 Sep 2020 08:46:57 +0000 (09:46 +0100)]
[PhaseOrdering] Add test that requires peeling before vectorization.

Test case for PR47671.