platform/upstream/llvm.git
4 years ago[x86][CGP] add more tests for PR37426; NFC
Sanjay Patel [Fri, 15 May 2020 16:33:03 +0000 (12:33 -0400)]
[x86][CGP] add more tests for PR37426; NFC

This broke when we started canonicalizing more code to funnel shift.
See D79718 and D79827 for related test/transforms.

4 years ago[libc++] Do not rely on use_system_cxx_lib to specify the path of the library to...
Louis Dionne [Fri, 15 May 2020 15:33:59 +0000 (11:33 -0400)]
[libc++] Do not rely on use_system_cxx_lib to specify the path of the library to run against

This is already handled by setting cxx_runtime_root instead -- I don't
see a reason to have two ways of setting the runtime path of the library
we're running against.

4 years ago[X86] Move expansion of MASKPAIR16LOAD and MASKPAIR16STORE from X86MCInstLower to...
Craig Topper [Fri, 15 May 2020 07:21:02 +0000 (00:21 -0700)]
[X86] Move expansion of MASKPAIR16LOAD and MASKPAIR16STORE from X86MCInstLower to X86ExpandPseudo.

It makes more sense to turn these into real instructions
a little earlier in the pipeline.

I've made sure to adjust the memoperand so the spill/reload
comments are printed correctly.

4 years ago[x86][NFC] Apply clang-format to X86ISelLowering.h
Alexey Lapshin [Fri, 15 May 2020 11:46:59 +0000 (14:46 +0300)]
[x86][NFC] Apply clang-format to X86ISelLowering.h

Summary:
  Apply clang-format to X86ISelLowering.h

Reviewed by: aeubanks

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

4 years ago[Clang][BPF] implement __builtin_btf_type_id() builtin function
Yonghong Song [Sat, 15 Feb 2020 00:46:49 +0000 (16:46 -0800)]
[Clang][BPF] implement __builtin_btf_type_id() builtin function

Such a builtin function is mostly useful to preserve btf type id
for non-global data. For example,
   extern void foo(..., void *data, int size);
   int test(...) {
     struct t { int a; int b; int c; } d;
     d.a = ...; d.b = ...; d.c = ...;
     foo(..., &d, sizeof(d));
   }

The function "foo" in the above only see raw data and does not
know what type of the data is. In certain cases, e.g., logging,
the additional type information will help pretty print.

This patch implemented a BPF specific builtin
  u32 btf_type_id = __builtin_btf_type_id(param, flag)
which will return a btf type id for the "param".
flag == 0 will indicate a BTF local relocation,
which means btf type_id only adjusted when bpf program BTF changes.
flag == 1 will indicate a BTF remote relocation,
which means btf type_id is adjusted against linux kernel or
future other entities.

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

4 years ago[X86] Use getConstantOperandVal helper in a few places. NFC.
Simon Pilgrim [Fri, 15 May 2020 16:30:55 +0000 (17:30 +0100)]
[X86] Use getConstantOperandVal helper in a few places. NFC.

Avoid raw cast<ConstantSDNode> calls.

4 years ago[X86] getFauxShuffle - remove (unused) ISD::TRUNCATE shuffle decoding.
Simon Pilgrim [Fri, 15 May 2020 16:18:21 +0000 (17:18 +0100)]
[X86] getFauxShuffle - remove (unused) ISD::TRUNCATE shuffle decoding.

4 years ago[libc++] Fix broken Lit features based on __config_site macros
Louis Dionne [Fri, 15 May 2020 16:24:05 +0000 (12:24 -0400)]
[libc++] Fix broken Lit features based on __config_site macros

Because of Python's funny scoping rules with lambdas, we were always
using the value of `macro` as set in the last iteration of the loop.
This problem was introduced by e7bdfba4f00d.

4 years ago[libc++] Segregate back-deployment dylibs into their own subdirectory
Louis Dionne [Fri, 15 May 2020 16:13:48 +0000 (12:13 -0400)]
[libc++] Segregate back-deployment dylibs into their own subdirectory

Otherwise, specifying (for example) the libc++.dylib from macos10.13
but the libc++abi.dylib from macos10.12 would end up adding library
paths for both the 10.12 and 10.13 dylibs, which would each contain
a copy of both libc++abi.dylib and libc++.dylib. By using a separate
directory for libc++.dylib and libc++abi.dylib, those do not conflict
anymore.

The back-deployment roots were updated to match this change.

4 years ago[ARM][MVE] Add support for incrementing scatters
Anna Welker [Fri, 15 May 2020 14:29:12 +0000 (15:29 +0100)]
[ARM][MVE] Add support for incrementing scatters

Adds support to build pre-incrementing scatters.
If the increment (i.e., add instruction) that is merged into
the scatter is the loop increment, an incrementing write-back
scatter can be built, which then assumes the role of the loop
increment.

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

4 years ago[ELF] Use namespace qualifiers (lld:: or elf::) instead of `namespace lld { namespace...
Fangrui Song [Fri, 15 May 2020 05:18:58 +0000 (22:18 -0700)]
[ELF] Use namespace qualifiers (lld:: or elf::) instead of `namespace lld { namespace elf {`

Similar to D74882. This reverts much code from commit
bd8cfe65f5fee4ad573adc2172359c9552e8cdc0 (D68323) and fixes some
problems before D68323.

Sorry for the churn but D68323 was a mistake. Namespace qualifiers avoid
bugs where the definition does not match the declaration from the
header. See
https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions (D74515)

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

4 years ago[libc++] Centralize where we set the libc++ and libc++abi paths in config.py
Louis Dionne [Fri, 15 May 2020 15:18:49 +0000 (11:18 -0400)]
[libc++] Centralize where we set the libc++ and libc++abi paths in config.py

It's just confusing to have them all over the place.

4 years ago[VectorUtils] Expose vector-function-abi-variant mangling as a utility.
Anna Thomas [Wed, 13 May 2020 15:01:23 +0000 (11:01 -0400)]
[VectorUtils] Expose vector-function-abi-variant mangling as a utility.

Summary:
This change exposes the vector name mangling with LLVM ISA (used as part
of vector-function-abi-variant) as a utility.
This can then be used by front-ends that add this attribute.
Note that all parameters passed in to the function will be mangled with
the "v" token to identify that they are of of vector type. So, it is the
responsibility of the caller to confirm that all parameters in the
vectorized variant is of vector type.

Added unit test to show vector name mangling.

Reviewed-By: fpetrogalli, simoll
Differential Revision: https://reviews.llvm.org/D79867

4 years ago[ARM][MachineOutliner] Fix memory leak #2.
Yvan Roux [Fri, 15 May 2020 15:31:55 +0000 (17:31 +0200)]
[ARM][MachineOutliner] Fix memory leak #2.

Use smart pointer instead of new/delete.

4 years ago[gn build] Port 6b01b465388
LLVM GN Syncbot [Fri, 15 May 2020 15:13:18 +0000 (15:13 +0000)]
[gn build] Port 6b01b465388

4 years ago[BPF] preserve debuginfo types for builtin __builtin__btf_type_id()
Yonghong Song [Wed, 12 Feb 2020 00:55:22 +0000 (16:55 -0800)]
[BPF] preserve debuginfo types for builtin __builtin__btf_type_id()

The builtin function
  u32 btf_type_id = __builtin_btf_type_id(param, 0)
can help preserve type info for the following use case:
  extern void foo(..., void *data, int size);
  int test(...) {
    struct t { int a; int b; int c; } d;
    d.a = ...; d.b = ...; d.c = ...;
    foo(..., &d, sizeof(d));
  }

The function "foo" in the above only see raw data and does not
know what type of the data is. In certain cases, e.g., logging,
the additional type information will help pretty print.

This patch handles the builtin in BPF backend. It includes
an IR pass to translate the IR intrinsic to a load of
a global variable which carries the metadata, and an MI
pass to remove the intermediate load of the global variable.
Finally, in AsmPrinter pass, proper instruction are generated.

In the above example, the second argument for __builtin_btf_type_id()
is 0, which means a relocation for local adjustment,
i.e., w.r.t. bpf program BTF change,  will be generated.
The value 1 for the second argument means
a relocation for remote adjustment, e.g., against vmlinux.

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

4 years ago[AMDGPU] Fix assertion failure in SIInsertHardClauses
Jay Foad [Fri, 15 May 2020 13:36:00 +0000 (14:36 +0100)]
[AMDGPU] Fix assertion failure in SIInsertHardClauses

This new pass failed an assertion whenever there were s_nops after the
end of clause.

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

4 years ago[clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set
Francois Ferrand [Mon, 22 May 2017 09:23:08 +0000 (11:23 +0200)]
[clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set

Summary:
Even when BreakBeforeBinaryOperators is set, AlignOperands kept
aligning the beginning of the line, even when it could align the
actual operands (e.g. after an assignment).

With this patch, the operands are actually aligned, and the operator
gets aligned with the equal sign:

  int aaaaa = bbbbbb
            + cccccc;

This not happen in tests, to avoid 'breaking' the indentation:

  if (aaaaa
      && bbbbb)
    return;

Reviewers: krasimir, djasper, klimek, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: MyDeveloperDay, acoomans, cfe-commits, klimek

Tags: #clang, #clang-format

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

4 years agoclang-format: support aligned nested conditionals formatting
Francois Ferrand [Thu, 23 Apr 2020 13:56:47 +0000 (15:56 +0200)]
clang-format: support aligned nested conditionals formatting

Summary:
When multiple ternary operators are chained, e.g. like an if/else-if/
else-if/.../else sequence, clang-format will keep aligning the colon
with the question mark, which increases the indent for each
conditionals:

  int a = condition1 ? result1
                     : condition2 ? result2
                                  : condition3 ? result3
                                               : result4;

This patch detects the situation (e.g. conditionals used in false branch
of another conditional), to avoid indenting in that case:

  int a = condition1 ? result1
        : condition2 ? result2
        : condition3 ? result3
                     : result4;

When BreakBeforeTernaryOperators is false, this will format like this:

  int a = condition1 ? result1 :
          condition2 ? result2 :
          conditino3 ? result3 :
                       result4;

This formatting style is referenced here:
https://www.fluentcpp.com/2018/02/27/replace-else-if-ternary-operator/
and here:
https://marcmutz.wordpress.com/2010/10/14/top-5-reasons-you-should-love-your-ternary-operator/

Reviewers: krasimir, djasper, klimek, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: hokein, dyung, MyDeveloperDay, acoomans, cfe-commits

Tags: #clang, #clang-format

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

4 years agoRe-land [Debug][CodeView] Emit fully qualified names for globals
Alexandre Ganea [Fri, 15 May 2020 14:36:27 +0000 (10:36 -0400)]
Re-land [Debug][CodeView] Emit fully qualified names for globals

Before this patch, S_[L|G][THREAD32|DATA32] records were emitted with a simple name, not the fully qualified name (namespace + class scope).

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

4 years agoFix Linux build broken by f06e6564
James Henderson [Fri, 15 May 2020 14:35:52 +0000 (15:35 +0100)]
Fix Linux build broken by f06e6564

4 years ago[ARM][MachineOutliner] Fix memory leak.
Yvan Roux [Fri, 15 May 2020 14:21:20 +0000 (16:21 +0200)]
[ARM][MachineOutliner] Fix memory leak.

Fix sanitizer bots after 0e4827aa4e4ae25813f66d3b872db67d93813009

4 years ago[llvm-readobj] Implement --dependent-libraries for GNU output
James Henderson [Thu, 14 May 2020 12:48:13 +0000 (13:48 +0100)]
[llvm-readobj] Implement --dependent-libraries for GNU output

Previously, the option was only implemented for LLVM output. This fixes
https://bugs.llvm.org/show_bug.cgi?id=45695.

At the current time, GNU readelf does not support this option.
Consequently, this patch simply attempts to roughly follow the output
style for similar options like --syms/--notes etc, combined with
--string-dump output.

Reviewed by: MaskRay, grimar

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

4 years ago[TSAN] Add option to allow instrumenting reads of reads-before-writes
Dmitry Vyukov [Fri, 15 May 2020 12:14:18 +0000 (14:14 +0200)]
[TSAN] Add option to allow instrumenting reads of reads-before-writes

Add -tsan-instrument-read-before-write which allows instrumenting reads
of reads-before-writes.

This is required for KCSAN [1], where under certain configurations plain
writes behave differently (e.g. aligned writes up to word size may be
treated as atomic). In order to avoid missing potential data races due
to plain RMW operations ("x++" etc.), we will require instrumenting
reads of reads-before-writes.

[1] https://github.com/google/ktsan/wiki/KCSAN

Author: melver (Marco Elver)
Reviewed-in: https://reviews.llvm.org/D79983

4 years ago[CodeGen] Fix FoldConstantVectorArithmetic for scalable vectors
David Sherwood [Wed, 6 May 2020 07:03:15 +0000 (08:03 +0100)]
[CodeGen] Fix FoldConstantVectorArithmetic for scalable vectors

For now I have changed FoldConstantVectorArithmetic to return early
if we encounter a scalable vector, since the subsequent code assumes
you can perform lane-wise constant folds. However, in future work we
should be able to extend this to look at splats of a constant value
and fold those if possible. I have also added the same code to
FoldConstantArithmetic, since that deals with vectors too.

The warnings I fixed in this patch were being generated by this
existing test:

  CodeGen/AArch64/sve-int-arith.ll

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

4 years ago[IR][BFloat] Add BFloat IR type
Ties Stuij [Tue, 31 Mar 2020 22:49:38 +0000 (23:49 +0100)]
[IR][BFloat] Add BFloat IR type

Summary:
The BFloat IR type is introduced to provide support for, initially, the BFloat16
datatype introduced with the Armv8.6 architecture (optional from Armv8.2
onwards). It has an 8-bit exponent and a 7-bit mantissa and behaves like an IEEE
754 floating point IR type.

This is part of a patch series upstreaming Armv8.6 features. Subsequent patches
will upstream intrinsics support and C-lang support for BFloat.

Reviewers: SjoerdMeijer, rjmccall, rsmith, liutianle, RKSimon, craig.topper, jfb, LukeGeeson, sdesmalen, deadalnix, ctetreau

Subscribers: hiraditya, llvm-commits, danielkiss, arphaman, kristof.beyls, dexonsmith

Tags: #llvm

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

4 years agoAdd MSVC natvis visualisation of llvm::Type
Machiel van Hooren [Fri, 15 May 2020 13:38:37 +0000 (09:38 -0400)]
Add MSVC natvis visualisation of llvm::Type

llvm::Type has some difficult to decode member variables with different meanings
depending on the TypeID. Specifically SubclassData and ContainedTys. This natvis
visualisation decodes and visualises those members.

4 years ago[clang-format] C# property formatting can be controlled by config options
Jonathan Coe [Fri, 15 May 2020 12:55:48 +0000 (13:55 +0100)]
[clang-format] C# property formatting can be controlled by config options

Summary:
Allow brace wrapping in C# property accessors to be controlled by configuration options.

Add new tests and revert old test results for Microsoft style to their previous state (as intended).

`FormatStyle.BraceWrapping.AfterFunction = true;` will change automatic property formatting from

```
Type MyType { get; set }
```

to

```
Type MyType
{ get; set }
```

Reviewers: krasimir, MyDeveloperDay

Reviewed By: krasimir, MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang-format, #clang

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

4 years ago[NFC][ARM] Intrinsic CostModel Tests
Sam Parker [Fri, 15 May 2020 12:36:44 +0000 (13:36 +0100)]
[NFC][ARM] Intrinsic CostModel Tests

Add throughput tests for saturating, overflowing and reduction
operations.

4 years ago[libc++] [span] [P1976] Update status page. NFC
Marek Kurdej [Fri, 15 May 2020 12:29:14 +0000 (14:29 +0200)]
[libc++] [span] [P1976] Update status page. NFC

It was implemented by commit 6d2599e4f776d0cd88438cb82a00c4fc25cc3f67 "[libcxx][span] Implement P1976R2".

4 years ago[MLIR] Add shape.witness type and ops
Tres Popp [Thu, 7 May 2020 12:24:30 +0000 (14:24 +0200)]
[MLIR] Add shape.witness type and ops

Summary: These represent shape based preconditions on execution of code.

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

4 years agoDAGCombiner.cpp - remove non-constant EXTRACT_SUBVECTOR/INSERT_SUBVECTOR handling...
Simon Pilgrim [Fri, 15 May 2020 11:41:22 +0000 (12:41 +0100)]
DAGCombiner.cpp - remove non-constant EXTRACT_SUBVECTOR/INSERT_SUBVECTOR handling. NFC.

Now that D79814 has landed, we can assume that subvector ops use constant, in-range indices.

4 years ago[GlobalISel][InlineAsm] Add early return for memory inputs that need to be indirectified
Konstantin Schwarz [Fri, 15 May 2020 08:13:53 +0000 (10:13 +0200)]
[GlobalISel][InlineAsm] Add early return for memory inputs that need to be indirectified

Summary:
D78319 introduced basic support for inline asm input operands in GlobalISel.
However, that patch did not handle the case where a memory input operand still needs to
be indirectified. Later code asserts that the memory operand is already indirect.

This patch adds an early return false to trigger the SelectionDAG fallback for now.

Reviewers: arsenm, paquette

Reviewed By: arsenm

Subscribers: thakis, wdng, rovka, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[analyzer] SATestBuild.py: Fix handling invalid plists after 2to3 conversion.
Artem Dergachev [Fri, 15 May 2020 11:27:30 +0000 (14:27 +0300)]
[analyzer] SATestBuild.py: Fix handling invalid plists after 2to3 conversion.

The updated plistlib throws a different exception class.

4 years ago[clang-tidy] Fix assertion in RenamerClangTidyChecks
Nathan James [Fri, 15 May 2020 11:15:35 +0000 (12:15 +0100)]
[clang-tidy] Fix assertion in RenamerClangTidyChecks

4 years agoX86ISelLowering.cpp - remove non-constant EXTRACT_SUBVECTOR/INSERT_SUBVECTOR handling...
Simon Pilgrim [Fri, 15 May 2020 10:41:04 +0000 (11:41 +0100)]
X86ISelLowering.cpp - remove non-constant EXTRACT_SUBVECTOR/INSERT_SUBVECTOR handling. NFC.

Now that D79814 has landed, we can assume that subvector ops use constant, in-range indices.

4 years ago[lldb] Fixup command-disassemble-process.yaml test
Pavel Labath [Fri, 15 May 2020 10:35:44 +0000 (12:35 +0200)]
[lldb] Fixup command-disassemble-process.yaml test

Increase the function size to account for the changed threshold in
8b845ac5edc1.

4 years ago[DebugInfo] - DWARFDebugFrame: do not call abort() on errors.
Georgii Rymar [Thu, 30 Apr 2020 08:36:54 +0000 (11:36 +0300)]
[DebugInfo] - DWARFDebugFrame: do not call abort() on errors.

Imagine we have a broken .eh_frame.
Below is a possible sample output of llvm-readelf:

```
...
    entry 2 {
      initial_location: 0x10f5
      address: 0x2080
    }
  }
}
.eh_frame section at offset 0x2028 address 0x2028:
LLVM ERROR: Parsing entry instructions at 0 failed
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.  Program arguments: /home/umb/LLVM/LLVM/llvm-project/build/bin/llvm-readelf -a 1
 #0 0x000055f4a2ff5a1a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/umb/LLVM/LLVM/llvm-project/build/bin/llvm-readelf+0x2b9a1a)
...
#15 0x00007fdae5dc209b __libc_start_main /build/glibc-B9XfQf/glibc-2.28/csu/../csu/libc-start.c:342:3
#16 0x000055f4a2db746a _start (/home/umb/LLVM/LLVM/llvm-project/build/bin/llvm-readelf+0x7b46a)
Aborted
```

I.e. it calls abort(), suggests to submit a bug report and exits with the code 134.
This patch changes the logic to propagate errors to callers.
This fixes the behavior for llvm-dwarfdump, llvm-readobj and other possible tools.

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

4 years agoRecommit "[lldb] Don't dissasemble large functions by default"
Pavel Labath [Tue, 12 May 2020 15:14:20 +0000 (17:14 +0200)]
Recommit "[lldb] Don't dissasemble large functions by default"

This recommits f665e80c023 which was reverted in 1cbd1b8f692d for breaking
TestFoundationDisassembly.py. The fix is to use --force in the test to avoid
bailing out on large functions.

I have also doubled the large function limit to 8000 bytes (~~ 2000 insns), as
the foundation library contains a lot of large-ish functions. The intent of this
feature is to prevent accidental disassembling of enormous (multi-megabyte)
"functions", not to get in people's way.

The original commit message follows:

If we have a binary without symbol information (and without
LC_FUNCTION_STARTS, if on a mac), then we have to resort to using
heuristics to determine the function boundaries. However, these don't
always work, and so we can easily end up thinking we have functions
which are several megabytes in size. Attempting to (accidentally)
disassemble these can take a very long time spam the terminal with
thousands of lines of disassembly.

This patch works around that problem by adding a sanity check to the
disassemble command. If we are about to disassemble a function which is
larger than a certain threshold, we will refuse to disassemble such a
function unless the user explicitly specifies the number of instructions
to disassemble, uses start/stop addresses for disassembly, or passes the
(new) --force argument.

The threshold is currently fairly aggressive (4000 bytes ~~ 1000
instructions). If needed, we can increase it, or even make it
configurable.

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

4 years ago[LLD][ELF] - Fix section-alignment.test after yaml2obj change.
Georgii Rymar [Fri, 15 May 2020 08:45:42 +0000 (11:45 +0300)]
[LLD][ELF] - Fix section-alignment.test after yaml2obj change.

yaml2obj changed in rG7ccae2cece72. Previous version of the
yaml produced a different error and a 500mb binary.

4 years ago[GlobalISel] Update GIComplexOperandMatcher comment; NFC
Sven van Haastregt [Fri, 15 May 2020 08:46:28 +0000 (09:46 +0100)]
[GlobalISel] Update GIComplexOperandMatcher comment; NFC

Update a comment to account for 2deea1878ea ("[globalisel][tablegen]
Revise API for ComplexPattern operands to improve flexibility.",
2017-04-22).

4 years ago[mlir] Rename conversions involving ex-Loop dialect to mention SCF
Alex Zinenko [Thu, 14 May 2020 12:41:35 +0000 (14:41 +0200)]
[mlir] Rename conversions involving ex-Loop dialect to mention SCF

The following Conversions are affected: LoopToStandard -> SCFToStandard,
LoopsToGPU -> SCFToGPU, VectorToLoops -> VectorToSCF. Full file paths are
affected. Additionally, drop the 'Convert' prefix from filenames living under
lib/Conversion where applicable.

API names and CLI options for pass testing are also renamed when applicable. In
particular, LoopsToGPU contains several passes that apply to different kinds of
loops (`for` or `parallel`), for which the original names are preserved.

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

4 years ago[llvm-readobj] - --gnu-hash-table: do not crash when the GNU hash table goes past...
Georgii Rymar [Wed, 13 May 2020 12:06:01 +0000 (15:06 +0300)]
[llvm-readobj] - --gnu-hash-table: do not crash when the GNU hash table goes past the EOF.

We might have a scenario where a the `GbuHashTable` variable correctly points
to a place inside the file (we validate this fact early in `parseDynamicTable`),
but nbuckets/maskwords fields are broken in the way the code tries
to read the data past the EOF. This patch fixes the issue.

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

4 years ago[yaml2obj] - Introduce the "Offset" property for sections.
Georgii Rymar [Mon, 27 Apr 2020 08:46:49 +0000 (11:46 +0300)]
[yaml2obj] - Introduce the "Offset" property for sections.

Currently there is no good way to set a physical offset for a section:

* We have the `ShOffset` that allows to override the `sh_offset`, but
  it does not affect the real data written.
* We can use a `Filler` to create an artificial gap, but it is more like a hack
  rather than a proper solution for this problem.

This patch adds the `Offset` property which allows setting physical
offsets for sections.

It also generalizes the code, so that we set sh_offset field in one place

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

4 years ago[mlir] LinalgToStandard: add build dependency on MLIRPass
Alex Zinenko [Fri, 15 May 2020 08:20:04 +0000 (10:20 +0200)]
[mlir] LinalgToStandard: add build dependency on MLIRPass

This is supposed to resolve the build problem with shared libraries.

4 years ago[CSInfo][ISEL] Call site info generation support for Mips
Djordje Todorovic [Fri, 15 May 2020 07:24:02 +0000 (09:24 +0200)]
[CSInfo][ISEL] Call site info generation support for Mips

Debug entry values functionality provides debug information about
call sites and function parameters values at the call entry spot.
Condition for generating this type of information is
compiling with -g option and optimization level higher
than zero(-O0).

In ISEL phase, while lowering call instructions, collect info
about registers that forward arguments into following
function frame. We store such info into MachineFunction of
the caller function. This is used very late, when dumping DWARF
info about call site parameters.

The call site info is visible at MIR level, as callSites attribute
of MachineFunction. Also, when using unmodified parameter value
inside callee it could be described as DW_OP_entry_value expression.
To deal with callSites attribute, we should pass
-emit-call-site-info option to llc.

This patch enables functionality in clang frontend and adds
call site info generation support for MIPS targets
(mips, mipsel, mips64, mips64el).

Patch by Nikola Tesic

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

4 years ago[lldb] Print full Clang diagnostics when the ClangModulesDeclVendor fails to compile...
Raphael Isemann [Fri, 15 May 2020 07:29:38 +0000 (09:29 +0200)]
[lldb] Print full Clang diagnostics when the ClangModulesDeclVendor fails to compile a module

Summary:
When the ClangModulesDeclVendor currently fails it just prints very basic and often incomplete diagnostics without any source locations:
```
(lldb) p @import Foundation
error: while importing modules:
'foo/bar.h' file not found
could not build module 'Darwin'
[...]
```
or even just
```
(lldb) p @import Foundation
error: while importing modules:
could not build module 'Darwin'
[...]
```

These diagnostics help neither the user nor us with figuring out what is the reason for the failure.

This patch wires up a full TextDiagnosticPrinter in the ClangModulesDeclVendor and makes
sure we always return the error stream to the user when we fail to compile our modules.

Fixes rdar://63216849

Reviewers: aprantl, jdoerfert

Reviewed By: aprantl

Subscribers: JDevlieghere

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

4 years ago[Sema] Teach -Wcast-align to compute an accurate alignment using the
Akira Hatanaka [Mon, 23 Mar 2020 06:47:01 +0000 (23:47 -0700)]
[Sema] Teach -Wcast-align to compute an accurate alignment using the
alignment information on VarDecls in more cases

This commit improves upon https://reviews.llvm.org/D21099. The code that
computes the source alignment now understands array subscript
expressions, binary operators, derived-to-base casts, and several more
expressions.

rdar://problem/59242343

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

4 years ago[libcxx][span] trivial whitespace fix to test commit rights
Michael Schellenberger Costa [Fri, 15 May 2020 07:52:24 +0000 (09:52 +0200)]
[libcxx][span] trivial whitespace fix to test commit rights

Reviewers: #libc!, miscco

Reviewed By: miscco

Subscribers: broadwaylamb, libcxx-commits

Tags: #libc

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

4 years ago[SVE] Fix wrong usage of getNumElements() in matchIntrinsicType
David Sherwood [Tue, 5 May 2020 12:26:55 +0000 (13:26 +0100)]
[SVE] Fix wrong usage of getNumElements() in matchIntrinsicType

I have changed the ScalableVecArgument case in matchIntrinsicType
to create a new FixedVectorType. This means that the next case we
hit (Vector) will not assert when calling getNumElements(), since
we know that it's always a FixedVectorType. This is a temporary
measure for now, and it will be fixed properly in another patch
that refactors this code.

The changes are covered by this existing test:

CodeGen/AArch64/sve-intrinsics-fp-converts.ll

In addition, I have added a new test to ensure that we correctly
reject SVE intrinsics when called with fixed length vector types.

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

4 years ago[ELF] Update release notes and man page for LLD time-trace
Russell Gallop [Tue, 12 May 2020 10:54:18 +0000 (11:54 +0100)]
[ELF] Update release notes and man page for LLD time-trace

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

4 years ago[PowerPC] Add an intrinsic for Popcntb
Li Rong Yi [Fri, 15 May 2020 06:56:27 +0000 (06:56 +0000)]
[PowerPC] Add an intrinsic for Popcntb

Summary: This patch adds the intrinsic llvm.ppc.popcntb for the HW
instruction POPCNTB

Reviewed By: steven.zhang

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

4 years ago[NFC][test] Add missing ':' after 'CHECK'
Djordje Todorovic [Fri, 15 May 2020 07:09:48 +0000 (09:09 +0200)]
[NFC][test] Add missing ':' after 'CHECK'

Without the ':' the check command doesn't do anything.
This typo was introduced along with the commit for the D77789.

4 years agoFixed bot failure after ab699d78a26f147b
Sourabh Singh Tomar [Fri, 15 May 2020 06:57:57 +0000 (12:27 +0530)]
Fixed bot failure after ab699d78a26f147b

Added `target triple` to the test case, it was failing on
aarch64 bot:
http://lab.llvm.org:8011/builders/flang-aarch64-ubuntu/builds/97

4 years agoCorrect the argument list of command `breakpoint read`
Gongyu Deng [Fri, 15 May 2020 06:34:24 +0000 (08:34 +0200)]
Correct the argument list of command `breakpoint read`

Summary: Command `breakpoint read` should not accept breakpoint ids as
arguments, and in fact, it is not implemented to deal with breakpoint id
arguments either. So this patch is to correct the argument list of this
command so that the help text won't misguide users.

Reviewers: teemperor, JDevlieghere, jingham

Reviewed By: teemperor, JDevlieghere

Tags: #lldb

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

4 years ago[ARM][MachineOutliner] Add Machine Outliner support for ARM.
Yvan Roux [Fri, 15 May 2020 06:44:23 +0000 (08:44 +0200)]
[ARM][MachineOutliner] Add Machine Outliner support for ARM.

Enables Machine Outlining for ARM and Thumb2 modes.  This is the first
patch of the series which adds all the basic logic for the support, and
only handles tail-calls and thunks.

The outliner can be turned on by using clang -moutline option or -mllvm
-enable-machine-outliner one (like AArch64).

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

4 years agoFixed bot failure after 4042ada1c1fe4a9cd5
Sourabh Singh Tomar [Fri, 15 May 2020 06:31:51 +0000 (12:01 +0530)]
Fixed bot failure after 4042ada1c1fe4a9cd5

Added '-' in `mtriple` in test case
There was a bot failure due to this:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-debian/builds/6790

4 years ago[CodeGen] Refactor CreateStackTemporary
David Sherwood [Thu, 14 May 2020 10:18:31 +0000 (11:18 +0100)]
[CodeGen] Refactor CreateStackTemporary

I've created a new variant of CreateStackTemporary that takes
TypeSize and Align arguments, and made the older instances of
CreateStackTemporary call this new function. This refactoring is
in preparation for more patches in this area related to scalable
vectors and improving the alignment calculations.

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

4 years ago[DebugInfo] support for DW_AT_data_location in llvm
Alok Kumar Sharma [Fri, 15 May 2020 05:54:27 +0000 (11:24 +0530)]
[DebugInfo] support for DW_AT_data_location in llvm

This patch adds support for DWARF attribute DW_AT_data_location.

Summary:
Dynamic arrays in fortran are described by array descriptor and
data allocation address. Former is mapped to DW_AT_location and
later is mapped to DW_AT_data_location.

Testing:
unit test cases added (hand-written)
check llvm
check debug-info

Reviewed By: aprantl

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

4 years ago[NFCI] Removed '%' from llc in test case in ab699d78a26f147b
Sourabh Singh Tomar [Fri, 15 May 2020 05:50:52 +0000 (11:20 +0530)]
[NFCI] Removed '%' from llc in test case in ab699d78a26f147b

4 years ago[DebugInfo] llvm rejects DWARF operator DW_OP_push_object_address
Alok Kumar Sharma [Fri, 15 May 2020 05:28:29 +0000 (10:58 +0530)]
[DebugInfo] llvm rejects DWARF operator DW_OP_push_object_address

llvm rejects DWARF operator DW_OP_push_object_address.This DWARF
operator is needed for Flang to support allocatable array.

Summary:
Currently llvm rejects DWARF operator DW_OP_push_object_address.
below error is produced when llvm finds this operator.

[..]
invalid expression
!DIExpression(151)
warning: ignoring invalid debug info in pushobj.ll
[..]

There are some parts missing in support of this operator, need to
be completed.

Testing
-added a unit testcase
-check-debuginfo
-check-llvm

Reviewed By: aprantl

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

4 years agoRevert "[llvm][NFC] Cleanup uses of std::function in Inlining-related APIs"
Mircea Trofin [Fri, 15 May 2020 05:32:44 +0000 (22:32 -0700)]
Revert "[llvm][NFC] Cleanup uses of std::function in Inlining-related APIs"

This reverts commit 767db5be67cab5aa04d81227725765cad9620611.

4 years ago[llvm][NFC] Cleanup uses of std::function in Inlining-related APIs
Mircea Trofin [Thu, 14 May 2020 00:40:07 +0000 (17:40 -0700)]
[llvm][NFC] Cleanup uses of std::function in Inlining-related APIs

Summary:
Replacing uses of std::function pointers or refs, or Optional, to
function_ref, since the usage pattern allows that. If the function is
optional, using a default parameter value (nullptr). This led to a few
parameter reshufles, to push all optionals to the end of the parameter
list.

Reviewers: davidxl, dblaikie

Subscribers: arsenm, jvesely, nhaehnle, eraman, hiraditya, haicheng, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[mlir][GPUToSPIRV] Use default ABI only when none of the arguments
MaheshRavishankar [Fri, 15 May 2020 04:47:50 +0000 (21:47 -0700)]
[mlir][GPUToSPIRV] Use default ABI only when none of the arguments
have abi attributes.

To ensure there is no conflict, use the default ABI only when none of
the arguments have the spv.interface_var_abi attribute. This also
implies that if one of the arguments has a spv.interface_var_abi
attribute, all of them should have it as well.

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

4 years ago[mlir][Linalg] Start a LinalgToStandard pass and move conversion to library calls.
Nicolas Vasilache [Fri, 15 May 2020 04:22:21 +0000 (00:22 -0400)]
[mlir][Linalg] Start a LinalgToStandard pass and move conversion to library calls.

This revision starts decoupling the include the kitchen sink behavior of Linalg to LLVM lowering by inserting a -convert-linalg-to-std pass.

The lowering of linalg ops to function calls was previously lowering to memref descriptors by having both linalg -> std and std -> LLVM patterns in the same rewrite.

When separating this step, a new issue occurred: the layout is automatically type-erased by this process. This revision therefore introduces memref casts to perform these type erasures explicitly. To connect everything end-to-end, the LLVM lowering of MemRefCastOp is relaxed because it is artificially more restricted than the op semantics. The op semantics already guarantee that source and target MemRefTypes are cast-compatible. An invalid lowering test now becomes valid and is removed.

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

4 years agoSpeculative fix for build breakage from D78403
Hubert Tong [Fri, 15 May 2020 03:57:22 +0000 (23:57 -0400)]
Speculative fix for build breakage from D78403

D78403 appears responsible for breaking bots:
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/12261/steps/build%20stage%201/logs/stdio

4 years ago[MachineVerifier] Use the for_range loop to instead llvm::any_of
Kang Zhang [Fri, 15 May 2020 02:35:33 +0000 (02:35 +0000)]
[MachineVerifier] Use the for_range loop to instead llvm::any_of

Summary:
In the patch D78849, it uses llvm::any_of to instead of for loop to
simplify the function addRequired().
It's obvious that above code is not a NFC conversion. Because any_of
will return if any addRequired(Reg) is true immediately, but we want
every element to call addRequired(Reg).

This patch uses for_range loop to fix above any_of bug.

Reviewed By: MaskRay, nickdesaulniers

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

4 years agoTemporarily Revert "[Support] Make UniqueStringSaver wrap a StringSet"
Eric Christopher [Fri, 15 May 2020 02:16:45 +0000 (19:16 -0700)]
Temporarily Revert "[Support] Make UniqueStringSaver wrap a StringSet"
as it's causing asan failures in clangd. Followed up offline
with repro instructions.

This reverts commit 29560a89ddcaf3af9b8a73d98d968a0911d21e27.

4 years ago[Flang][OpenMP] Avoid abort when collapse clause value is negative
Valentin Clement [Fri, 15 May 2020 01:34:33 +0000 (21:34 -0400)]
[Flang][OpenMP] Avoid abort when collapse clause value is negative

Summary:
If the value in the collapse close is negative f18 abort without the correct error message. This PR change the size_t in name resolution to a int64_t and check appropriately for negative or zero before the privatization of induction variable.
The correct error is then catch by the OpenMP structure check.

This diff is migrated from the GitHub pull request https://github.com/flang-compiler/f18/pull/1098

Reviewers: ichoyjx, jdoerfert, sscalpone, DavidTruby

Reviewed By: ichoyjx, sscalpone, DavidTruby

Subscribers: sscalpone, klausler, yaxunl, guansong, llvm-commits

Tags: #llvm, #flang

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

4 years ago[lldb/Test] Modify more tests for API replay
Jonas Devlieghere [Fri, 15 May 2020 00:57:10 +0000 (17:57 -0700)]
[lldb/Test] Modify more tests for API replay

Skip tests or parts thereof that aren't expected to work when run from a
reproducer. Also improve the doc comments in configuration.py to prevent
mistakes in the future.

4 years ago[FileCheck] Fix isalpha/isalnum calls
Joel E. Denny [Fri, 15 May 2020 00:24:09 +0000 (20:24 -0400)]
[FileCheck] Fix isalpha/isalnum calls

D79276 caused the following builder to fail:

  http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/23489

Specifically, FileCheck dumped stack in the following tests:

  LLVM :: MC/Mips/micromips-jump-pc-region.s
  LLVM :: MC/Mips/mips-jump-pc-region.s

Those tests contained characters encoded as 160 but that render (at
least for me in vim) like a single space (32).  Those characters
appeared between the `#` and `RUN:` on several lines, and D79276
caused FileCheck to process those lines differently: `RUN:` is a
comment directive.  As a result, D79276 caused FileCheck to start
calling is `isalnum` on those characters.

The problem is that FileCheck calls `isalnum` on type `char` without
casting to `unsigned char` first, so it sign-extends 160 beyond what
`unsigned char` or `EOF` can represent.  C says that has undefined
behavior.  This problem is general to FileCheck's prefix parsing and
so exists independently of D79276.

524457edbc3d fixed the above tests.  This patch changes FileCheck to
use LLVM's replacements for `ctype.h` functions, and it adds tests for
cases that are representative with or without D79276.

Reviewed By: jhenderson, thopre, efriedma

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

4 years ago[LICM] When promoting loads to the preheader, drop the location.
Davide Italiano [Thu, 14 May 2020 23:48:53 +0000 (16:48 -0700)]
[LICM] When promoting loads to the preheader, drop the location.

It's really almost going to be misleading, see the example in
https://bugs.llvm.org/show_bug.cgi?id=45820

Maybe at some point we can do something fancier, but at least
this will fix a bug where we step on dead code while debugging.

4 years ago[Fuchsia] Do not enable the Z3 solver for a fuchsia toolchain
Leonard Chan [Fri, 15 May 2020 00:00:11 +0000 (17:00 -0700)]
[Fuchsia] Do not enable the Z3 solver for a fuchsia toolchain

gLinux started shipping incompatible versions of Z3, which can lead to a
missing `z3.h` header when building the Z3 solver locally. This patch
disables the Z3 solver when building a clang toolchain for Fuchsia.

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

4 years agoRevert "[GlobalISel][InlineAsm] Add early return for memory inputs that need to be...
Nico Weber [Thu, 14 May 2020 23:37:05 +0000 (19:37 -0400)]
Revert "[GlobalISel][InlineAsm] Add early return for memory inputs that need to be indirectified"

This reverts commit 887dfeec53ad5e564e9990c433e5b53f2e651dbf.
It broke irtranslator-inline-asm.ll on many bots, e.g.
http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/38606/steps/test-check-all/logs/FAIL%3A%20LLVM%3A%3Airtranslator-inline-asm.ll

4 years agollvm/test: Check in suppressions file left out of f26823c9d
Vedant Kumar [Thu, 14 May 2020 23:08:07 +0000 (16:08 -0700)]
llvm/test: Check in suppressions file left out of f26823c9d

4 years ago[llvm] Fix refactoring bug introduced in D79042
Mircea Trofin [Thu, 14 May 2020 22:42:26 +0000 (15:42 -0700)]
[llvm] Fix refactoring bug introduced in D79042

Incorrectly copied over the GetAssumptionCache snippet.

This patch also renames a variable for clarity.

4 years ago[lldb/Test] Replace assertTrue with more specific checks (NFC)
Jonas Devlieghere [Thu, 14 May 2020 22:48:03 +0000 (15:48 -0700)]
[lldb/Test] Replace assertTrue with more specific checks (NFC)

Use assertEqual(a, b) instead of assertTrue(a == b) etc.

4 years ago[test/dsymutil] Suppress LeakSanitizer on ARM dsymutil tests
Vedant Kumar [Thu, 14 May 2020 22:13:54 +0000 (15:13 -0700)]
[test/dsymutil] Suppress LeakSanitizer on ARM dsymutil tests

Just like on X86, we're getting reports of bogus leaks from
CoreFoundation in:

[_CFXPreferences(SourceAdditions) withSourceForIdentifier:user:byHost:container:cloud:perform:]

rdar://63238710

4 years ago[AMDGPU] Peephole adjacent equivalent S_SET_GPR_IDX_ON
Stanislav Mekhanoshin [Wed, 13 May 2020 20:13:16 +0000 (13:13 -0700)]
[AMDGPU] Peephole adjacent equivalent S_SET_GPR_IDX_ON

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

4 years agoRevert "Run Coverage pass before other *San passes under new pass manager"
Leonard Chan [Thu, 14 May 2020 22:19:27 +0000 (15:19 -0700)]
Revert "Run Coverage pass before other *San passes under new pass manager"

This reverts commit 7d5bb94d78386e4653535c35d3e8258bf4502340.

Reverting since this leads to a linker error we're seeing on Fuchsia.
The underlying issue seems to be that inlining is run after sanitizers
and causes different comdat groups instrumented by Sancov to reference
non-key symbols defined in other comdat groups.

Will re-land this patch after a fix for that is landed.

4 years ago[clang][VerifyDiagnosticConsumer] Support filename wildcards
Alexandre Rames [Thu, 14 May 2020 22:09:30 +0000 (15:09 -0700)]
[clang][VerifyDiagnosticConsumer] Support filename wildcards

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

4 years ago[OPENMP50]Codegen for uses_allocators clause.
Alexey Bataev [Thu, 30 Apr 2020 15:27:36 +0000 (11:27 -0400)]
[OPENMP50]Codegen for uses_allocators clause.

Summary:
Predefined allocators should not be mapped at all (they are just enumeric
constants). FOr user-defined allocators need to map the traits only as
firstprivates, the allocator itself is private.
At the beginning of the target region the user-defined allocatores must
be created and then destroyed at the end of the target region:
```
omp_allocator_handle_t my_allocator = __kmpc_init_allocator(<gtid>,
/*default memhandle*/ 0, <number_of_traits>, &<traits>);
...
call void @__kmpc_destroy_allocator(<gtid>, my_allocator);
```

Reviewers: jdoerfert, aaron.ballman

Subscribers: jholewinski, yaxunl, guansong, cfe-commits, caomhin

Tags: #clang

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

4 years ago[AMDGPU] Make v16f64/v16i64 legal
Stanislav Mekhanoshin [Thu, 14 May 2020 18:57:19 +0000 (11:57 -0700)]
[AMDGPU] Make v16f64/v16i64 legal

This allows indirect VGPR addressing to work.

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

4 years ago[GlobalISel][InlineAsm] Add early return for memory inputs that need to be indirectified
Konstantin Schwarz [Thu, 14 May 2020 19:02:37 +0000 (21:02 +0200)]
[GlobalISel][InlineAsm] Add early return for memory inputs that need to be indirectified

Summary:
D78319 introduced basic support for inline asm input operands in GlobalISel.
However, that patch did not handle the case where a memory input operand still needs to
be indirectified. Later code asserts that the memory operand is already indirect.

This patch adds an early return false to trigger the SelectionDAG fallback for now.

Reviewers: arsenm, paquette

Reviewed By: arsenm

Subscribers: wdng, rovka, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[AArch64][SVE] Add some integer DestructiveBinaryComm* patterns
Cameron McInally [Thu, 14 May 2020 21:07:59 +0000 (16:07 -0500)]
[AArch64][SVE] Add some integer DestructiveBinaryComm* patterns

Add DestructiveBinaryComm* patterns for ADD, SUB, and SUBR.

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

4 years agoAdd v16f64 value type
Stanislav Mekhanoshin [Wed, 13 May 2020 23:20:45 +0000 (16:20 -0700)]
Add v16f64 value type

We need to use it to handle <16 x double> indirect indexes
in the AMDGPU BE.

The only visible change from adding it is in ARM cost model.
To me it looks reasonable. With doubling a vector size it
quadruples the cost up to the size 8 and then it did only
double it. Now it also quadruples, which seems a logical
progression to me.

Actual AMDGPU code is to follow, this is a common part, plus
load/store legalization in the AMDGPU BE not to break what
works now.

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

4 years ago[gn build] Port 2b7fe0863ac
LLVM GN Syncbot [Thu, 14 May 2020 21:21:41 +0000 (21:21 +0000)]
[gn build] Port 2b7fe0863ac

4 years agoRevert "[lldb] Don't dissasemble large functions by default"
shafik [Thu, 14 May 2020 21:15:51 +0000 (14:15 -0700)]
Revert "[lldb] Don't dissasemble large functions by default"

This reverts commit f665e80c023ec52557f55d7eeaf34471e4c6fa0d.

Reverting because it breaks TestFoundationDisassembly.py

4 years ago[clang][Preprocessor] Replace the slow translateFile call by a new, faster isMainFile...
Alex Lorenz [Thu, 14 May 2020 21:11:31 +0000 (14:11 -0700)]
[clang][Preprocessor] Replace the slow translateFile call by a new, faster isMainFile check

The commit 3c28a2dc6bdc331e5a0d8097a5fa59d06682b9d0 introduced the check that checks if we're
trying to re-enter a main file when building a preamble. Unfortunately this slowed down the preamble
compilation by 80-90% in some test cases, as translateFile is really slow. This change checks
to see if the FileEntry is the main file without calling translateFile, but by using the new
isMainFile check instead. This speeds up preamble building by 1.5-2x for certain test cases that we have.

rdar://59361291

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

4 years agoFix clang test failures from D77454
Eli Friedman [Thu, 14 May 2020 21:10:06 +0000 (14:10 -0700)]
Fix clang test failures from D77454

4 years ago[llvm-profdata] Update CommandGuide
Wei Mi [Wed, 13 May 2020 22:11:49 +0000 (15:11 -0700)]
[llvm-profdata] Update CommandGuide

Add a bunch of SampleFDO related flags added recently into llvm-profdata to
its command guide.

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

4 years ago[MLIR] Add symbol map to mlir ExecutionEngine
Eugene Zhulenev [Thu, 14 May 2020 20:29:53 +0000 (22:29 +0200)]
[MLIR] Add symbol map to mlir ExecutionEngine

Add additional symbol mapping to be able to provide custom symbols to jitted code at runtime.

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

4 years ago[mlir][Affine] Introduce affine.vector_load and affine.vector_store
Diego Caballero [Thu, 14 May 2020 19:05:46 +0000 (12:05 -0700)]
[mlir][Affine] Introduce affine.vector_load and affine.vector_store

This patch adds `affine.vector_load` and `affine.vector_store` ops to
the Affine dialect and lowers them to `vector.transfer_read` and
`vector.transfer_write`, respectively, in the Vector dialect.

Reviewed By: bondhugula, nicolasvasilache

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

4 years agoLoadInst should store Align, not MaybeAlign.
Eli Friedman [Sat, 4 Apr 2020 04:56:20 +0000 (21:56 -0700)]
LoadInst should store Align, not MaybeAlign.

The fact that loads and stores can have the alignment missing is a
constant source of confusion: code that usually works can break down in
rare cases.  So fix the LoadInst API so the alignment is never missing.

To reduce the number of changes required to make this work, IRBuilder
and certain LoadInst constructors will grab the module's datalayout and
compute the alignment automatically.  This is the same alignment
instcombine would eventually apply anyway; we're just doing it earlier.
There's a minor risk that the way we're retrieving the datalayout
could break out-of-tree code, but I don't think that's likely.

This is the last in a series of patches, so most of the necessary
changes have already been merged.

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

4 years ago[WebAssembly] Added Debug Fixup pass
Wouter van Oortmerssen [Thu, 30 Apr 2020 18:41:39 +0000 (11:41 -0700)]
[WebAssembly] Added Debug Fixup pass

This pass changes debug_value instructions referring to stackified registers into TI_OPERAND_STACK with correct stack depth.

4 years ago [lldb] Update stop info override callback comment.
Ryan Mansfield [Thu, 14 May 2020 20:08:01 +0000 (13:08 -0700)]
 [lldb] Update stop info override callback comment.

In D31172 GetStopInfoOverrideCallback was moved and renamed.

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

4 years ago[lldb/Test] Skip test using files to synchronize.
Jonas Devlieghere [Thu, 14 May 2020 19:27:26 +0000 (12:27 -0700)]
[lldb/Test] Skip test using files to synchronize.

Files written by the inferior are not captured by the reproducers and
the inferior doesn't actually run during replay.

4 years agoInfer alignment of unmarked loads in IR/bitcode parsing.
Eli Friedman [Thu, 14 May 2020 19:59:45 +0000 (12:59 -0700)]
Infer alignment of unmarked loads in IR/bitcode parsing.

For IR generated by a compiler, this is really simple: you just take the
datalayout from the beginning of the file, and apply it to all the IR
later in the file. For optimization testcases that don't care about the
datalayout, this is also really simple: we just use the default
datalayout.

The complexity here comes from the fact that some LLVM tools allow
overriding the datalayout: some tools have an explicit flag for this,
some tools will infer a datalayout based on the code generation target.
Supporting this properly required plumbing through a bunch of new
machinery: we want to allow overriding the datalayout after the
datalayout is parsed from the file, but before we use any information
from it. Therefore, IR/bitcode parsing now has a callback to allow tools
to compute the datalayout at the appropriate time.

Not sure if I covered all the LLVM tools that want to use the callback.
(clang? lli? Misc IR manipulation tools like llvm-link?). But this is at
least enough for all the LLVM regression tests, and IR without a
datalayout is not something frontends should generate.

This change had some sort of weird effects for certain CodeGen
regression tests: if the datalayout is overridden with a datalayout with
a different program or stack address space, we now parse IR based on the
overridden datalayout, instead of the one written in the file (or the
default one, if none is specified). This broke a few AVR tests, and one
AMDGPU test.

Outside the CodeGen tests I mentioned, the test changes are all just
fixing CHECK lines and moving around datalayout lines in weird places.

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

4 years ago[lld] Add archive file support to Mach-O backend
Kellie Medlin [Thu, 14 May 2020 19:43:51 +0000 (12:43 -0700)]
[lld] Add archive file support to Mach-O backend

With this change, basic archive files can be linked together. Input
section discovery has been refactored into a function since archive
files lazily resolve their symbols / the object files containing those
symbols.

Reviewed By: int3, smeenai

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

4 years ago[SVE] Remove usages of VectorType::getNumElements() from SystemZ
Christopher Tetreault [Thu, 14 May 2020 19:39:23 +0000 (12:39 -0700)]
[SVE] Remove usages of VectorType::getNumElements() from SystemZ

Reviewers: efriedma, david-arm, c-rhodes, jnspaulsson

Reviewed By: david-arm

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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