platform/upstream/llvm.git
4 years ago[Support] Make Support/SwapByteOrder.h compile on Fuchsia
Roland McGrath [Wed, 28 Oct 2020 01:30:25 +0000 (18:30 -0700)]
[Support] Make Support/SwapByteOrder.h compile on Fuchsia

Reviewed By: phosek

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

4 years ago[AMDGPU] Fix double space in disassembly of ds_gws_sema_* with gds
Jay Foad [Wed, 28 Oct 2020 13:06:44 +0000 (13:06 +0000)]
[AMDGPU] Fix double space in disassembly of ds_gws_sema_* with gds

By setting up the AsmStrings correctly we can remove some special cases
from AMDGPUInstPrinter::printOffset.

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

4 years agoRevert "[mlir][gpu] Allow gpu.launch_func to be async."
Mehdi Amini [Thu, 29 Oct 2020 17:30:27 +0000 (17:30 +0000)]
Revert "[mlir][gpu] Allow gpu.launch_func to be async."

This reverts commit ec7780ebdab480139596c3cb08ee77d7035457b3.

One of the bot is crashing in a test related to this change.

4 years ago[MemProf] Augment test to debug avr bot failure
Teresa Johnson [Thu, 29 Oct 2020 16:40:22 +0000 (09:40 -0700)]
[MemProf] Augment test to debug avr bot failure

After 81f7b96ed0a2295e0b82ca185019370ac8e1895e, I can see that the
reason this test is failing on llvm-avr-linux is that it doesn't think
the directory exists (error comes during file open for write command).
Not sure why since this is the main test Output directory and we created
a different file there earlier in the test from the same file open
invocation. Print directory contents in an attempt to debug.

4 years ago[nfc] [lldb] Remove excessive parentheses in SymbolFileDWARF::GetUID
Jan Kratochvil [Thu, 29 Oct 2020 16:54:43 +0000 (17:54 +0100)]
[nfc] [lldb] Remove excessive parentheses in SymbolFileDWARF::GetUID

4 years ago[ThinLTO] Fix empty .llvmcmd sections
Mircea Trofin [Thu, 29 Oct 2020 03:16:51 +0000 (20:16 -0700)]
[ThinLTO] Fix empty .llvmcmd sections

When passing -lto-embed-bitcode=post-merge-pre-opt, we were getting
empty .llvmcmd sections. It turns out that is because the
CodeGenOptions::CmdArgs field was only populated when clang saw
-fembed-bitcode={all|marker}.

This patch always populates the CodeGenOptions::CmdArgs. The overhead
of carrying through in memory in all cases is likely negligible in
the grand schema of things, and it keeps the using code simple.

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

4 years ago[mlir][gpu] Allow gpu.launch_func to be async.
Christian Sigg [Thu, 22 Oct 2020 05:49:50 +0000 (07:49 +0200)]
[mlir][gpu] Allow gpu.launch_func to be async.

Reviewed By: herhut

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

4 years ago[X86] Add PR46393 test case
Simon Pilgrim [Thu, 29 Oct 2020 16:27:04 +0000 (16:27 +0000)]
[X86] Add PR46393 test case

4 years ago[AMDGPU] Add __builtin_amdgcn_grid_size
Jon Chesterfield [Thu, 29 Oct 2020 16:24:53 +0000 (16:24 +0000)]
[AMDGPU] Add __builtin_amdgcn_grid_size

[AMDGPU] Add __builtin_amdgcn_grid_size

Similar to D76772, loads the data from the dispatch pointer. Marked invariant.

Patch also updates the openmp devicertl to use this builtin.

Reviewed By: yaxunl

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

4 years ago[x86] add test for umul intrinsic costs; NFC
Sanjay Patel [Thu, 29 Oct 2020 16:12:25 +0000 (12:12 -0400)]
[x86] add test for umul intrinsic costs; NFC

4 years ago[MC] Error for .globl/.local which change the symbol binding and warn for .weak
Fangrui Song [Thu, 29 Oct 2020 16:03:13 +0000 (09:03 -0700)]
[MC] Error for .globl/.local which change the symbol binding and warn for .weak

GNU as let .weak override .globl since binutils-gdb
5ca547dc2399a0a5d9f20626d4bf5547c3ccfddd (1996) while MC lets the last
directive win (PR38921).

This caused an issue to Linux's powerpc port which has been fixed by
http://git.kernel.org/linus/968339fad422a58312f67718691b717dac45c399

Binding overriding is error-prone. This patch disallows a changed binding.
(https://sourceware.org/pipermail/binutils/2020-March/000299.html )

Our behavior regarding `.globl x; .weak x` matches GNU as. Such usage is
still suspicious but we issue a warning for now. We may upgrade it to an
error in the future.

Reviewed By: jhenderson, nickdesaulniers

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

4 years ago[AMDGPU] Use pseudo instructions for readlane/writelane
Jay Foad [Thu, 29 Oct 2020 12:10:56 +0000 (12:10 +0000)]
[AMDGPU] Use pseudo instructions for readlane/writelane

This reverts r227987 "R600/SI: Determine target-specific encoding of READLANE and WRITELANE early v2".

All the codegen changes are caused by the post-RA scheduler no longer
treating readlane/writelane as scheduling barriers due to having
unmodelled side effects. (The pseudos are hasSideEffects = 0, but the
real instructions are hasSideEffects = ? which TableGen conservatively
treats as 1.)

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

4 years ago[sanitizer] Print errno for report file open failure
Teresa Johnson [Sun, 25 Oct 2020 05:32:03 +0000 (22:32 -0700)]
[sanitizer] Print errno for report file open failure

To help debug failures, specifically the llvm-avr-linux bot failure from
5c20d7db9f2791367b9311130eb44afecb16829c:

http://lab.llvm.org:8011/#/builders/112/builds/407/steps/5/logs/FAIL__MemProfiler-x86_64-linux-dynamic__log_path_t

Also re-enable the failing test which I temporarily disabled, to
see if this change will help identify why that particular log file can't
be opened for write on that bot (when another log file in the same
directory could earlier in the test).

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

4 years ago[NFC] Add more tests for DISubprogram verifier
Scott Linder [Thu, 29 Oct 2020 15:22:15 +0000 (15:22 +0000)]
[NFC] Add more tests for DISubprogram verifier

Minimum amount of tests to cover (most) of the DISubprogram verifier
checks.

Reviewed By: vsk

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

Change-Id: Icd25dac64f87f6dcf67ff3443eb4f95af18d05a8

4 years ago[InstCombine] visitShl - ensure inner shifts have inrange amounts
Simon Pilgrim [Thu, 29 Oct 2020 14:30:42 +0000 (14:30 +0000)]
[InstCombine] visitShl - ensure inner shifts have inrange amounts

Noticed when fixing OSS Fuzz #26716

4 years ago[mlir][Linalg] Make Linalg fusion a test pass
Nicolas Vasilache [Thu, 29 Oct 2020 14:02:56 +0000 (14:02 +0000)]
[mlir][Linalg] Make Linalg fusion a test pass

Linalg "tile-and-fuse" is currently exposed as a Linalg pass "-linalg-fusion" but only the mechanics of the transformation are currently relevant.
Instead turn it into a "-test-linalg-greedy-fusion" pass which performs canonicalizations to enable more fusions to compose.
This allows dropping the OperationFolder which is not meant to be used with the pattern rewrite infrastructure.

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

4 years ago[ARM] Fix IT block generation after Thumb2SizeReduce with -Oz
Nicholas Guy [Thu, 29 Oct 2020 13:58:39 +0000 (13:58 +0000)]
[ARM] Fix IT block generation after Thumb2SizeReduce with -Oz

Fixes a regression caused by D82439, in which IT blocks were no longer being generated when -Oz is present.

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

4 years ago[ARM] Add IT block generation test
Nicholas Guy [Thu, 29 Oct 2020 13:56:52 +0000 (13:56 +0000)]
[ARM] Add IT block generation test

D88496 introduces some new behaviour to IT block generation,
behaviour which is not covered by the current unit tests.
This adds one to cover it

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

4 years ago[VE] Change to use integrated assembly by defualt
Kazushi (Jam) Marukawa [Thu, 29 Oct 2020 12:17:37 +0000 (21:17 +0900)]
[VE] Change to use integrated assembly by defualt

We've implemented integrated assembler.  Now, we change to use
integrated assembler by default.  Update a regression test also.

Reviewed By: simoll

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

4 years ago[libc++] Remove additional uses of std::rand() missed by 63aeadb4849d
Louis Dionne [Thu, 29 Oct 2020 15:07:39 +0000 (11:07 -0400)]
[libc++] Remove additional uses of std::rand() missed by 63aeadb4849d

4 years ago[AMDGPU] Remove gds operand from ds_gws_* MachineInstrs
Jay Foad [Thu, 29 Oct 2020 10:20:54 +0000 (10:20 +0000)]
[AMDGPU] Remove gds operand from ds_gws_* MachineInstrs

The operand value was always 1 (except in some bad MIR tests) so it was
redundant.

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

4 years ago[AMDGPU] Fix double space in disassembly of s_set_gpr_idx_mode
Jay Foad [Thu, 29 Oct 2020 09:39:28 +0000 (09:39 +0000)]
[AMDGPU] Fix double space in disassembly of s_set_gpr_idx_mode

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

4 years ago[AMDGPU] Fix double space in disassembly of some DPP instructions
Jay Foad [Wed, 28 Oct 2020 16:59:29 +0000 (16:59 +0000)]
[AMDGPU] Fix double space in disassembly of some DPP instructions

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

4 years ago[MLIR] Support walks over regions and blocks
Frederik Gossen [Thu, 29 Oct 2020 13:48:07 +0000 (13:48 +0000)]
[MLIR] Support walks over regions and blocks

Add specializations for `walk` to allow traversal of regions and blocks.

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

4 years ago[SVE] Remove TypeSize comparison operators
David Sherwood [Mon, 26 Oct 2020 15:12:58 +0000 (15:12 +0000)]
[SVE] Remove TypeSize comparison operators

All known instances in the code where we relied upon the TypeSize
comparison operators have now been changed to either use scalar
interger comparisons or one of the TypeSize::isKnownXY functions.
It is now safe to remove the comparison operators.

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

4 years ago[VE] Add missing BCR format
Kazushi (Jam) Marukawa [Thu, 29 Oct 2020 11:57:00 +0000 (20:57 +0900)]
[VE] Add missing BCR format

Add missing "BCR %sy, 0, target" format instruction and a regression
test for this format.

Reviewed By: simoll

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

4 years agoRevert "clang-format: Add a consumer to diagnostics engine"
Nico Weber [Thu, 29 Oct 2020 14:29:53 +0000 (10:29 -0400)]
Revert "clang-format: Add a consumer to diagnostics engine"

This reverts commit df00267f1fdb0b098dc42f1caa8a59b29c8e0e5f.
clang-format should not depend on Frontend, see comment on
https://reviews.llvm.org/D90121.

4 years ago[VE] Add missing symbolic branch patterns
Kazushi (Jam) Marukawa [Thu, 29 Oct 2020 12:01:16 +0000 (21:01 +0900)]
[VE] Add missing symbolic branch patterns

Add missing symbolic branch patterns to a regression test.

Reviewed By: simoll

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

4 years ago[VE] Support register aliases in llvm-mc
Kazushi (Jam) Marukawa [Thu, 29 Oct 2020 11:38:04 +0000 (20:38 +0900)]
[VE] Support register aliases in llvm-mc

Support register aliases in MC layer to compile existing assembly
files with clang and integrated assembler.

Reviewed By: simoll

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

4 years ago[mlir][openacc] Add if and device_type to update op
Valentin Clement [Thu, 29 Oct 2020 13:54:31 +0000 (09:54 -0400)]
[mlir][openacc] Add if and device_type to update op

Update op is modelling the update directive (2.14.4) from the OpenACC specs.
An if condition and a device_type list can be attached to the directive. This patch add
these two information to the current op.

Reviewed By: rriddle

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

4 years ago[flang][openacc] Enforce no modifier on enter data and exit data clauses
Valentin Clement [Thu, 29 Oct 2020 13:53:10 +0000 (09:53 -0400)]
[flang][openacc] Enforce no modifier on enter data and exit data clauses

Enter data can have the copyin clause and exit data can have the copyout clause.
Both clauses support modifier with other directive but for these two directives no modifier
are supported. This semantic check enforce this rule.

Reviewed By: kiranktp

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

4 years ago[libcxx] [docs] [NFC] Fix typo.
Marek Kurdej [Thu, 29 Oct 2020 13:39:09 +0000 (14:39 +0100)]
[libcxx] [docs] [NFC] Fix typo.

4 years ago[libcxx] Add targets to available features.
Daniel Kiss [Thu, 29 Oct 2020 13:03:30 +0000 (14:03 +0100)]
[libcxx] Add targets to available features.

This patch add the target-* (x86_64-*) as used elsewhere in llvm.

Reviewed By: #libc, #libc_abi, ldionne

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

4 years ago[libunwind] Fix linker flag handling in the tests.
Daniel Kiss [Thu, 29 Oct 2020 13:00:40 +0000 (14:00 +0100)]
[libunwind] Fix linker flag handling in the tests.

--export-dynamic is not always available on all targets.
-funwind-tables was a duplicate in the lit.site.cfg.in.

Reviewed By: ldionne

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

4 years ago[lldb] Use reverse connection method for lldb-server tests
Pavel Labath [Wed, 28 Oct 2020 13:59:14 +0000 (14:59 +0100)]
[lldb] Use reverse connection method for lldb-server tests

This fixes an flakyness is all gdb-remote tests. These tests have been
(mildly) flaky since we started using "localhost" instead of 127.0.0.1
in the test suite. The reason is that lldb-server needs to create two
sockets (v4 and v6) to listen for localhost connections. The algorithm
it uses first tries to select a random port (bind(localhost:0)) for the
first address, and then bind the same port for the second one.

The creating of the second socket can fail as there's no guarantee that
port will be available -- it seems that the (linux) kernel tries to
choose an unused port for the first socket (I've had to create thousands
of sockets to reproduce this reliably), but this can apparantly fail
when the system is under load (and our test suite creates a _lot_ of
sockets).

The socket creationg operation is considered successful if it creates at
least one socket is created, but the test harness has no way of knowing
which one it is, so it can end up connecting to the wrong address.

I'm not aware of a way to atomically create two sockets bound to the
same port. One way to fix this would be to make lldb-server report the
address is it listening on instead of just the port. However, this would
be a breaking change and it's not clear to me that's worth it (the
algorithm works pretty well under normal circumstances).

Instead, this patch sidesteps that problem by using "reverse"
connections. This way, the test harness is responsible for creating the
listening socket so it can pass the address that it has managed to open.
It also results in much simpler code overall.

To preserve test coverage for the named pipe method, I've moved the
relevant code to a dedicated test. To avoid original problem, this test
passes raw addresses (as obtained by getaddrinfo(localhost)) instead of
"localhost".

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

4 years ago[llvm-readobj/elf] - Fix a crash when dumping a dynamic relocation that refer to...
Georgii Rymar [Tue, 27 Oct 2020 09:15:09 +0000 (12:15 +0300)]
[llvm-readobj/elf] - Fix a crash when dumping a dynamic relocation that refer to a symbol past the EOF.

There is a possible scenario when we crash when dumping dynamic relocations.
For that we should have no section headers (to take the number of synamic symbols from)
and a dynamic relocation that refers to a symbol with an index that is too large to be in a file.

The patch fixes it.

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

4 years ago[DebugInfo] [NFCI] Additional test for support of DW_TAG_generic_subrange
Alok Kumar Sharma [Thu, 29 Oct 2020 12:11:44 +0000 (17:41 +0530)]
[DebugInfo] [NFCI] Additional test for support of DW_TAG_generic_subrange

As suggested by dstenb, additional test is added to check emission of DW_OP_consts.
Differential Revision: https://reviews.llvm.org/D89218

4 years ago[llvm-exegesis] Do not try to assign random registers twice.
Clement Courbet [Thu, 29 Oct 2020 10:48:43 +0000 (11:48 +0100)]
[llvm-exegesis] Do not try to assign random registers twice.

Doing a random assignment assigns both tested (forward) and back-to-back
(backward) instructions.

When none of the tested instruction and back-to-back instruction have
implicit aliasing, we're currently trying to do a random register
asignment twice.

Fix this (see PR26418).

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

4 years ago[ADT] Fix for ImmutableMapRef
Adam Balogh [Thu, 15 Oct 2020 13:07:48 +0000 (15:07 +0200)]
[ADT] Fix for ImmutableMapRef

The `Root` member of `ImmutableMapRef` was changed recently from a plain
pointer to `IntrusiveRefCntPtr`. However, the `Profile` member function
was not adjusted. This results in comilation error whenever the
`Profile` method is used on an `ImmutableMapRef`. This patch fixes this
issue and also adds unit tests for `ImmutableMapRef`.

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

4 years ago[yaml2obj][test] - Merge strtab-implicit-sections-*.yaml into strtab-implicit-section...
Georgii Rymar [Thu, 29 Oct 2020 08:55:00 +0000 (11:55 +0300)]
[yaml2obj][test] - Merge strtab-implicit-sections-*.yaml into strtab-implicit-sections.yaml and improve testing of .shstrtab

This creates `strtab-implicit-sections.yaml` and merges 2 `strtab-implicit-sections*` tests into it.
I've also added a few tests for `.shstrtab` section related to section flags.

With that we have a single place where we can test implicit string table sections and
the `.shstrtab` section in particular.

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

4 years ago[InstCombine] Add select+funnel-shift test patterns
Simon Pilgrim [Wed, 28 Oct 2020 16:17:45 +0000 (16:17 +0000)]
[InstCombine] Add select+funnel-shift test patterns

4 years ago[MIR] Fix out of bounds access in MIRPrinter.
dfukalov [Tue, 27 Oct 2020 15:17:38 +0000 (18:17 +0300)]
[MIR] Fix out of bounds access in MIRPrinter.

Fixes: SWDEV-256460

Reviewed By: arsenm

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

4 years ago[NFC][SCEV] Use generic predicate checkers to simplify code
Max Kazantsev [Thu, 29 Oct 2020 11:09:31 +0000 (18:09 +0700)]
[NFC][SCEV] Use generic predicate checkers to simplify code

4 years ago[AMDGPU] Simplify insertNoops functions. NFC.
Jay Foad [Thu, 29 Oct 2020 10:55:16 +0000 (10:55 +0000)]
[AMDGPU] Simplify insertNoops functions. NFC.

4 years ago[DebugInfo] [NFCI] Adding a missed out line in support for DW_TAG_generic_subrange.
Alok Kumar Sharma [Thu, 29 Oct 2020 10:38:51 +0000 (16:08 +0530)]
[DebugInfo] [NFCI] Adding a missed out line in support for DW_TAG_generic_subrange.

This commit adds a missed out line in earlier commit for DW_TAG_generic_subrange.
Previous commit ID: a6dd01afa3d5902203d04a72e0b478078f796a35
Differential Revision: https://reviews.llvm.org/D89218
Thanks markus for pointing this out.

4 years ago[SCEV] Match 'zext (trunc A to iB) to iY' as URem.
Florian Hahn [Thu, 29 Oct 2020 09:30:37 +0000 (09:30 +0000)]
[SCEV] Match 'zext (trunc A to iB) to iY' as URem.

URem operations with constant power-of-2 second operands are modeled as
such. This patch on its own has very little impact (e.g. no changes in
CodeGen for MultiSource/SPEC2000/SPEC2006 on X86 -O3 -flto), but I'll
soon post follow-up patches that make use of it to more accurately
determine the trip multiple.

Reviewed By: mkazantsev

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

4 years ago[NFC] Add some new util functions to ICmpInst
Max Kazantsev [Thu, 29 Oct 2020 10:34:58 +0000 (17:34 +0700)]
[NFC] Add some new util functions to ICmpInst

4 years ago[mlir] Reorder shape assuming bufferization.
Tres Popp [Thu, 29 Oct 2020 10:01:05 +0000 (11:01 +0100)]
[mlir] Reorder shape assuming bufferization.

The previous ordering continued to use the original assuming after
replacing it which is not allowed. Now, inline the region from the old
into the new before the replacement.

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

4 years ago[yaml2obj][test] - Merge dynsymtab-shlink.yaml to dynsym-section.yaml
Georgii Rymar [Wed, 28 Oct 2020 12:05:35 +0000 (15:05 +0300)]
[yaml2obj][test] - Merge dynsymtab-shlink.yaml to dynsym-section.yaml

This simplifies the dynsymtab-shlink.yaml test (with use of macros)
and merges it into the dynsym-section.yaml test.

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

4 years agoclang-format: Add a consumer to diagnostics engine
Krasimir Georgiev [Thu, 29 Oct 2020 10:27:54 +0000 (11:27 +0100)]
clang-format: Add a consumer to diagnostics engine

Contributed by dmikis (Kirill Dmitrenko)!

Otherwise problems like trying to format readonly file in-place led to crashes.

I've added reviewers by looking at `git blame` and other reviews to the changed file, so may have missed someone.

Reviewed By: krasimir

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

4 years ago[VE] Add missing vector regression test
Kazushi (Jam) Marukawa [Wed, 28 Oct 2020 11:13:45 +0000 (20:13 +0900)]
[VE] Add missing vector regression test

I forgot to add a regression test for VMAXX instruction when I added
it.  So, I'm adding it now.

Reviewed By: simoll

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

4 years ago[VE] Add vector control instructions
Kazushi (Jam) Marukawa [Wed, 28 Oct 2020 11:11:40 +0000 (20:11 +0900)]
[VE] Add vector control instructions

Add LVL/SVL/SMVL/LVIX isntructions.  Add regression tests too.

Reviewed By: simoll

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

4 years ago[lldb] Correct --help output for qemu rootfs script
David Spickett [Tue, 27 Oct 2020 11:55:27 +0000 (11:55 +0000)]
[lldb] Correct --help output for qemu rootfs script

It was printing "Usage:" twice.

Reviewed By: omjavaid

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

4 years ago[lldb] Unbreak the build after a recent PowerPC change
David Zarzycki [Thu, 29 Oct 2020 09:53:47 +0000 (05:53 -0400)]
[lldb] Unbreak the build after a recent PowerPC change

40dd4d5233d9f81705a24d91b48d2620e487b89d introduced two new types.

4 years ago[SCEV][NFC] Use general predicate checkers in monotonicity check
Max Kazantsev [Thu, 29 Oct 2020 09:29:45 +0000 (16:29 +0700)]
[SCEV][NFC] Use general predicate checkers in monotonicity check

This makes the code more compact and readable.

4 years ago[yaml2obj] - Improve handling of SectionHeaderTable::NoHeaders flag.
Georgii Rymar [Wed, 28 Oct 2020 10:34:28 +0000 (13:34 +0300)]
[yaml2obj] - Improve handling of SectionHeaderTable::NoHeaders flag.

When `NoHeaders` is set, we still have following issues:
1) We emit the `.shstrtab` implicit section of size 1 (empty string table).
2) We still align the start of the section header table, what affects the output size.
3) We still write section header table bytes.

This patch fixes all of these issues.

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

4 years ago[InterleaveAccess] Recognise Interleave loads through binary operations
David Green [Thu, 29 Oct 2020 09:13:23 +0000 (09:13 +0000)]
[InterleaveAccess] Recognise Interleave loads through binary operations

Instcombine will currently sink identical shuffles though vector binary
operations. This is probably generally useful, but can break up the code
pattern we use to represent an interleaving load group. This patch
reverses that in the InterleaveAccessPass to re-recognise the pattern of
shuffles sunk past binary operations and folds them back if an
interleave group can be created.

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

4 years ago[CMake] Support inter-proto dependencies in generate_protos.
Sam McCall [Tue, 27 Oct 2020 09:58:34 +0000 (10:58 +0100)]
[CMake] Support inter-proto dependencies in generate_protos.

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

4 years ago[NFC][SCEV] Refactor monotonic predicate checks to return enums instead of bools
Max Kazantsev [Thu, 29 Oct 2020 08:27:21 +0000 (15:27 +0700)]
[NFC][SCEV] Refactor monotonic predicate checks to return enums instead of bools

This patch gets rid of output parameter which is not needed for most users
and prepares this API for further refactoring.

4 years ago[clangd] Support CodeActionParams.only
Sam McCall [Fri, 9 Oct 2020 13:17:26 +0000 (15:17 +0200)]
[clangd] Support CodeActionParams.only

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

4 years agoRevert "[NFC][TSAN] Logs to debug test script on bot"
Vitaly Buka [Thu, 29 Oct 2020 08:09:39 +0000 (01:09 -0700)]
Revert "[NFC][TSAN] Logs to debug test script on bot"

Done with debugging. Script didn't work because of low limit on open
files on the bot.

This reverts commit 220293da53b5049ded67b1a251bd85069fa068e7.

4 years ago[mlir][gpu] Fix leaked stream and module when lowering gpu.launch_func to runtime...
Christian Sigg [Thu, 29 Oct 2020 07:17:27 +0000 (08:17 +0100)]
[mlir][gpu] Fix leaked stream and module when lowering gpu.launch_func to runtime calls.

Reviewed By: mehdi_amini

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

4 years ago[llvm-objdump][test] - Stop using precompiled binary in MachO/disassemble-g-dsym...
Georgii Rymar [Wed, 28 Oct 2020 15:11:28 +0000 (18:11 +0300)]
[llvm-objdump][test] - Stop using precompiled binary in MachO/disassemble-g-dsym.test

This removes Inputs/libbogus11.a

Initially I've removed it in D90013, but had to restore it, because BB found this
test is using it.

I've updated the test to use YAMLs, added comment and one more possible error check.

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

4 years ago[libFuzzer] Remove InterruptHandler from Fuchsia implementation
Cameron Finucane [Thu, 29 Oct 2020 06:47:38 +0000 (23:47 -0700)]
[libFuzzer] Remove InterruptHandler from Fuchsia implementation

As implemented, the `InterruptHandler` thread was spinning trying to
`select()` on a null "stdin", wasting a significant amount of CPU for no
benefit. As Fuchsia does not have a native concept of stdin (or POSIX
signals), this commit simply removes this feature entirely.

Reviewed By: aarongreen

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

4 years ago[Reassociate][test] Delete improper -NOT patterns to work with -enable-new-pm=1
Fangrui Song [Thu, 29 Oct 2020 06:58:31 +0000 (23:58 -0700)]
[Reassociate][test] Delete improper -NOT patterns to work with -enable-new-pm=1

The two tests rely on LegacyInlinerBase::doFinalization to remove
Function::isDefTriviallyDead() functions. The new PM does not have the behavior.
The -NEXT patterns checking the emptiness are actually sufficient.

Note, reassociate-deadinst.ll has become stale - it no longer catches
the problem r285380 intended. Unfortunately it is difficult to craft a
new test because it is actually pretty difficult to break it with
`MadeChange = true;` all over the file.

4 years ago[FPEnv] Tests for rounding properties of constant evalution
Serge Pavlov [Fri, 23 Oct 2020 11:36:16 +0000 (18:36 +0700)]
[FPEnv] Tests for rounding properties of constant evalution

These are moved from D88498.

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

4 years ago[opt] Pin -stats-json & -opt-bisect-limit tests to -enable-new-pm=0
Fangrui Song [Thu, 29 Oct 2020 05:58:20 +0000 (22:58 -0700)]
[opt] Pin -stats-json & -opt-bisect-limit tests to -enable-new-pm=0

-stats-json requires `TimeReagion PassTimer(getPassTimer(...))` in the legacy
PM. The loss of functionality is not critical because we have the similar -time-passes.

4 years ago[Attributor][NFC] Rerun update test script
Johannes Doerfert [Thu, 29 Oct 2020 05:38:40 +0000 (00:38 -0500)]
[Attributor][NFC] Rerun update test script

4 years ago[Attributor][FIX] Properly promote arguments pointers to arrays
Johannes Doerfert [Thu, 29 Oct 2020 05:13:27 +0000 (00:13 -0500)]
[Attributor][FIX] Properly promote arguments pointers to arrays

When we promote pointer arguments we did compute a wrong offset and use
a wrong type for the array case.

Bug reported and reduced by Whitney Tsang <whitneyt@ca.ibm.com>.

4 years ago[mlir][SymbolTable] Small optimization to walking symbol references
River Riddle [Thu, 29 Oct 2020 05:00:55 +0000 (22:00 -0700)]
[mlir][SymbolTable] Small optimization to walking symbol references

* Check region count for unknown symbol tables first, as it is a faster check
* Add an accessor to MutableDictionaryAttr to get the internal dictionary without creating a new one if it is empty. This avoids an otherwise unnecessary lookup of an MLIRContext.

4 years ago[mlir][Inliner] Add a `wouldBeCloned` flag to each of the `isLegalToInline` hooks.
River Riddle [Thu, 29 Oct 2020 04:48:48 +0000 (21:48 -0700)]
[mlir][Inliner] Add a `wouldBeCloned` flag to each of the `isLegalToInline` hooks.

Often times the legality of inlining can change depending on if the callable is going to be inlined in-place, or cloned. For example, some operations are not allowed to be duplicated and can only be inlined if the original callable will cease to exist afterwards. The new `wouldBeCloned` flag allows for dialects to hook into this when determining legality.

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

4 years ago[mlir][Inliner] Add a new hook for checking if it is legal to inline a callable into...
River Riddle [Thu, 29 Oct 2020 04:48:38 +0000 (21:48 -0700)]
[mlir][Inliner] Add a new hook for checking if it is legal to inline a callable into a call

In certain situations it isn't legal to inline a call operation, but this isn't something that is possible(at least not easily) to prevent with the current hooks. This revision adds a new hook so that dialects with call operations that shouldn't be inlined can prevent it.

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

4 years ago[NFC][clang][AVR] Add more devices
Ben Shi [Thu, 29 Oct 2020 03:49:21 +0000 (11:49 +0800)]
[NFC][clang][AVR] Add more devices

Reviewed By: dylanmckay

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

4 years ago[NFC][AVR] Improve device list
Ben Shi [Thu, 29 Oct 2020 02:54:17 +0000 (10:54 +0800)]
[NFC][AVR] Improve device list

Reviewed By: dylanmckay

https://reviews.llvm.org/D87968

4 years ago[Debugify] Move global namespace functions into llvm::
Fangrui Song [Thu, 29 Oct 2020 02:11:19 +0000 (19:11 -0700)]
[Debugify] Move global namespace functions into llvm::

Also move exportDebugifyStats from tools/opt to Debugify.cpp

4 years agoRevert "[DebugInfo] Fix legacy ZExt emission when FromBits >= 64 (PR47927)"
Vedant Kumar [Thu, 29 Oct 2020 01:55:46 +0000 (18:55 -0700)]
Revert "[DebugInfo] Fix legacy ZExt emission when FromBits >= 64 (PR47927)"

This reverts commit 99053462216cf835eb3ae063942c618d9609de87.

It breaks the compiler-rt build, see https://reviews.llvm.org/D89838

4 years agoRevert "[DebugInfo] Shorten legacy [s|z]ext dwarf expressions"
Vedant Kumar [Thu, 29 Oct 2020 01:55:37 +0000 (18:55 -0700)]
Revert "[DebugInfo] Shorten legacy [s|z]ext dwarf expressions"

This reverts commit 2ce36ebca544dd71075a7818ff4070da5667603b. It depends
on https://reviews.llvm.org/D89838, which needs to be reverted.

4 years ago[ThinLTO] Fix .llvmcmd emission
Mircea Trofin [Wed, 28 Oct 2020 00:22:30 +0000 (17:22 -0700)]
[ThinLTO] Fix .llvmcmd emission

llvm::EmbedBitcodeInModule needs (what used to be called) EmbedMarker
set, in order to emit .llvmcmd. EmbedMarker is really about embedding the
command line, so renamed the parameter accordingly, too.

This was not caught at test because the check-prefix was incorrect, but
FileCheck does not report that when multiple prefixes are provided. A
separate patch will address that.

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

4 years ago [WebAssembly] Add support for DWARF type units
Derek Schuff [Thu, 29 Oct 2020 00:15:58 +0000 (17:15 -0700)]
[WebAssembly] Add support for DWARF type units

    Since Wasm comdat sections work similarly to ELF, we can use that mechanism
    to eliminate duplicate dwarf type information in the same way.

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

4 years ago[mlir] Convert raw data in dense element attributes for big-endian machines.
Haruki Imai [Thu, 29 Oct 2020 00:05:32 +0000 (17:05 -0700)]
[mlir] Convert raw data in dense element attributes for big-endian machines.

This patch fixes a bug [[ https://bugs.llvm.org/show_bug.cgi?id=46091 | 46091 ]]

Raw data for the `dense-element attribute` is written in little endian (LE) format.
This commit converts the format to big endian (BE) in ʻAttribute Parser` on the
 BE machine. Also, when outputting on a BE machine, the BE format is converted
 to LE in "AsmPrinter".

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

4 years ago[mlir] Optimize the parsing of ElementsAttr hex strings
River Riddle [Wed, 28 Oct 2020 23:46:38 +0000 (16:46 -0700)]
[mlir] Optimize the parsing of ElementsAttr hex strings

This revision optimizes the parsing of hex strings by using the checked variant of llvm::fromHex, and adding a specialized method to Token for extracting hex strings. This leads a large decrease in compile time when parsing large hex constants (one example: 2.6 seconds -> 370 miliseconds)

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

4 years ago[llvm][StringExtras] Use a lookup table for `hexDigitValue`
River Riddle [Wed, 28 Oct 2020 23:46:31 +0000 (16:46 -0700)]
[llvm][StringExtras] Use a lookup table for `hexDigitValue`

This method is at the core of the conversion from hex to binary, and using a lookup table great improves the compile time of hex conversions.

Context: In MLIR we use hex strings to represent very large constants in the textual format of the IR. These changes lead to a large decrease in compile time when parsing these constants (>1 second -> 350 miliseconds).

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

4 years ago[llvm][StringExtras] Add a fail-able version of `fromHex`
River Riddle [Wed, 28 Oct 2020 23:46:25 +0000 (16:46 -0700)]
[llvm][StringExtras] Add a fail-able version of `fromHex`

This revision adds a fail-able/checked version of `fromHex` that fails when the input string contains a non-hex character. This removes the need for users to have a separate check for if the string contains all hex digits. This becomes very costly for large hex strings given that checking if a string contains only hex digits is effectively the same as just converting it in the first place.

Context: In MLIR we use hex strings to represent very large constants in the textual format of the IR. These changes lead to a large decrease in compile time when parsing these constants (2 seconds -> 1 second).

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

4 years agoRevert "[AppleObjCRuntimeV2] Force lazily allocated class names to be resolved."
Jonas Devlieghere [Wed, 28 Oct 2020 23:22:15 +0000 (16:22 -0700)]
Revert "[AppleObjCRuntimeV2] Force lazily allocated class names to be resolved."

We're no longer convinced that this is needed and we have no test
coverage to disprove that. Backing out of this change until we're
convinced otherwise.

4 years ago[VE] Add vector mask operation instructions
Kazushi (Jam) Marukawa [Wed, 28 Oct 2020 04:00:21 +0000 (13:00 +0900)]
[VE] Add vector mask operation instructions

Add VFMK/VFMS/VFMF/ANDM/ORM/XORM/EQVM/NNDM/NEGM/PCVM/LZVM/TOVM
isntructions.  Add regression tests too.  Also add new patterns
to parse VFMK/VFMS/VFMF mnemonics.

Reviewed By: simoll

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

4 years agoRecommit "[CodeView] Emit static data members as S_CONSTANTs."
Amy Huang [Tue, 27 Oct 2020 18:35:57 +0000 (11:35 -0700)]
Recommit "[CodeView] Emit static data members as S_CONSTANTs."

We used to only emit static const data members in CodeView as
S_CONSTANTS when they were used; this patch makes it so they are always emitted.

This changes CodeViewDebug.cpp to find the static const members from the
class debug info instead of creating DIGlobalVariables in the IR
whenever a static const data member is used.

Bug: https://bugs.llvm.org/show_bug.cgi?id=47580

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

This reverts commit 504615353f31136dd6bf7a971b6c236fd70582be.

4 years ago[AMDGPU] Add Reset function to GCNHazardRecognizer
Austin Kerbow [Wed, 28 Oct 2020 21:38:41 +0000 (14:38 -0700)]
[AMDGPU] Add Reset function to GCNHazardRecognizer

Reset the tracked emitted instructions when starting scheduling on a new
region.

Reviewed By: rampitec

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

4 years agoMake the post-commit review expectations more explicit with respect to revert
Mehdi Amini [Wed, 28 Oct 2020 23:28:36 +0000 (23:28 +0000)]
Make the post-commit review expectations more explicit with respect to revert

See  http://lists.llvm.org/pipermail/llvm-dev/2016-March/096529.html for
context.

Reviewed By: silvas, rengolin, echristo, dexonsmith, gribozavr2

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

4 years ago[Sema] adds basic -Wfree-nonheap-object functionality
Christopher Di Bella [Wed, 28 Oct 2020 23:16:17 +0000 (16:16 -0700)]
[Sema] adds basic -Wfree-nonheap-object functionality

Checks to make sure that stdlib's (std::)free is being appropriately
used. Presently checks for the following misuses:

- free(&stack_object)
- free(stack_array)

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

4 years agoModuleManager: Simplify lookupModuleFile by only setting the out parameter once, NFC
Duncan P. N. Exon Smith [Tue, 20 Oct 2020 22:53:51 +0000 (18:53 -0400)]
ModuleManager: Simplify lookupModuleFile by only setting the out parameter once, NFC

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

4 years ago[NFC] Use [MC]Register in CSE & LICM
Gaurav Jain [Wed, 28 Oct 2020 17:37:15 +0000 (10:37 -0700)]
[NFC] Use [MC]Register in CSE & LICM

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

4 years agoReland "hwasan: Disable operator {new,delete} interceptors when interceptors are...
Peter Collingbourne [Tue, 20 Oct 2020 21:36:34 +0000 (14:36 -0700)]
Reland "hwasan: Disable operator {new,delete} interceptors when interceptors are disabled."

There was a discrepancy in the gn build which is now fixed.

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

4 years agogn build: Define HWASAN_WITH_INTERCEPTORS=1 for hwasan_new_delete.cpp as well.
Peter Collingbourne [Wed, 28 Oct 2020 22:41:44 +0000 (15:41 -0700)]
gn build: Define HWASAN_WITH_INTERCEPTORS=1 for hwasan_new_delete.cpp as well.

4 years agoFix includes in llvm/Support/FileSystem/UniqueID.h after 23ed570af1cc165afea1b70a533a...
Duncan P. N. Exon Smith [Wed, 28 Oct 2020 22:39:14 +0000 (18:39 -0400)]
Fix includes in llvm/Support/FileSystem/UniqueID.h after 23ed570af1cc165afea1b70a533a4a39d6656501

Not sure why this worked for me, but some of the bots pointed out I
copied the wrong includes from FileSystem.h in
23ed570af1cc165afea1b70a533a4a39d6656501. Fixed.

4 years ago[Sema] Let getters assert that trailing return type exists, NFCI
Aaron Puchert [Wed, 28 Oct 2020 22:29:41 +0000 (23:29 +0100)]
[Sema] Let getters assert that trailing return type exists, NFCI

This was requested in the review of D90129.

4 years agoBetter source location for -Wignored-qualifiers on trailing return types
Aaron Puchert [Wed, 28 Oct 2020 22:23:09 +0000 (23:23 +0100)]
Better source location for -Wignored-qualifiers on trailing return types

We collect the source location of a trailing return type in the parser,
improving the location for regular functions and providing a location
for lambdas, where previously there was none.

Fixes PR47732.

Reviewed By: aaron.ballman

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

4 years ago[llvm-install-name-tool] Quote passed rpath args in error messages
Keith Smiley [Wed, 28 Oct 2020 21:56:03 +0000 (14:56 -0700)]
[llvm-install-name-tool] Quote passed rpath args in error messages

This diff refactors error reporting to make it more clear
what arguments were passed to llvm-install-name-tool.

Test plan: make check-all

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

4 years agoC API: support scalable vectors
Craig Disselkoen [Wed, 28 Oct 2020 20:48:22 +0000 (16:48 -0400)]
C API: support scalable vectors

This adds support for scalable vector types in the C API and in
llvm-c-test, and also adds a test to ensure that llvm-c-test can properly
roundtrip operations involving scalable vectors.

While creating this diff, I discovered that the C API cannot properly roundtrip
_constant expressions_ involving shufflevector / scalable vectors, but that
seems to be a separate enough issue that I plan to address it in a future diff
(unless reviewers feel it should be addressed here).

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

4 years ago[GWP-ASan] Abstract the thread local variables access
Kostya Kortchinsky [Mon, 26 Oct 2020 21:54:22 +0000 (14:54 -0700)]
[GWP-ASan] Abstract the thread local variables access

In a similar fashion to D87420 for Scudo, this CL introduces a way to
get thread local variables via a platform-specific reserved TLS slot,
since Fuchsia doesn't support ELF TLS from the libc itself.

If needing to use this, a platform will have to define
`GWP_ASAN_HAS_PLATFORM_TLS_SLOT` and provide `gwp_asan_platform_tls_slot.h`
which will define a `uint64_t *getPlatformGwpAsanTlsSlot()` function
that will return the TLS word of storage.

I snuck in a couple of cleanup items as well, moving some static
functions to anonymous namespace for consistency.

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

4 years ago[AMDGPU] Allow some modifiers on VOP3B instructions
Jay Foad [Tue, 27 Oct 2020 12:29:11 +0000 (12:29 +0000)]
[AMDGPU] Allow some modifiers on VOP3B instructions

V_DIV_SCALE_F32/F64 are VOP3B encoded so they can't use the ABS src
modifier, but they can still use NEG and the usual output modifiers.

This partially reverts 3b99f12a4e6f "AMDGPU: Remove modifiers from v_div_scale_*".

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