platform/upstream/llvm.git
3 years ago[gn build] (manually) port 76a168bce01
Nico Weber [Mon, 2 Nov 2020 14:22:06 +0000 (09:22 -0500)]
[gn build] (manually) port 76a168bce01

3 years agoRevert "[llvm-exegesis] Save target state before running the benchmark."
Clement Courbet [Mon, 2 Nov 2020 14:10:41 +0000 (15:10 +0100)]
Revert "[llvm-exegesis] Save target state before running the benchmark."

_fxsave64 is not available on some buildbots.

This reverts commit 274de447fe9621082a523a7227157aeb84702a7d.

3 years ago[Flang][Driver] Add PrintPreprocessedInput FrontendAction (`flang-new -E`)
Caroline Concatto [Tue, 27 Oct 2020 12:26:47 +0000 (12:26 +0000)]
[Flang][Driver] Add PrintPreprocessedInput FrontendAction (`flang-new -E`)

This patch implements the first frontend action for the Flang parser (i.e.
Fortran::parser). This action runs the preprocessor and is invoked with the
`-E` flag. (i.e. `flang-new -E <input-file>). The generated output is printed
to either stdout or the output file (specified with `-` or `-o <output-file>`).

Note that currently there is no mechanism to map options for the
frontend driver (i.e. Fortran::frontend::FrontendOptions) to options for
the parser (i.e. Fortran::parser::Options). Instead,
Frotran::parser::options are hard-coded to:

```
std::vector<std::string> searchDirectories{"."s};
searchDirectories = searchDirectories;
isFixedForm = false;
_encoding(Fortran::parser::Encoding::UTF_8);
```

These default settings are compatible with the current Flang driver. Further
work is required in order for CompilerInvocation to read and map
clang::driver::options to Fortran::parser::options.

Co-authored-by: Andrzej Warzynski <andrzej.warzynski@arm.com>
Differential Revision: https://reviews.llvm.org/D88381

3 years ago[llvm-exegesis] Save target state before running the benchmark.
Clement Courbet [Mon, 2 Nov 2020 08:15:17 +0000 (09:15 +0100)]
[llvm-exegesis] Save target state before running the benchmark.

Some benchmarked instructions might set target state. Preserve this
state. See PR26418.

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

3 years agoRevert "Fix ds_read2/write2 unaligned offsets"
Jay Foad [Mon, 2 Nov 2020 14:01:33 +0000 (14:01 +0000)]
Revert "Fix ds_read2/write2 unaligned offsets"

This reverts commit 2e7e898c8f0b38dc11fbce2553fc715067aaf42f.

It was committed by mistake.

3 years agoFix ds_read2/write2 unaligned offsets
Jay Foad [Mon, 2 Nov 2020 13:05:15 +0000 (13:05 +0000)]
Fix ds_read2/write2 unaligned offsets

3 years ago[AMDGPU] Precommit ds_read2/write2 with unaligned offset tests. NFC.
Jay Foad [Mon, 2 Nov 2020 13:47:44 +0000 (13:47 +0000)]
[AMDGPU] Precommit ds_read2/write2 with unaligned offset tests. NFC.

3 years ago[AMDGPU] Generate test checks. NFC.
Jay Foad [Mon, 2 Nov 2020 12:50:16 +0000 (12:50 +0000)]
[AMDGPU] Generate test checks. NFC.

3 years ago[AMDGPU] Remove a comment. NFC.
Jay Foad [Mon, 2 Nov 2020 12:52:32 +0000 (12:52 +0000)]
[AMDGPU] Remove a comment. NFC.

This was obsoleted by f78687df9b7 which added gfx9 aligned/unaligned
tests.

3 years agoUse --use-color in run-clang-tidy.py
David Sanders [Mon, 2 Nov 2020 13:38:20 +0000 (08:38 -0500)]
Use --use-color in run-clang-tidy.py

Now that clang-tidy supports the --use-color command line option, it's
a better user experience to use --use-color in run-clang-tidy.py and
preserving the colored output.

3 years ago[libc++] NFC: Remove warning about non-void function returning void
Louis Dionne [Mon, 2 Nov 2020 13:25:16 +0000 (08:25 -0500)]
[libc++] NFC: Remove warning about non-void function returning void

3 years ago[LV][X86] Regenerate gather_scatter tests. NFCI.
Simon Pilgrim [Mon, 2 Nov 2020 11:57:37 +0000 (11:57 +0000)]
[LV][X86] Regenerate gather_scatter tests. NFCI.

Reduce diff in D90554

3 years ago[SLP][X86] Add AVX512VL test target coverage for PR47629
Simon Pilgrim [Mon, 2 Nov 2020 11:40:40 +0000 (11:40 +0000)]
[SLP][X86] Add AVX512VL test target coverage for PR47629

As suggested on D90445 - the AVX512F test case alone won't handle 128/256-bit vector gather pattern very well

3 years ago[RISCV] Avoid std::pair<> in FPReg StringSwitch to avoid MSVC compile failures. NFCI.
Simon Pilgrim [Mon, 2 Nov 2020 11:30:39 +0000 (11:30 +0000)]
[RISCV] Avoid std::pair<> in FPReg StringSwitch to avoid MSVC compile failures. NFCI.

As discussed on D90322, some MSVC builds are failing with is_trivially_copyable static asserts (see D86126) - we can avoid this by not using the std::pair<unsigned,unsigned> which held both the FP+DP Registers, just handle the FP register and convert to DP on the fly.

3 years ago[flang][driver] Rename the accessors/mutators (NFC)
Andrzej Warzynski [Wed, 28 Oct 2020 10:47:48 +0000 (10:47 +0000)]
[flang][driver] Rename the accessors/mutators (NFC)

As per point 3 in [1]:

```
Accessor member functions are named with the non-public data member's
name, less the trailing underscore.  Mutator member functions are named
set_...
```

Originally we just followed the LLVM's style, which is incompatible with
Flang. This patch renames the accessors and mutators accordingly.

`getDiagnostics` and `GetDiagnostics` are replaced with one accessor:
`diagnostics`. `SetDiagnostics` was neither implemented nor used, so
it's deleted.

[1] https://github.com/llvm/llvm-project/blob/master/flang/docs/C++style.md#naming

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

3 years ago[clangd] Value initialize SymbolIDs
Kadir Cetinkaya [Thu, 29 Oct 2020 15:04:53 +0000 (16:04 +0100)]
[clangd] Value initialize SymbolIDs

We were default initializing SymbolIDs before, which would leave
indeterminate values in underlying std::array.

This patch updates the underlying data initalization to be value-init and adds a
way to check for validness of a SymbolID.

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

3 years ago[flang][driver] Use --match-full-lines in tests for `-test-io`
Andrzej Warzynski [Mon, 2 Nov 2020 09:34:27 +0000 (09:34 +0000)]
[flang][driver] Use --match-full-lines in tests for `-test-io`

Use `--match-full-lines` to make sure that FileCheck doesn't match the
output against the `CHECK` lines (which, like other comments, are also
printed).

More specifically, we want to make sure that the following `check` in the
input file:
```
! CHECK: <some-fortran-input>
```
is matched by FileCheck with `<some-fortran-input>` in the generated
output. Without `--match-full-lines`, that check-line will be matched
with `!CHECK:  <some-fortran-input>` instead (which is also
printed together with other contents of the file).

Adding `--match-full-lines` makes the tests stricter and this change
revealed that some `check`s were passing only because that flag was
missing. These are updated accordingly.

Reviewed By: CarolineConcatto, sameeranjoshi

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

3 years ago[clangd] Improve remote-index test
Kirill Bobyrev [Mon, 2 Nov 2020 09:55:17 +0000 (10:55 +0100)]
[clangd] Improve remote-index test

Introduce a separate thread that will kill `clangd-index-server` after 10 seconds regardless. This helps shut down the test if the server hangs and `stderr.readline()` does not contain inititalizatiton message. It prevents "necessary" waiting delay for the server warm-up and only introduces additional delay if the test fails.

It also makes use of `subprocess.Popen.kill()` which is a portable way of handling process shutdown and avoids using signals.

Reviewed By: kadircet

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

3 years ago[llvm-exegesis] Print signal name when the snippet crashed.
Clement Courbet [Fri, 30 Oct 2020 10:35:47 +0000 (11:35 +0100)]
[llvm-exegesis] Print signal name when the snippet crashed.

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

3 years ago[yaml2obj] - Add support of Offset for .strtab/.shstrtab/.dynstr sections.
Georgii Rymar [Fri, 30 Oct 2020 07:58:13 +0000 (10:58 +0300)]
[yaml2obj] - Add support of Offset for .strtab/.shstrtab/.dynstr sections.

These sections are implicit and handled a bit differently.
Currently the "Offset" is ignored for them.
This patch fixes an issue.

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

3 years agoRevert "[AArch64][AsmParser] Remove 'x31' alias for 'sp/xzr' register."
Caroline Concatto [Mon, 2 Nov 2020 08:15:50 +0000 (08:15 +0000)]
Revert "[AArch64][AsmParser] Remove 'x31' alias for 'sp/xzr' register."

This reverts commit 8b281bfaf35d00d42c2993fd5a80d749cc21f45e.

3 years ago[AArch64][AsmParser] Remove 'x31' alias for 'sp/xzr' register.
Caroline Concatto [Fri, 23 Oct 2020 09:37:08 +0000 (10:37 +0100)]
[AArch64][AsmParser] Remove 'x31' alias for 'sp/xzr' register.

Only the aliases 'xzr' and 'sp' exist for the physical register x31.
The reason for wanting to remove the alias 'x31' is because it allows users
to write invalid asm that is not accepted by the GNU assembler.

Is there any objection to removing this alias? Or do we want to keep
this for compatibility with existing code that uses w31/x31?

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

3 years ago[clangd] Add lit tests for remote index
Kirill Bobyrev [Mon, 2 Nov 2020 07:38:05 +0000 (08:38 +0100)]
[clangd] Add lit tests for remote index

Reviewed By: kadircet

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

3 years ago[clangd] Fix ParsedASTTest.TopLevelDecls test.
Ilya Golovenko [Mon, 2 Nov 2020 07:25:45 +0000 (08:25 +0100)]
[clangd] Fix ParsedASTTest.TopLevelDecls test.

Google test matcher `DeclKind` uses `NamedDecl::getDeclKindName()` to compare its result with expected declaration name.
Both, returned value of this function and the expected kind name argument have type `const char *`, so this matcher effectively
compares two pointers instead of the respective strings.

The test was passing on most platforms because compilers mostly were able to coalesce these string literals.

Patch By: Ilya Golovenko

Reviewed By: hokein

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

3 years ago[CodeGen][X86] Remove unused check-prefix in strict FP tests.
Wang, Pengfei [Mon, 2 Nov 2020 06:30:40 +0000 (14:30 +0800)]
[CodeGen][X86] Remove unused check-prefix in strict FP tests.

3 years ago[RISCV] Add a test case for another issue in SelectRORIW. NFC
Craig Topper [Mon, 2 Nov 2020 06:12:20 +0000 (22:12 -0800)]
[RISCV] Add a test case for another issue in SelectRORIW. NFC

When validating C3 in (sext_inreg (or (shl X, C2), (shr (and Y, C3), C1)), i32)
we are truncating it to 32 bits before checking its value. We need
to check all 64 bits.

3 years ago[PowerPC] Fix a crash in POWER 9 setb peephole
Qiu Chaofan [Mon, 2 Nov 2020 06:29:43 +0000 (14:29 +0800)]
[PowerPC] Fix a crash in POWER 9 setb peephole

Variable InnerIsSel references FalseRes, while FalseRes might be
zext/sext. So InnerIsSel should reference SetOrSelCC, otherwise a crash
will happen.

Reviewed By: steven.zhang

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

3 years ago[compiler-rt][NFC] Fix typo in comment
Jim Lin [Mon, 2 Nov 2020 02:58:07 +0000 (10:58 +0800)]
[compiler-rt][NFC] Fix typo in comment

3 years ago[RISCV] Add a test case to show a bug in SelectRORIW. NFC
Craig Topper [Mon, 2 Nov 2020 04:24:09 +0000 (20:24 -0800)]
[RISCV] Add a test case to show a bug in SelectRORIW. NFC

The function is matching (sext_inreg (or (shl X, C2), (shr (and Y, C3), C1))),
with appropriate checks for the constants to be a rotate. But it
fails to check that X and Y are the same which is also necessary.

3 years ago[RISCV] Add more rev32 and rev16 test cases using fshl/fshr intrinsics. NFC
Craig Topper [Sun, 1 Nov 2020 20:40:31 +0000 (12:40 -0800)]
[RISCV] Add more rev32 and rev16 test cases using fshl/fshr intrinsics. NFC

fshl/fshr intrinsics turn into rotl/rotr ISD opcodes and we don't
have a complete set of patterns.

We pattern match rotl, but we have a custom match for rori that gets
priority. We don't pattern match rotr and we don't have patterns
or custom code for rori from rotr.

3 years ago[CodeGen][X86] Remove unused check-prefix in adx tests.
Wang, Pengfei [Mon, 2 Nov 2020 03:38:46 +0000 (11:38 +0800)]
[CodeGen][X86] Remove unused check-prefix in adx tests.

Not needed after 226261353288e.

3 years agoNFC: Wrap lines in Python.md.
Stella Laurenzo [Mon, 2 Nov 2020 03:23:44 +0000 (19:23 -0800)]
NFC: Wrap lines in Python.md.

3 years ago[MemProf] Fix test failure on windows
Teresa Johnson [Mon, 2 Nov 2020 03:06:50 +0000 (19:06 -0800)]
[MemProf] Fix test failure on windows

Fix failure in new test from 0949f96dc6521be80ebb8ebc1e1c506165c22aac:
Don't match exact file path separator.

Should fix:
http://lab.llvm.org:8011/#/builders/119/builds/437/steps/9/logs/FAIL__Clang__memory-profile-filename_c

3 years ago[mlir][Python] Context managers for Context, InsertionPoint, Location.
Stella Laurenzo [Sun, 1 Nov 2020 06:40:25 +0000 (23:40 -0700)]
[mlir][Python] Context managers for Context, InsertionPoint, Location.

* Finishes support for Context, InsertionPoint and Location to be carried by the thread using context managers.
* Introduces type casters and utilities so that DefaultPyMlirContext and DefaultPyLocation in method signatures does the right thing (allows explicit or gets from the thread context).
* Extend the rules for the thread context stack to handle nesting, appropriately inheriting and clearing depending on whether the context is the same.
* Refactors all method signatures to follow the new convention on trailing parameters for defaulting parameters (loc, ip, context). When the objects are carried in the thread context, this allows most explicit uses of these values to be elided.
* Removes the style guide section on putting accessors to construct global objects on the PyMlirContext: this style fails to make good use of the new facility since it is often the only thing remaining needing an MlirContext.
* Moves Module parse/creation from mlir.ir.Context to static methods on mlir.ir.Module.
* Moves Context.create_operation to a static Operation.create method.
* Moves Type parsing from mlir.ir.Context to static methods on mlir.ir.Type.
* Moves Attribute parsing from mlir.ir.Context to static methods on mlir.ir.Attribute.
* Move Location factory methods from mlir.ir.Context to static methods on mlir.ir.Location.
* Refactors the std dialect fake "ODS" generated code to take advantage of the new scheme.

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

3 years ago[libcxx] Fix regression where `ninja all` doesn't copy libcxx headers
Nico Weber [Mon, 2 Nov 2020 02:34:51 +0000 (21:34 -0500)]
[libcxx] Fix regression where `ninja all` doesn't copy libcxx headers

Before 6db314e86b2674, when running cmake with clang, libcxx, and
compiler-rt enabled, building `ninja all` would run the
generate-cxx-headers target, due to the sanitizers depending on it.

After 6db314e86b2674, if LIBCXX_ENABLE_SHARED and LIBCXX_ENABLE_STATIC
and LIBCXX_INCLUDE_TESTS and LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY are
disabled (https://reviews.llvm.org/D82702#2153627), `ninja all`
no longer copies the libcxx headers, which means clang can't compile
programs like `#include <string>` on macOS.

Explicitly add the copy target to the all target to restore the old
behavior.

3 years ago[MachineSink] sink more profitable loads
Chen Zheng [Mon, 2 Nov 2020 01:55:05 +0000 (20:55 -0500)]
[MachineSink] sink more profitable loads

Reviewed By: qcolombet

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

3 years ago[Scheduling] Fall back to the fast cluster algorithm if the DAG is too complex
QingShan Zhang [Mon, 2 Nov 2020 02:06:14 +0000 (02:06 +0000)]
[Scheduling] Fall back to the fast cluster algorithm if the DAG is too complex

We have added a new load/store cluster algorithm in D85517. However, AArch64 see
some compiling deg with the new algorithm as the IsReachable() is not cheap if
the DAG is complex. O(M+N) See https://bugs.llvm.org/show_bug.cgi?id=47966
So, this patch added a heuristic to switch to old cluster algorithm if the DAG is too complex.

Reviewed By: Owen Anderson

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

3 years ago[MemProf] Pass down memory profile name with optional path from clang
Teresa Johnson [Tue, 29 Sep 2020 22:53:41 +0000 (15:53 -0700)]
[MemProf] Pass down memory profile name with optional path from clang

Similar to -fprofile-generate=, add -fmemory-profile= which takes a
directory path. This is passed down to LLVM via a new module flag
metadata. LLVM in turn provides this name to the runtime via the new
__memprof_profile_filename variable.

Additionally, always pass a default filename (in $cwd if a directory
name is not specified vi the = form of the option). This is also
consistent with the behavior of the PGO instrumentation. Since the
memory profiles will generally be fairly large, it doesn't make sense to
dump them to stderr. Also, importantly, the memory profiles will
eventually be dumped in a compact binary format, which is another reason
why it does not make sense to send these to stderr by default.

Change the existing memprof tests to specify log_path=stderr when that
was being relied on.

Depends on D89086.

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

3 years ago[SCEV] Delay strengthening of nowrap flags
Nikita Popov [Sun, 1 Nov 2020 12:42:39 +0000 (13:42 +0100)]
[SCEV] Delay strengthening of nowrap flags

Strengthening nowrap flags is relatively expensive. Make sure we
only do it if we're actually going to use the flags -- we don't
use them for many recursive invocations. Additionally, if we're
reusing an existing SCEV node, there's no point in trying to
strengthen the flags if we don't have any new baseline facts.

This change falls slightly short of being NFC, because the way
flags during add+addrec / mul+addrec folding are handled may be
more precise (as less operands are included in the calculation).

3 years ago[RISCV] Add tests to show missed opportunities to use rori for fshr intrinsic with...
Craig Topper [Sun, 1 Nov 2020 20:10:47 +0000 (12:10 -0800)]
[RISCV] Add tests to show missed opportunities to use rori for fshr intrinsic with same inputs. NFC

The fshr intrinsic with same inputs produces rotr ISD node. The
fshl intrinsic produces rotl ISD node.

There were only test cases and isel patterns for the fshl/rotl case.
This patch adds fshr/rotr test cases.

3 years agoRecommit "[RISCV] Remove include of RISCVRegisterInfo.h from RISCVBaseInfo.h. NFCI"
Craig Topper [Sun, 1 Nov 2020 18:31:59 +0000 (10:31 -0800)]
Recommit "[RISCV] Remove include of RISCVRegisterInfo.h from RISCVBaseInfo.h. NFCI"

This reverts 781917254dba17df7fb357a5f621ada2ac1b36e3 and recommits
781917254dba17df7fb357a5f621ada2ac1b36e3.

I've changed getRegForInlineAsmConstraint to not use a std::pair
of Register in a previous commit. Hopefully that fixes the reported
issue with expensive checks on Windows. I'm still not sure exactly
why this commit removing an include affected a different file.

Original message:

RISCVRegisterInfo.h is part of the CodeGen layer. The Utils library
is intended to be shared with the MC layer so shouldn't use files
from the CodeGen layer.

The register enum names are already available from
RISCVMCTargetDesc.h. It appears what was coming from this include
was a transitive include of the Register class which I've replaced
with MCRegister. Register has a constructor from MCRegister so it
should be convertible.

3 years ago[RISCV] Use 'unsigned' instead of Register in getRegForInlineAsmConstraint. NFC
Craig Topper [Sun, 1 Nov 2020 18:16:50 +0000 (10:16 -0800)]
[RISCV] Use 'unsigned' instead of Register in getRegForInlineAsmConstraint. NFC

The return value of this interface still uses an 'unsigned' on all
targets. So we convert Register back to unsigned at the end.

I'm hoping this will prevent the issue that caused the revert of
D90322.

3 years ago[SCEV] Construct GEP expression more efficiently (NFCI)
Nikita Popov [Sun, 1 Nov 2020 17:34:01 +0000 (18:34 +0100)]
[SCEV] Construct GEP expression more efficiently (NFCI)

Instead of performing a sequence of pairwise additions, directly
construct a multi-operand add expression.

This should be NFC modulo any SCEV canonicalization deficiencies.

3 years ago[VPlan] Assert no users remaining when deleting a VPValue.
Florian Hahn [Sat, 3 Oct 2020 20:05:39 +0000 (21:05 +0100)]
[VPlan] Assert no users remaining when deleting a VPValue.

When deleting a VPValue, all users must already by deleted. Add an
assertion to make sure and catch violations.

3 years ago[ARM] Add extra MVE tests for various patches. NFC
David Green [Sun, 1 Nov 2020 16:24:23 +0000 (16:24 +0000)]
[ARM] Add extra MVE tests for various patches. NFC

3 years ago[PowerPC] Avoid unnecessary fadd for unsigned to ppcf128
Qiu Chaofan [Sun, 1 Nov 2020 15:22:47 +0000 (23:22 +0800)]
[PowerPC] Avoid unnecessary fadd for unsigned to ppcf128

Unsigned 32-bit or shorter integer to ppcf128 conversion are currently
expanded as signed-to-double with an extra fadd to 'complement'. But on
PowerPC we have native instruction to directly convert unsigned to
double since ISA v2.06. This patch exploits it.

Reviewed By: efriedma

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

3 years ago[NFC][lldb] Silence unused variable warning
Nathan James [Sun, 1 Nov 2020 14:37:06 +0000 (14:37 +0000)]
[NFC][lldb] Silence unused variable warning

3 years ago[lldb] TestTypeGetModule.py review improvements
Ilya Bukonkin [Sun, 1 Nov 2020 10:53:06 +0000 (13:53 +0300)]
[lldb] TestTypeGetModule.py review improvements

3 years ago[AMDGPU] Some refactoring after D90404. NFC.
Christudasan Devadasan [Sun, 1 Nov 2020 07:41:14 +0000 (13:11 +0530)]
[AMDGPU] Some refactoring after D90404. NFC.

3 years ago[AMDGPU] Add alignment check for v3 to v4 load type promotion
Christudasan Devadasan [Thu, 29 Oct 2020 15:06:14 +0000 (20:36 +0530)]
[AMDGPU] Add alignment check for v3 to v4 load type promotion

It should be enabled only when the load alignment is at least 8-byte.

Fixes: SWDEV-256824

Reviewed By: foad

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

3 years ago[test] Fix some unused check prefixes in test/Analysis/CostModel/X86
Fangrui Song [Sun, 1 Nov 2020 06:29:57 +0000 (22:29 -0800)]
[test] Fix some unused check prefixes in test/Analysis/CostModel/X86

3 years ago[test] Fix unused check prefixes in test/AST
Fangrui Song [Sun, 1 Nov 2020 04:46:45 +0000 (20:46 -0800)]
[test] Fix unused check prefixes in test/AST

3 years ago[test] Clean up test/Frontend/gnu-mcount.c and fix unused check prefixes
Fangrui Song [Sun, 1 Nov 2020 04:33:46 +0000 (20:33 -0800)]
[test] Clean up test/Frontend/gnu-mcount.c and fix unused check prefixes

3 years ago[lld][WebAssembly] Remove bad-reloc test
Sam Clegg [Sat, 31 Oct 2020 23:39:27 +0000 (16:39 -0700)]
[lld][WebAssembly] Remove bad-reloc test

This test was checking behaviour that only exists in the debug
configuration so will fail in release builds.

Perhaps there is way to keep this test around and only run
it in debug builds but for now I'm removing so fix the
release builders.

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

3 years ago[AVR] Improve inline rotate/shift expansions
Ayke van Laethem [Sun, 23 Aug 2020 12:17:29 +0000 (14:17 +0200)]
[AVR] Improve inline rotate/shift expansions

These expansions were rather inefficient and were done with more code
than necessary. This change optimizes them to use expansions more
similar to GCC. The code size is the same (when optimizing for code
size) but somehow LLVM reorders blocks in a non-optimal way. Still, this
should be an improvement with a reduction in code size of around 0.12%
(when building compiler-rt).

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

3 years ago[mlir][AsmPrinter] Fix crash in windows build after D89354
River Riddle [Sat, 31 Oct 2020 21:21:49 +0000 (14:21 -0700)]
[mlir][AsmPrinter] Fix crash in windows build after D89354

Switch to an index based loop instead of using enumerate.

3 years ago[DSE] Use same logic as legacy impl to check if free kills a location.
Florian Hahn [Sat, 31 Oct 2020 19:30:19 +0000 (19:30 +0000)]
[DSE] Use same logic as legacy impl to check if free kills a location.

This patch updates DSE + MemorySSA to use the same check as the legacy
implementation to determine if a location is killed by a free call.

This changes the existing behavior so that a free does not kill
locations before the start of the freed pointer.

This should fix PR48036.

3 years ago[DSE] Add additional tests with free, regenerate check lines.
Florian Hahn [Sat, 31 Oct 2020 19:35:37 +0000 (19:35 +0000)]
[DSE] Add additional tests with free, regenerate check lines.

The new test cases are inspired by PR48036.

3 years agoFix lld/wasm test portability issue, and XFAIL the test
Reid Kleckner [Sat, 31 Oct 2020 18:19:28 +0000 (11:19 -0700)]
Fix lld/wasm test portability issue, and XFAIL the test

I don't see any warnings from lld.wasm locally. Needs more
investigation.

3 years ago[COFF] Move ghash timers under the "add objects" timer
Reid Kleckner [Sat, 31 Oct 2020 18:08:58 +0000 (11:08 -0700)]
[COFF] Move ghash timers under the "add objects" timer

I had envisioned the ghash step as a big up front step, but as currently
written, the timers are nested, and we are notionally adding types from
objects, so we might as well arrange the timers this way.

3 years agoAdd missing EOL. NFCI.
Simon Pilgrim [Sat, 31 Oct 2020 17:32:04 +0000 (17:32 +0000)]
Add missing EOL. NFCI.

3 years ago[GWP-ASan] Fuchsia specific mapping & utilities functions
Kostya Kortchinsky [Fri, 30 Oct 2020 17:42:28 +0000 (10:42 -0700)]
[GWP-ASan] Fuchsia specific mapping & utilities functions

This CL introduces the Fuchsia versions of the existing platform
specific functions.

For Fuchsia, we need to track the VMAR (https://fuchsia.dev/fuchsia-src/reference/kernel_objects/vm_address_region)
of the Guarded Pool mapping, and for this purpose I added some platform
specific data structure that remains empty on POSIX platforms.

`getThreadID` is not super useful for Fuchsia so it's just left as a
stub for now.

While testing the changes in my Fuchsia tree, I realized that
`guarded_pool_allocator_tls.h` should have closed the namespace before
including `GWP_ASAN_PLATFORM_TLS_HEADER`, otherwise drama ensues.

This was tested in g3, upstream LLVM, and Fuchsia (with local changes).

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

3 years agoReland "[SLP] Consider alternatives for cost of select instructions."
Florian Hahn [Sat, 31 Oct 2020 10:51:19 +0000 (10:51 +0000)]
Reland "[SLP] Consider alternatives for cost of select instructions."

This reverts the revert commit a1b53db32418cb6ed6f5b2054d15a22b5aa3aeb9.

This patch includes a fix for a reported issue, caused by
matchSelectPattern returning UMIN for selects of pointers in
some cases by looking to some connected casts.

For now, ensure integer instrinsics are only returned for selects of
ints or int vectors.

3 years ago[Sema] Diagnose annotating `if constexpr` with a likelihood attribute
Mark de Wever [Sat, 31 Oct 2020 12:07:06 +0000 (13:07 +0100)]
[Sema] Diagnose annotating `if constexpr` with a likelihood attribute

Adds a diagnostic when the user annotates an `if constexpr` with a
likelihood attribute. The `if constexpr` statement is evaluated at compile
time so the attribute has no effect. Annotating the accompanied `else`
with a likelihood attribute has the same effect as annotating a generic
statement. Since the attribute there is most likely not intended, a
diagnostic will be issued. Since the attributes can't conflict, the
"conflict" won't be diagnosed for an `if constexpr`.

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

3 years ago[CodeGen] Implement [[likely]] and [[unlikely]] for while and for loop.
Mark de Wever [Sat, 31 Oct 2020 12:07:06 +0000 (13:07 +0100)]
[CodeGen] Implement [[likely]] and [[unlikely]] for while and for loop.

The attribute has no effect on a do statement since the path of execution
will always include its substatement.

It adds a diagnostic when the attribute is used on an infinite while loop
since the codegen omits the branch here. Since the likelihood attributes
have no effect on a do statement no diagnostic will be issued for
do [[unlikely]] {...} while(0);

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

3 years ago[TableGen] Eliminate uses of true and false in .td files.
Paul C. Anagnostopoulos [Fri, 30 Oct 2020 20:09:41 +0000 (16:09 -0400)]
[TableGen] Eliminate uses of true and false in .td files.

They occurred in one NVPTX file and some test files.

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

3 years agoUse ANSI escape codes for --use-color on Windows
David Sanders [Sat, 31 Oct 2020 14:36:42 +0000 (10:36 -0400)]
Use ANSI escape codes for --use-color on Windows

On Windows the --use-color option cannot be used for its originally
intended purpose of forcing color when piping stdout, since Windows
does not use ANSI escape codes by default. This change turns on ANSI
escape codes on Windows when forcing color to a non-displayed stdout
(e.g. piped).

3 years ago[ARM] Fix crash for gather of pointer costs.
David Green [Sat, 31 Oct 2020 13:10:14 +0000 (13:10 +0000)]
[ARM] Fix crash for gather of pointer costs.

If the elt size is unknown due to it being a pointer, a comparison
against 0 will cause an assert. Make sure the elt size is large enough
before comparing and for the moment just return the scalar cost.

3 years agoTemporarily remove test CodeGen/pragma-fp-exc
Serge Pavlov [Sat, 31 Oct 2020 12:45:56 +0000 (19:45 +0700)]
Temporarily remove test CodeGen/pragma-fp-exc

This test fails on buildbots where CPU architecture does not fully
support constrained intrinsics.

3 years ago[InstCombine] foldSelectRotate - generalize to foldSelectFunnelShift
Simon Pilgrim [Sat, 31 Oct 2020 12:32:34 +0000 (12:32 +0000)]
[InstCombine] foldSelectRotate - generalize to foldSelectFunnelShift

This is the last of the rotate->funnel shift InstCombine generalizations for PR46896

We still have foldGuardedRotateToFunnelShift to deal with in AggressiveInstCombine

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

3 years ago[X86] Make some basic VarArgsLoweringHelper helper methods const. NFCI.
Simon Pilgrim [Sat, 31 Oct 2020 12:16:33 +0000 (12:16 +0000)]
[X86] Make some basic VarArgsLoweringHelper helper methods const. NFCI.

Fixes a number of cppcheck remarks.

3 years ago[X86] Make the X86FrameSortingComparator operator const. NFCI.
Simon Pilgrim [Sat, 31 Oct 2020 12:15:43 +0000 (12:15 +0000)]
[X86] Make the X86FrameSortingComparator operator const. NFCI.

Fixes a cppcheck remark.

3 years ago[CSE] Make some basic EarlyCSE::StackNode helper methods const. NFCI.
Simon Pilgrim [Sat, 31 Oct 2020 12:10:21 +0000 (12:10 +0000)]
[CSE] Make some basic EarlyCSE::StackNode helper methods const. NFCI.

Fixes a number of cppcheck remarks.

3 years ago[Bitcode] Make some basic PlaceholderQueue/MetadataLoaderImpl helper methods const...
Simon Pilgrim [Sat, 31 Oct 2020 12:08:58 +0000 (12:08 +0000)]
[Bitcode] Make some basic PlaceholderQueue/MetadataLoaderImpl helper methods const. NFCI.

Fixes a number of cppcheck remarks.

3 years ago[MCA][LSUnit] Correctly update the internal group flags on store barrier execution...
Andrea Di Biagio [Sat, 31 Oct 2020 11:21:05 +0000 (11:21 +0000)]
[MCA][LSUnit] Correctly update the internal group flags on store barrier execution. Fixes PR48024.

This is likely to be a regressigion introduced by my last refactoring of the
LSUnit (commit 5578ec32f9c4f). Before this patch, the
"CurrentStoreBarrierGroupID" index was not correctly reset on store barrier
executions.  This was leading to unexpected crashes like the one reported as
PR48024.

3 years ago[X86] X86MCTargetDesc - ensure the declaration/definition variable names match. NFCI.
Simon Pilgrim [Sat, 31 Oct 2020 11:50:00 +0000 (11:50 +0000)]
[X86] X86MCTargetDesc - ensure the declaration/definition variable names match. NFCI.

Silences cppcheck mismatch warnings.

3 years ago[X86] Reduce scope of DestReg and use specific Register type not unsigned. NFCI.
Simon Pilgrim [Sat, 31 Oct 2020 11:46:07 +0000 (11:46 +0000)]
[X86] Reduce scope of DestReg and use specific Register type not unsigned. NFCI.

3 years ago[X86] printAsmMRegister - make the X86AsmPrinter arg a const reference. NFC.
Simon Pilgrim [Sat, 31 Oct 2020 11:41:14 +0000 (11:41 +0000)]
[X86] printAsmMRegister - make the X86AsmPrinter arg a const reference. NFC.

Fixes cppcheck warning.

3 years ago[X86] assignValueToReg - fix Wshadow warning. NFCI.
Simon Pilgrim [Sat, 31 Oct 2020 11:39:26 +0000 (11:39 +0000)]
[X86] assignValueToReg - fix Wshadow warning. NFCI.

X86OutgoingValueHandler already has a MIB member

3 years ago[X86] printAsmVRegister - remove unused argument. NFC.
Simon Pilgrim [Sat, 31 Oct 2020 11:34:28 +0000 (11:34 +0000)]
[X86] printAsmVRegister - remove unused argument. NFC.

3 years ago[X86] X86AsmPrinter - ensure the declaration/definition variable names match. NFCI.
Simon Pilgrim [Sat, 31 Oct 2020 11:31:46 +0000 (11:31 +0000)]
[X86] X86AsmPrinter - ensure the declaration/definition variable names match. NFCI.

Silences cppcheck mismatch warnings.

3 years ago[X86] No need to determine pointer when the type is already a MachineInstr*. NFCI.
Simon Pilgrim [Sat, 31 Oct 2020 11:26:25 +0000 (11:26 +0000)]
[X86] No need to determine pointer when the type is already a MachineInstr*. NFCI.

Caught by cppcheck - appears to be a copy+paste typo as the other var is an iterator that does need the &* pointer operation.

3 years agoFix gendered documentation
Pedro Gonnet [Sat, 31 Oct 2020 11:08:55 +0000 (12:08 +0100)]
Fix gendered documentation

Changed two references to developers as "he" or "him" to the more neutral "they".

Reviewed By: JDevlieghere, sylvestre.ledru

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

3 years ago[sanitizer] Disabled 2 tests on Android
Vitaly Buka [Sat, 31 Oct 2020 10:55:09 +0000 (03:55 -0700)]
[sanitizer] Disabled 2 tests on Android

They block bot upgrade to NDK 21.

3 years agoAdd option 'exceptions' to pragma clang fp
Serge Pavlov [Tue, 20 Oct 2020 17:56:39 +0000 (00:56 +0700)]
Add option 'exceptions' to pragma clang fp

Pragma 'clang fp' is extended to support a new option, 'exceptions'. It
allows to specify floating point exception behavior more flexibly.

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

3 years ago[Inliner] Consistently apply callsite noalias metadata
Nikita Popov [Sat, 31 Oct 2020 09:51:12 +0000 (10:51 +0100)]
[Inliner] Consistently apply callsite noalias metadata

Previously, !noalias and !alias.scope metadata on the call site was
applied as part of CloneAliasScopeMetadata(), which short-circuits
if the callee does not use any noalias metadata itself. However,
these two things have no relation to each other.

Consistently apply !noalias and !alias.scope metadata by integrating
this into an existing function that handled !llvm.access.group and
!llvm.mem.parallel_loop_access metadata. The handling for all of
these metadata kinds essentially the same.

3 years ago[Inliner] Add extra test for callsite noalias metadata (NFC)
Nikita Popov [Sat, 31 Oct 2020 09:24:22 +0000 (10:24 +0100)]
[Inliner] Add extra test for callsite noalias metadata (NFC)

Test the case where the callee does not use noalias metadata itself.
This case is currently handled inconsistently.

3 years ago[CMake] Avoid accidental C++ standard library dependency in sanitizers
Petr Hosek [Sat, 31 Oct 2020 03:19:39 +0000 (20:19 -0700)]
[CMake] Avoid accidental C++ standard library dependency in sanitizers

While sanitizers don't use C++ standard library, we could still end
up accidentally including or linking it just by the virtue of using
the C++ compiler. Pass -nostdinc++ and -nostdlib++ to avoid these
accidental dependencies.

Reviewed By: smeenai, vitalybuka

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

3 years agoRevert "Use uint64_t for branch weights instead of uint32_t"
Arthur Eubanks [Sat, 31 Oct 2020 07:15:46 +0000 (00:15 -0700)]
Revert "Use uint64_t for branch weights instead of uint32_t"

This reverts commit 10f2a0d662d8d72eaac48d3e9b31ca8dc90df5a4.

More uint64_t overflows.

3 years ago[test] Fix unused check prefixes in test/Driver
Fangrui Song [Sat, 31 Oct 2020 07:14:59 +0000 (00:14 -0700)]
[test] Fix unused check prefixes in test/Driver

Note, the deprecated AArch64 -msign-return-address= does not accept b-key. So
delete the incorrect tests.

3 years ago[test] Fix unused check prefixes in test/DebugInfo
Fangrui Song [Sat, 31 Oct 2020 06:28:31 +0000 (23:28 -0700)]
[test] Fix unused check prefixes in test/DebugInfo

3 years ago[lldb] Fix XcodeSDKModuleTests
Jonas Devlieghere [Sat, 31 Oct 2020 05:07:33 +0000 (22:07 -0700)]
[lldb] Fix XcodeSDKModuleTests

Update XcodeSDKModuleTests for YAMLModuleTester changes in D90393.

3 years ago[gn build] Port 756f5978410
LLVM GN Syncbot [Sat, 31 Oct 2020 05:19:04 +0000 (05:19 +0000)]
[gn build] Port 756f5978410

3 years ago[X86] Support Intel avxvnni
Liu, Chen3 [Fri, 30 Oct 2020 04:58:05 +0000 (12:58 +0800)]
[X86] Support Intel avxvnni
This patch mainly made the following changes:

1. Support AVX-VNNI instructions;
2. Introduce ExplicitVEXPrefix flag so that vpdpbusd/vpdpbusds/vpdpbusds/vpdpbusds instructions only use vex-encoding when user explicity add {vex} prefix.

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

3 years ago[NFC][CMake] Move some COMPILER_RT variables setup
Petr Hosek [Fri, 30 Oct 2020 23:16:09 +0000 (16:16 -0700)]
[NFC][CMake] Move some COMPILER_RT variables setup

Part of D88922

3 years ago[CMake] Add -fno-rtti into tsan unittests
Petr Hosek [Fri, 30 Oct 2020 23:16:09 +0000 (16:16 -0700)]
[CMake] Add -fno-rtti into tsan unittests

And some other NFC parts of D88922

3 years ago[CMake] Remove cxx-headers from runtime deps
Petr Hosek [Fri, 30 Oct 2020 23:16:09 +0000 (16:16 -0700)]
[CMake] Remove cxx-headers from runtime deps

Part of D88922

3 years ago[CMake] Replace ctime with time.h in memprof
Petr Hosek [Fri, 30 Oct 2020 23:16:09 +0000 (16:16 -0700)]
[CMake] Replace ctime with time.h in memprof

Part of D88922

3 years agoPR42513: Fix handling of function definitions lazily instantiated from
Richard Smith [Sat, 31 Oct 2020 01:30:56 +0000 (18:30 -0700)]
PR42513: Fix handling of function definitions lazily instantiated from
friends.

When determining whether a function has a template instantiation
pattern, look for other declarations of that function that were
instantiated from a friend function definition, rather than assuming
that checking for member specialization information on whichever
declaration name lookup found will be sufficient.

3 years ago[lld][WebAssembly] Do not specify temporary file name in tests.
Ali Tamur [Sat, 31 Oct 2020 01:27:28 +0000 (18:27 -0700)]
[lld][WebAssembly] Do not specify temporary file name in tests.

bad-reloc.yaml test introduced at 9d1409df87 uses a name (out.wasm) to specify a
temporary output file name, which causes breakage in our system.