platform/upstream/llvm.git
4 years ago[clangd] Define out-of-line qualify function name
Kadir Cetinkaya [Fri, 22 Nov 2019 12:56:02 +0000 (13:56 +0100)]
[clangd] Define out-of-line qualify function name

Summary:
When moving function definitions to a different context, the function
name might need a different spelling, for example in the header it might be:

```
namespace a {
  void foo() {}
}
```

And we might want to move it into a context which doesn't have `namespace a` as
a parent, then we must re-spell the function name, i.e:
```
void a::foo() {}
```

This patch implements a version of this which ignores using namespace
declarations in the source file.

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[clangd] Define out-of-line qualify return value
Kadir Cetinkaya [Tue, 22 Oct 2019 15:02:29 +0000 (17:02 +0200)]
[clangd] Define out-of-line qualify return value

Summary:
Return type might need qualification if insertion context doesn't have
the same decls visible as the source context.

This patch adds qualification for return value to cover such cases.

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[clangd] Define out-of-line initial apply logic
Kadir Cetinkaya [Mon, 21 Oct 2019 16:16:40 +0000 (18:16 +0200)]
[clangd] Define out-of-line initial apply logic

Summary:
Initial implementation for apply logic, replaces function body with a
semicolon in source location and copies the full function definition into target
location.

Will handle qualification of return type and function name in following patches
to keep the changes small.

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[clangd] Define out-of-line availability checks
Kadir Cetinkaya [Mon, 21 Oct 2019 16:03:38 +0000 (18:03 +0200)]
[clangd] Define out-of-line availability checks

Summary:
Initial availability checks for performing define out-of-line code
action, which is a refactoring that will help users move function/method
definitions from headers to implementation files.

Proposed implementation only checks whether we have an interesting selection,
namely function name or full function definition/body.

Reviewers: hokein

Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[llvm-strip][MachO] Test llvm-strip --strip-debug
Fangrui Song [Wed, 4 Dec 2019 03:54:11 +0000 (19:54 -0800)]
[llvm-strip][MachO] Test llvm-strip --strip-debug

Reviewed By: smeenai

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

4 years ago[MacroFusion] Limit the max fused number as 2 to reduce the dependency
QingShan Zhang [Wed, 4 Dec 2019 04:58:34 +0000 (04:58 +0000)]
[MacroFusion] Limit the max fused number as 2 to reduce the dependency

This is the example:

int foo(int a, int b, int c, int d) {
  return a + b + c + d;
}

And this is the Dependency Graph:
+------+       +------+       +------+       +------+
|  A   |       |  B   |       |  C   |       |  D   |
+--+--++       +---+--+       +--+---+       +--+---+
   ^  ^            ^  ^          ^              ^
   |  |            |  |          |              |
   |  |            |  |New1      +--------------+
   |  |            |  |          |
   |  |            |  |       +--+---+
   |  |New2        |  +-------+ ADD1 |
   |  |            |          +--+---+
   |  |            |    Fuse     ^
   |  |            +-------------+
   |  +------------+
   |               |
   |   Fuse     +--+---+
   +----------->+ ADD2 |
   |            +------+
+--+---+
| ADD3 |
+------+

We need also create an artificial edge from ADD1 to A if
https://reviews.llvm.org/D69998 is landed. That will force the Node A scheduled
before the ADD1 and ADD2. But in fact, it is ok to schedule the Node A
in-between ADD3 and ADD2, as ADD3 and ADD2 are NOT a fusion pair because
ADD2 has been matched to ADD1. We are creating these unnecessary dependency
edges that override the heuristics.

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

4 years ago[PowerPC] folding rlwinm + rlwinm to rlwinm
czhengsz [Wed, 4 Dec 2019 02:48:12 +0000 (21:48 -0500)]
[PowerPC] folding rlwinm + rlwinm to rlwinm

  For example:
    x3 = rlwinm x3, 27, 5, 31
    x3 = rlwinm x3, 19, 0, 12
  can be combined to
    x3 = rlwinm x3, 14, 0, 12

Reviewed by: steven.zhang, lkail

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

4 years ago[Clang] Define Fuchsia C++ABI
Petr Hosek [Sat, 7 Sep 2019 01:59:43 +0000 (18:59 -0700)]
[Clang] Define Fuchsia C++ABI

Currently, it is a modified version of the Itanium ABI, with the only
change being that constructors and destructors return 'this'.

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

4 years agoFix warning on unused variable. NFC.
Michael Liao [Wed, 4 Dec 2019 02:15:17 +0000 (21:15 -0500)]
Fix warning on unused variable. NFC.

4 years ago[dsymutil] Support --out (NFC)
Jonas Devlieghere [Wed, 4 Dec 2019 01:06:05 +0000 (17:06 -0800)]
[dsymutil] Support --out (NFC)

Seems like this got lost during the libOption conversion.

4 years ago[Process] GetLanguageRuntimes() takes an argument that's always constant.
Davide Italiano [Wed, 4 Dec 2019 00:54:04 +0000 (16:54 -0800)]
[Process] GetLanguageRuntimes() takes an argument that's always constant.

And arguably `retry_if_null` isn't really descriptive of what
the flag did anyway.

4 years ago[Diagnostic][test] Remove an unneeded change to pragma_diagnostic_sections.cpp after...
Fangrui Song [Wed, 4 Dec 2019 00:39:48 +0000 (16:39 -0800)]
[Diagnostic][test] Remove an unneeded change to pragma_diagnostic_sections.cpp after D70638

4 years agogn build: (manually) merge ad871e42958
Nico Weber [Wed, 4 Dec 2019 00:22:40 +0000 (19:22 -0500)]
gn build: (manually) merge ad871e42958

4 years ago[ClangASTContext] Remove a very old hack.
Davide Italiano [Wed, 4 Dec 2019 00:31:44 +0000 (16:31 -0800)]
[ClangASTContext] Remove a very old hack.

This was fixed in clang a while ago, and the rdar associated
is now closed.

4 years ago[X86] Model DAZ and FTZ
Wang, Pengfei [Tue, 3 Dec 2019 03:10:22 +0000 (11:10 +0800)]
[X86] Model DAZ and FTZ

Summary: This is a follow-up of D70881. It models DAZ and FTZ for releated instructions.

Reviewers: craig.topper, RKSimon, andrew.w.kaylor

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[X86] Model MXCSR for all AVX512 instructions
Wang, Pengfei [Wed, 27 Nov 2019 13:13:35 +0000 (21:13 +0800)]
[X86] Model MXCSR for all AVX512 instructions

Summary: Model MXCSR for all AVX512 instructions

Reviewers: craig.topper, RKSimon, andrew.w.kaylor

Subscribers: hiraditya, llvm-commits, LuoYuanke, LiuChen3

Tags: #llvm

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

4 years agoAdd discussion of git-format-patch to Phabricator.html
Kit Barton [Fri, 29 Nov 2019 17:05:43 +0000 (12:05 -0500)]
Add discussion of git-format-patch to Phabricator.html

Summary: There is a discussion of git-format-patch in GettingStarted guide, but no mention of it in the Phabricator.html page.

Reviewers: jyknight, delcypher

Reviewed By: delcypher

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[TypeCategory] HasLanguage() is now unused.
Davide Italiano [Tue, 3 Dec 2019 23:06:04 +0000 (15:06 -0800)]
[TypeCategory] HasLanguage() is now unused.

4 years agoFix `sed -e s@FOO@%/S@` and similar when there's @'s in the working directory
Daniel Sanders [Tue, 3 Dec 2019 23:22:30 +0000 (15:22 -0800)]
Fix `sed -e s@FOO@%/S@` and similar when there's @'s in the working directory

Jenkins sometimes starts a new working directory by appending @2 (or
incrementing the number if the @n suffix is already there). This causes
several clang tests to fail as:
  s@INPUT_DIR@%/S/Inputs@g
gets expanded to the invalid:
  s@INPUT_DIR@/path/to/workdir@2/Inputs@g
                               ~~~~~~~~~~
where the part marked with ~'s is interpreted as the flags. These are
invalid and the test fails.

Previous fixes simply exchanged the @ character for another like | but
that's just moving the problem. Address it by adding an expansion that
escapes the @ character we're using as a delimiter as well as other magic
characters in the replacement of sed's s@@@.

There's still room for expansions to cause trouble though. One I ran into
while testing this was that having a directory called foo@bar causes lots
of `CHECK-NOT: foo` directives to match. There's also things like
directories containing `\1`

4 years agoReapply "Fix crash on switch conditions of non-integer types in templates"
Elizabeth Andrews [Tue, 3 Dec 2019 22:20:52 +0000 (14:20 -0800)]
Reapply "Fix crash on switch conditions of non-integer types in templates"

This patch reapplies commit 759948467ea. Patch was reverted due to a
clang-tidy test fail on Windows. The test has been modified. There
are no additional code changes.

Patch was tested with ninja check-all on Windows and Linux.

Summary of code changes:

Clang currently crashes for switch statements inside a template when the
condition is a non-integer field member because contextual implicit
conversion is skipped when parsing the condition. This conversion is
however later checked in an assert when the case statement is handled.
The conversion is skipped when parsing the condition because
the field member is set as type-dependent based on its containing class.
This patch sets the type dependency based on the field's type instead.

This patch fixes Bug 40982.

4 years ago[NFC] Pass a reference to CodeGenFunction to methods of LValue and
Akira Hatanaka [Tue, 3 Dec 2019 23:17:01 +0000 (15:17 -0800)]
[NFC] Pass a reference to CodeGenFunction to methods of LValue and
AggValueSlot

This reapplies 8a5b7c35709d9ce1f44a99f0c5b084bf2696ea17 after a null
dereference bug in CGOpenMPRuntime::emitUserDefinedMapper.

Original commit message:

This is needed for the pointer authentication work we plan to do in the
near future.

https://github.com/apple/llvm-project/blob/a63a81bd9911f87a0b5dcd5bdd7ccdda7124af87/clang/docs/PointerAuthentication.rst

4 years ago[FormatManager] Provide only one variant of EnableCategory.
Davide Italiano [Tue, 3 Dec 2019 23:02:54 +0000 (15:02 -0800)]
[FormatManager] Provide only one variant of EnableCategory.

All the callers pass a single language anyway.

4 years ago[DataVisualization] Simplify. NFCI.
Davide Italiano [Tue, 3 Dec 2019 22:54:59 +0000 (14:54 -0800)]
[DataVisualization] Simplify. NFCI.

4 years ago[MS] Emit exported complete/vbase destructors
Reid Kleckner [Mon, 2 Dec 2019 23:22:44 +0000 (15:22 -0800)]
[MS] Emit exported complete/vbase destructors

Summary:
Fixes PR44205

I checked, and deleting destructors are not affected.

Reviewers: hans

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[compiler-rt] Disable fuzzer large.test when LLVM_ENABLE_EXPENSIVE_CHECKS=ON
Alex Lorenz [Tue, 3 Dec 2019 22:34:02 +0000 (14:34 -0800)]
[compiler-rt] Disable fuzzer large.test when LLVM_ENABLE_EXPENSIVE_CHECKS=ON

This test is timing out on Green Dragon http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/
and looks like it's not executed on other bots with expensive checks
enabled
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-ubuntu
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win

The test times out at the C++ source file takes too long to build (2+ hours on my machine), as
clang spends a lot of time in IR/MIR verifiers.

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

4 years ago[FPEnv] [PowerPC] Lowering ppc_fp128 StrictFP Nodes to libcalls
Craig Topper [Tue, 3 Dec 2019 22:05:04 +0000 (14:05 -0800)]
[FPEnv] [PowerPC] Lowering ppc_fp128 StrictFP Nodes to libcalls

This is an alternative to D64662 that shares more code between
strict and non-strict nodes. It's modeled after the implementation
that I did for softening.

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

4 years ago[RISCV] Don't force Local Exec TLS for non-PIC
James Clarke [Tue, 3 Dec 2019 22:04:24 +0000 (22:04 +0000)]
[RISCV] Don't force Local Exec TLS for non-PIC

Summary:
Forcing Local Exec TLS requires the use of copy relocations. Copy
relocations need special handling in the runtime linker when being used
against TLS symbols, which is present in glibc, but not in FreeBSD nor
musl, and so cannot be relied upon. Moreover, copy relocations are a
hack that embed the size of an object in the ABI when it otherwise
wouldn't be, and break protected symbols (which are expected to be DSO
local), whilst also wasting space, thus they should be avoided whenever
possible. As discussed in D70398, RISC-V should move away from forcing
Local Exec, and instead use Initial Exec like other targets, with
possible linker relaxation to follow. The RISC-V GCC maintainers also
intend to adopt this more-conventional behaviour (see
https://github.com/riscv/riscv-elf-psabi-doc/issues/122).

Reviewers: asb, MaskRay

Reviewed By: MaskRay

Subscribers: emaste, krytarowski, hiraditya, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, llvm-commits, bsdjhb

Tags: #llvm

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

4 years ago[InstCombine] Revert aafde063aaf09285c701c80cd4b543c2beb523e8 and 6749dc3446671df0523...
Craig Topper [Tue, 3 Dec 2019 21:48:39 +0000 (13:48 -0800)]
[InstCombine] Revert aafde063aaf09285c701c80cd4b543c2beb523e8 and 6749dc3446671df05235d0a218c426a314ac33cd related to bitcast handling of x86_mmx

This reverts these two commits
[InstCombine] Turn (extractelement <1 x i64/double> (bitcast (x86_mmx))) into a single bitcast from x86_mmx to i64/double.
[InstCombine] Don't transform bitcasts between x86_mmx and v1i64 into insertelement/extractelement

We're seeing at least one internal test failure related to a
bitcast that was previously before an inline assembly block
containing emms being placed after it. This leads to the mmx
state ending up not empty after the emms. IR has no way to
make any specific guarantees about this. Reverting these patches
to get back to previous behavior which at least worked for this
test.

4 years ago[TypeCategory] Nothing passes down a list of languages.
Davide Italiano [Tue, 3 Dec 2019 21:36:50 +0000 (13:36 -0800)]
[TypeCategory] Nothing passes down a list of languages.

Summary: This should allow further simplifications, but it's a first step.

Reviewers: teemperor, jingham, friss

Subscribers: lldb-commits

Tags: #lldb

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

4 years agoEnable `-funwind-tables` flag when building libunwind
Sergej Jaskiewicz [Tue, 5 Nov 2019 11:47:24 +0000 (14:47 +0300)]
Enable `-funwind-tables` flag when building libunwind

Summary:
Or, rather, don't accidentally forget to pass it.

This is aimed to solve the problem discussed in [this thread](http://lists.llvm.org/pipermail/llvm-dev/2019-November/136890.html), and to fix [a year-old bug](https://bugs.llvm.org/show_bug.cgi?id=38468).

TL;DR: when building libunwind for ARM Linux, we **need** libunwind to be built with the `-funwind-tables` flag, because, well ARM EHABI needs unwind info produced by this flag. Without the flag all the procedures in libunwind are marked `.cantunwind`, which causes all sorts of bad things. From `_Unwind_Backtrace` not working, to C++ exceptions not being caught (which is the aforementioned bug is about).

Previously, this flag was not added because the CMake check `add_compile_flags_if_supported(-funwind-tables)` produced a false negative. Why? With this flag, the compiler generates calls to the `__aeabi_unwind_cpp_pr0` symbol, which is defined in libunwind itself and obviously is not available at configure time, before libunwind is built. This led to failure at link time during the CMake check. We handle this by disabling the linker for CMake checks in linbunwind.

Also, this patch introduces a lit feature `libunwind-arm-ehabi`, which is used to mark the `signal_frame.pass.cpp` test as unsupported (as was advised by @miyuki in D70397).

Reviewers: peter.smith, phosek, EricWF, compnerd, jroelofs, saugustine, miyuki, jfb

Subscribers: mgorny, kristof.beyls, christof, libcxx-commits, miyuki

Tags: #libc

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

4 years ago[UpdateTestChecks] Change shebang from python to python3
Fangrui Song [Tue, 26 Nov 2019 18:40:52 +0000 (10:40 -0800)]
[UpdateTestChecks] Change shebang from python to python3

'python' means Python 2 on some platforms while Python 3 on others.
'python3' is Python 3 only. Python 2.7 End of Life is set to January 1,
2020. Getting rid of Python 2 support reduces maintenance burden.

Reviewed By: lebedev.ri

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

4 years ago[clangd] Fix comparator const after c9c714c7054d555398c767cb39d7d97600b3d9d1
Sam McCall [Tue, 3 Dec 2019 21:13:45 +0000 (22:13 +0100)]
[clangd] Fix comparator const after c9c714c7054d555398c767cb39d7d97600b3d9d1

4 years agoRevert "[NFC] Pass a reference to CodeGenFunction to methods of LValue and"
Akira Hatanaka [Tue, 3 Dec 2019 21:07:22 +0000 (13:07 -0800)]
Revert "[NFC] Pass a reference to CodeGenFunction to methods of LValue and"

This reverts commit 8a5b7c35709d9ce1f44a99f0c5b084bf2696ea17. This seems
to have broken UBSan because of a null dereference.

4 years agoFix warning on extra ';'. NFC.
Michael Liao [Tue, 3 Dec 2019 21:02:55 +0000 (16:02 -0500)]
Fix warning on extra ';'. NFC.

4 years ago[Coverage] Emit a gap region to cover switch bodies
Vedant Kumar [Thu, 21 Nov 2019 22:17:04 +0000 (14:17 -0800)]
[Coverage] Emit a gap region to cover switch bodies

Emit a gap region beginning where the switch body begins. This sets line
execution counts in the areas between non-overlapping cases to 0.

This also removes some special handling of the first case in a switch:
these are now treated like any other case.

This does not resolve an outstanding issue with case statement regions
that do not end when a region is terminated. But it should address
llvm.org/PR44011.

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

4 years agoSwitch to opening the temp file in binary mode
Aaron Ballman [Tue, 3 Dec 2019 20:31:46 +0000 (15:31 -0500)]
Switch to opening the temp file in binary mode

This corrects an issue where the script would write the file with the
incorrect line endings on Windows.

4 years ago[Diagnostic] add a warning which warns about misleading indentation
Tyker [Tue, 3 Dec 2019 19:05:29 +0000 (20:05 +0100)]
[Diagnostic] add a warning which warns about misleading indentation

Summary: Add a warning for misleading indentation similar to GCC's -Wmisleading-indentation

Reviewers: aaron.ballman, xbolva00

Reviewed By: aaron.ballman, xbolva00

Subscribers: tstellar, cfe-commits, arphaman, Ka-Ka, thakis

Tags: #clang

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

4 years ago[NFCI] update formating for misleading indentation warning
Tyker [Tue, 3 Dec 2019 19:05:28 +0000 (20:05 +0100)]
[NFCI] update formating for misleading indentation warning

Reviewers: xbolva00

Reviewed By: xbolva00

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

4 years agoRemove unused variable. NFC.
Michael Liao [Tue, 3 Dec 2019 20:14:41 +0000 (15:14 -0500)]
Remove unused variable. NFC.

4 years agoFix signed mismatch warnings in MetadataTests.cpp
David Blaikie [Tue, 3 Dec 2019 19:36:12 +0000 (11:36 -0800)]
Fix signed mismatch warnings in MetadataTests.cpp

4 years agoRevert "Fix llvm-namespace-comment for macro expansions"
Alexander Kornienko [Tue, 3 Dec 2019 15:27:57 +0000 (16:27 +0100)]
Revert "Fix llvm-namespace-comment for macro expansions"

This reverts commit 4736d63f752f8d13f4c6a9afd558565c32119718.
This commit introduces a ton of false positives and incorrect fixes. See https://reviews.llvm.org/D69855#1767089 for details.

4 years ago[NFC] Pass a reference to CodeGenFunction to methods of LValue and
Akira Hatanaka [Tue, 3 Dec 2019 19:24:46 +0000 (11:24 -0800)]
[NFC] Pass a reference to CodeGenFunction to methods of LValue and
AggValueSlot

This is needed for the pointer authentication work we plan to do in the
near future.

https://github.com/apple/llvm-project/blob/a63a81bd9911f87a0b5dcd5bdd7ccdda7124af87/clang/docs/PointerAuthentication.rst

4 years ago[FileCheck] Given multiple -dump-input, prefer most verbose
Joel E. Denny [Tue, 3 Dec 2019 15:13:00 +0000 (10:13 -0500)]
[FileCheck] Given multiple -dump-input, prefer most verbose

Problem: `FILECHECK_OPTS` was implemented so that a test runner, such
as a bot, can specify FileCheck debugging options, such as
`-dump-input=fail`.  However, some existing test suites have FileCheck
calls that already specify `-dump-input=fail` or `-dump-input=always`.
Without this patch, such tests fail under such a test runner because
FileCheck doesn't accept multiple occurrences of `-dump-input`.

Solution: This patch permits multiple occurrences of `-dump-input` by
assigning precedence to its values in the following descending order:
`help`, `always`, `fail`, and `never`.  That is, any occurrence of
`help` always obtains help, and otherwise the behavior is similar to
`-v` vs. `-vv` in that the option specifying the greatest verbosity
has precedence.

Rationale: My justification for the new behavior is as follows.  I
have not experienced use cases where, either as a test runner or as a
test author, I want to **limit** the permitted debugging verbosity
(except as a test author in FileCheck's or lit's test suites where the
FileCheck debugging output itself is under test, but the solution
there is `env FILECHECK_OPTS=`, and I imagine we should use the same
solution anywhere else this need might occur).  Of course, as either a
test runner or test author, it is useful to **increase** debugging
verbosity.

Reviewed By: probinson

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

4 years ago[GlobalISel]: Allow targets to override how to widen constants during legalization
Aditya Nandakumar [Tue, 3 Dec 2019 18:40:03 +0000 (10:40 -0800)]
[GlobalISel]: Allow targets to override how to widen constants during legalization

https://reviews.llvm.org/D70922

This adds a hook to allow targets to define exactly what extension
operation should be performed for widening constants. This handles cases
like widening i1 true which would end up becoming -1 which affects code
quality during combines.
Additionally, in order to stay consistent with how DAG is promoting
constants, we now signextend for byte sized types and zero extend
otherwise (by default). Targets can of course override this if
necessary.

4 years ago[APInt][PatternMatch] Add 'is non-positive' predicate
Roman Lebedev [Tue, 3 Dec 2019 18:17:51 +0000 (21:17 +0300)]
[APInt][PatternMatch] Add 'is non-positive' predicate

It will be useful for implementing the fold mentioned in
https://bugs.llvm.org/show_bug.cgi?id=44100#c4

4 years agoCorrecting the offsets within the test to fix the bots.
Aaron Ballman [Tue, 3 Dec 2019 18:21:35 +0000 (13:21 -0500)]
Correcting the offsets within the test to fix the bots.

4 years agoDifferentiate between the presumed and actual file when dumping the AST to JSON
Aaron Ballman [Tue, 3 Dec 2019 18:04:45 +0000 (13:04 -0500)]
Differentiate between the presumed and actual file when dumping the AST to JSON

Currently, when dumping the AST to JSON, the presumed file is what is included
when dumping a source location. This patch changes the behavior to instead dump
the actual file, and only dump a presumed file name when it differs from the
actual file.

This also corrects an issue with the test script generator that would prevent
it from working on Windows due to file permissions issues.

4 years ago[LV] Scalar with predication must not be uniform
Ayal Zaks [Tue, 26 Nov 2019 22:08:29 +0000 (00:08 +0200)]
[LV] Scalar with predication must not be uniform

Fix PR40816: avoid considering scalar-with-predication instructions as also
uniform-after-vectorization.

Instructions identified as "scalar with predication" will be "vectorized" using
a replicating region. If such instructions are also optimized as "uniform after
vectorization", namely when only the first of VF lanes is used, such a
replicating region becomes erroneous - only the first instance of the region can
and should be formed. Fix such cases by not considering such instructions as
"uniform after vectorization".

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

4 years agoRename `tsan/race_range_pc.cc` to `test/tsan/race_range_pc.cpp`.
Dan Liew [Tue, 3 Dec 2019 17:48:07 +0000 (09:48 -0800)]
Rename `tsan/race_range_pc.cc` to `test/tsan/race_range_pc.cpp`.

The old suffix was preventing it from being executed by default.

4 years agoRevert "[libomptarget] Build a minimal deviceRTL for amdgcn"
Alexey Bataev [Tue, 3 Dec 2019 17:35:08 +0000 (12:35 -0500)]
Revert "[libomptarget] Build a minimal deviceRTL for amdgcn"

This reverts commit 877ffa716fba52251a7454ffd3727d025b617a1f because it
breaks the build.

4 years agoRevert "Temporarily revert "build: avoid hardcoding the libxml2 library name""
Saleem Abdulrasool [Tue, 3 Dec 2019 17:27:14 +0000 (09:27 -0800)]
Revert "Temporarily revert "build: avoid hardcoding the libxml2 library name""

This reverts commit 2e75681b55ab55301022533b203269f5f3d6f909.  Restore
the clean up change.  The underlying CMake issue was resolved in
372ad32734ecb455f9fb4d0601229ca2dfc78b66.

4 years ago[clang-format] Add new option to add spaces around conditions
Mitchell Balan [Tue, 3 Dec 2019 17:20:30 +0000 (12:20 -0500)]
[clang-format] Add new option to add spaces around conditions
Summary:
This diff adds a new option SpacesAroundConditions that inserts spaces inside the braces for conditional statements.

Reviewers: klimek, owenpan, mitchell-stellar, MyDeveloperDay

Patch by: timwoj

Subscribers: rsmmr, cfe-commits

Tags: clang, clang-format

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

4 years ago[NFC][KnownBits] Add getMinValue() / getMaxValue() methods
Roman Lebedev [Tue, 3 Dec 2019 14:45:47 +0000 (17:45 +0300)]
[NFC][KnownBits] Add getMinValue() / getMaxValue() methods

As it can be seen from accompanying cleanup, it is not unheard of
to write `~Known.Zero` meaning "what maximal value can this KnownBits
produce". But i think `~Known.Zero` isn't *that* self-explanatory,
as compared to a method with a name.

Note that not all `~Known.Zero` places were cleaned up,
only those where this arguably improves things.

4 years agollvm-config: do not link absolute paths with `-l`
Saleem Abdulrasool [Tue, 3 Dec 2019 16:52:21 +0000 (08:52 -0800)]
llvm-config: do not link absolute paths with `-l`

When dealing with system libraries which are absolute paths, use the
absolute path rather than the `-l` option.  This ensures that the system
library can be properly linked against.  This is needed to enable using
proper link dependencies in CMake.

4 years agoReland [clangd] Rethink how SelectionTree deals with macros and #includes.
Sam McCall [Tue, 3 Dec 2019 15:59:52 +0000 (16:59 +0100)]
Reland [clangd] Rethink how SelectionTree deals with macros and #includes.

This reverts commit 905b002c139f039a32ab9bf1fad63d745d12423f.

Avoid tricky (and invalid) comparator for std::set.

4 years ago[scudo][standalone] Add chunk ownership function
Kostya Kortchinsky [Mon, 2 Dec 2019 16:50:10 +0000 (08:50 -0800)]
[scudo][standalone] Add chunk ownership function

Summary:
In order to be compliant with tcmalloc's extension ownership
determination function, we have to expose a function that will
say if a chunk was allocated by us.

As to whether or not this has security consequences: someone
able to call this function repeatedly could use it to determine
secrets (cookie) or craft a valid header. So this should not be
exposed directly to untrusted user input.

Add related tests.

Additionally clang-format caught a few things to change.

Reviewers: hctim, pcc, cferris, eugenis, vitalybuka

Subscribers: JDevlieghere, jfb, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[SLP] Enhance SLPVectorizer to vectorize different combinations of aggregates
Anton Afanasyev [Thu, 21 Nov 2019 15:41:52 +0000 (18:41 +0300)]
[SLP] Enhance SLPVectorizer to vectorize different combinations of aggregates

Summary:
Make SLPVectorize to recognize homogeneous aggregates like
`{<2 x float>, <2 x float>}`, `{{float, float}, {float, float}}`,
`[2 x {float, float}]` and so on.
It's a follow-up of https://reviews.llvm.org/D70068.
Merged `findBuildVector()` and `findBuildAggregate()` to
one `findBuildAggregate()` function making it recursive
to recognize multidimensional aggregates. Aggregates required
to be homogeneous.

Reviewers: RKSimon, ABataev, dtemirbulatov, spatel, vporpo

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[SYCL] Add sycl_kernel attribute for accelerated code outlining
Mariya Podchishchaeva [Wed, 6 Nov 2019 14:35:50 +0000 (17:35 +0300)]
[SYCL] Add sycl_kernel attribute for accelerated code outlining

SYCL is single source offload programming model relying on compiler to
separate device code (i.e. offloaded to an accelerator) from the code
executed on the host.

Here is code example of the SYCL program to demonstrate compiler
outlining work:

```
int foo(int x) { return ++x; }
int bar(int x) { throw std::exception("CPU code only!"); }
...
using namespace cl::sycl;
queue Q;
buffer<int, 1> a(range<1>{1024});
Q.submit([&](handler& cgh) {
  auto A = a.get_access<access::mode::write>(cgh);
  cgh.parallel_for<init_a>(range<1>{1024}, [=](id<1> index) {
    A[index] = index[0] + foo(42);
  });
}
...
```

SYCL device compiler must compile lambda expression passed to
cl::sycl::handler::parallel_for method and function foo called from this
lambda expression for an "accelerator". SYCL device compiler also must
ignore bar function as it's not required for offloaded code execution.

This patch adds the sycl_kernel attribute, which is used to mark code
passed to cl::sycl::handler::parallel_for as "accelerated code".

Attribute must be applied to function templates which parameters include
at least "kernel name" and "kernel function object". These parameters
will be used to establish an ABI between the host application and
offloaded part.

Reviewers: jlebar, keryell, Naghasan, ABataev, Anastasia, bader, aaron.ballman, rjmccall, rsmith

Reviewed By: keryell, bader

Subscribers: mgorny, OlegM, ArturGainullin, agozillon, aaron.ballman, ebevhan, Anastasia, cfe-commits

Tags: #clang

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

Signed-off-by: Alexey Bader <alexey.bader@intel.com>
4 years ago[EditLine] Fix RecallHistory to make it go in the right direction.
Jonas Devlieghere [Tue, 3 Dec 2019 16:10:49 +0000 (08:10 -0800)]
[EditLine] Fix RecallHistory to make it go in the right direction.

The naming used by editline for the history operations is counter
intuitive to how it's used in lldb for the REPL.

 - The H_PREV operation returns the previous element in the history,
   which is newer than the current one.
 - The H_NEXT operation returns the next element in the history, which
   is older than the current one.

This exposed itself as a bug in the REPL where the behavior of up- and
down-arrow was inverted. This wasn't immediately obvious because of how
we save the current "live" entry.

This patch fixes the bug and introduces and enum to wrap the editline
operations that match the semantics of lldb.

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

4 years ago[OpenCL] Use generic addr space for lambda call operator
Anastasia Stulova [Tue, 3 Dec 2019 12:55:50 +0000 (12:55 +0000)]
[OpenCL] Use generic addr space for lambda call operator

Since lambdas are represented by callable objects, we add
generic addr space for implicit object parameter in call
operator.

Any lambda variable declared in __constant addr space
(which is not convertible to generic) fails to compile with
a diagnostic. To support constant addr space we need to
add a way to qualify the lambda call operators.

Tags: #clang

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

4 years ago[lldb/Reproducer] Add version check
Jonas Devlieghere [Tue, 3 Dec 2019 15:53:23 +0000 (07:53 -0800)]
[lldb/Reproducer] Add version check

To ensure a reproducer works correctly, the version of LLDB used for
capture and replay must match. Right now the reproducer already contains
the LLDB version. However, this is purely informative. LLDB will happily
replay a reproducer generated with a different version of LLDB, which
can cause subtle differences.

This patch adds a version check which compares the current LLDB version
with the one in the reproducer. If the version doesn't match, LLDB will
refuse to replay. It also adds an escape hatch to make it possible to
still replay the reproducer without having to mess with the recorded
version. This might prove useful when you know two versions of LLDB
match, even though the version string doesn't. This behavior is
triggered by passing a new flag -reproducer-skip-version-check to the
lldb driver.

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

4 years ago[AArch64] Fix over-eager fusing of NEON SIMD MUL/ADD
Sanne Wouda [Mon, 25 Nov 2019 16:40:39 +0000 (16:40 +0000)]
[AArch64] Fix over-eager fusing of NEON SIMD MUL/ADD

Summary:
The ISel pattern for SIMD MLA is a bit too eager: it replaces the ADD with an
MLA even when the MUL cannot be eliminated, e.g. when it has another use.  An
MLA is usually has a higher latency than an ADD (and there are fewer pipes
available that can execute it), so trading an MLA for an ADD is not great.

ISel is not taking the number of uses of the MUL result into account, nor any
other factors such as the length of the critical path or other resource pressure.

The MachineCombiner is able to make these judgments so this patch ports the ISel
pattern for MUL/ADD fusing to the MachineCombiner.

Similarly for MUL/SUB -> MLS, as well as the indexed variants.

The change has no impact on SPEC CPU© intrate nor fprate.

Reviewers: dmgreen, SjoerdMeijer, fhahn, Gerolf

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[SelectionDAG] Reoder ViewXXXDAGs declarations to match execution order. NFC
Amaury Séchet [Tue, 3 Dec 2019 15:10:38 +0000 (16:10 +0100)]
[SelectionDAG] Reoder ViewXXXDAGs declarations to match execution order. NFC

4 years ago[lldb] Remove unneeded semicolon in IOHandlerCursesGUI
Pavel Labath [Tue, 3 Dec 2019 15:15:58 +0000 (16:15 +0100)]
[lldb] Remove unneeded semicolon in IOHandlerCursesGUI

4 years ago[lldb] Use llvm range functions in LineTable.cpp
Pavel Labath [Tue, 3 Dec 2019 15:14:32 +0000 (16:14 +0100)]
[lldb] Use llvm range functions in LineTable.cpp

to avoid needing to declare iterators everywhere.

4 years ago[Aarch64][SVE] Add intrinsics for gather loads (vector + imm)
Sander de Smalen [Tue, 3 Dec 2019 14:52:02 +0000 (14:52 +0000)]
[Aarch64][SVE] Add intrinsics for gather loads (vector + imm)

This patch adds intrinsics for SVE gather loads from memory addresses generated by a vector base plus immediate index:
  * @llvm.aarch64.sve.ld1.gather.imm

This intrinsics maps 1-1 to the corresponding SVE instruction (example for half-words):
  * ld1h { z0.d }, p0/z, [z0.d, #16]

Committed on behalf of Andrzej Warzynski (andwar)

Reviewers: sdesmalen, huntergr, kmclaughlin, eli.friedman, rengolin, rovka, dancgr, mgudim, efriedma

Reviewed By: sdesmalen

Tags: #llvm

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

4 years ago[libomptarget] Build a minimal deviceRTL for amdgcn
Jon Chesterfield [Tue, 3 Dec 2019 15:11:01 +0000 (15:11 +0000)]
[libomptarget] Build a minimal deviceRTL for amdgcn

Summary:
[libomptarget] Build a minimal deviceRTL for amdgcn

The CMakeLists.txt file is functionally identical to the one used in the aomp fork.
Whitespace changes were made based on nvptx/CMakeLists.txt, plus the
copyright notice updated to match (Greg was the original author so would
like his sign off on that here).

This change will build a small subset of the deviceRTL if an appropriate toolchain is
available, e.g. a local install of rocm. Support.h is moved from nvptx as a dependency
of debug.h.

Reviewers: jdoerfert, ABataev, grokos, ronlieb, gregrodgers

Reviewed By: jdoerfert

Subscribers: jfb, Hahnfeld, jvesely, mgorny, openmp-commits

Tags: #openmp

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

4 years ago[DebugInfo] Make DebugVariable class available in DebugInfoMetadata
stozer [Tue, 3 Dec 2019 12:24:41 +0000 (12:24 +0000)]
[DebugInfo] Make DebugVariable class available in DebugInfoMetadata

The DebugVariable class is a class declared in LiveDebugValues.cpp which
is used to uniquely identify a single variable, using its source
variable, inline location, and fragment info to do so. This patch moves
this class into DebugInfoMetadata.h, making it available in a much
broader scope.

4 years ago[DDG] Data Dependence Graph - Topological Sort (Memory Leak Fix)
Bardia Mahjour [Mon, 2 Dec 2019 20:23:26 +0000 (15:23 -0500)]
[DDG] Data Dependence Graph - Topological Sort (Memory Leak Fix)

Summary:
This fixes the memory leak in bec37c3fc766a7b97f8c52c181c325fd47b75259
and re-delivers the reverted patch.
In this patch the DDG DAG is sorted topologically to put the
nodes in the graph in the order that would satisfy all
dependencies. This helps transformations that would like to
generate code based on the DDG. Since the DDG is a DAG a
reverse-post-order traversal would give us the topological
ordering. This patch also sorts the basic blocks passed to
the builder based on program order to ensure that the
dependencies are computed in the correct direction.

Authored By: bmahjour

Reviewer: Meinersbur, fhahn, myhsu, xtian, dmgreen, kbarton, jdoerfert

Reviewed By: Meinersbur

Subscribers: ychen, arphaman, simoll, a.elovikov, mgorny, hiraditya, jfb, wuzish, llvm-commits, jsji, Whitney, etiotto, ppc-slack

Tags: #llvm

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

4 years agoPrecommit tests for D70673
Sanne Wouda [Mon, 25 Nov 2019 16:40:28 +0000 (16:40 +0000)]
Precommit tests for D70673

4 years ago[Object/ELF] - Refine the error reported when section's offset + size overruns the...
Georgii Rymar [Mon, 2 Dec 2019 11:08:20 +0000 (14:08 +0300)]
[Object/ELF] - Refine the error reported when section's offset + size overruns the file buffer.

This is a follow-up requested in comments for D70826.

It changes the message from
"section X has a sh_offset (Y) + sh_size (Z) that cannot be represented"
to
"section X has a sh_offset (Y) + sh_size (Z) that is greater than the file size (0xABC)"

when section's sh_offset + sh_size overruns a file buffer.

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

4 years ago[LLDB] Disable MSVC warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has...
Alexandre Ganea [Tue, 3 Dec 2019 14:53:26 +0000 (09:53 -0500)]
[LLDB] Disable MSVC warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has C-linkage specified, but returns UDT 'llvm::Expected<bool>' which is incompatible with C

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

4 years ago[Aarch64][SVE] Add intrinsics for gather loads with 32-bits offsets
Sander de Smalen [Tue, 3 Dec 2019 13:52:47 +0000 (13:52 +0000)]
[Aarch64][SVE] Add intrinsics for gather loads with 32-bits offsets

This patch adds intrinsics for SVE gather loads for which the offsets are 32-bits wide and are:
* unscaled
  * @llvm.aarch64.sve.ld1.gather.sxtw
  * @llvm.aarch64.sve.ld1.gather.uxtw
* scaled (offsets become indices)
  * @llvm.arch64.sve.ld1.gather.sxtw.index
  * @llvm.arch64.sve.ld1.gather.uxtw.index
The offsets are either zero (uxtw) or sign (sxtw) extended to 64 bits.

These intrinsics map 1-1 to the corresponding SVE instructions (examples for half-words):
* unscaled
  * ld1h { z0.s }, p0/z, [x0, z0.s, sxtw]
  * ld1h { z0.s }, p0/z, [x0, z0.s, uxtw]
* scaled
  * ld1h { z0.s }, p0/z, [x0, z0.s, sxtw #1]
  * ld1h { z0.s }, p0/z, [x0, z0.s, uxtw #1]

Committed on behalf of Andrzej Warzynski (andwar)

Reviewers: sdesmalen, kmclaughlin, eli.friedman, rengolin, rovka, huntergr, dancgr, mgudim, efriedma

Reviewed By: sdesmalen

Tags: #llvm

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

4 years ago[NFCI][DebugInfo] Corrected a comment.
Sourabh Singh Tomar [Tue, 3 Dec 2019 14:10:46 +0000 (19:40 +0530)]
[NFCI][DebugInfo] Corrected a comment.

4 years ago[AArch64][SVE2] Implement remaining SVE2 floating-point intrinsics
Kerry McLaughlin [Tue, 3 Dec 2019 13:26:40 +0000 (13:26 +0000)]
[AArch64][SVE2] Implement remaining SVE2 floating-point intrinsics

Summary:
Adds the following intrinsics:
  - faddp
  - fmaxp, fminp, fmaxnmp & fminnmp
  - fmlalb, fmlalt, fmlslb & fmlslt
  - flogb

Reviewers: huntergr, sdesmalen, dancgr, efriedma

Reviewed By: sdesmalen

Subscribers: efriedma, tschuett, kristof.beyls, hiraditya, cameron.mcinally, cfe-commits, llvm-commits

Tags: #llvm

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

4 years agoAdd FunctionDecl::getParameterSourceRange()
Nicolas Manichon [Tue, 3 Dec 2019 13:21:55 +0000 (08:21 -0500)]
Add FunctionDecl::getParameterSourceRange()

This source range covers the list of parameters of the function declaration,
including the ellipsis for a variadic function.

4 years ago[Support] Add ProcName to TimeTraceProfiler
Russell Gallop [Mon, 2 Dec 2019 13:10:44 +0000 (13:10 +0000)]
[Support] Add ProcName to TimeTraceProfiler

This was hard-coded to "clang". This change allows it to to be used on
processes other than clang (such as lld).

This gets reported as clang-10 on Linux and clang.exe on Windows so
adapted test to accommodate this.

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

4 years ago[lldb][NFC] Move Curses interface implementation to own file
Raphael Isemann [Tue, 3 Dec 2019 11:18:17 +0000 (12:18 +0100)]
[lldb][NFC] Move Curses interface implementation to own file

Summary:
The IOHandler class source file is currently around 4600 LOC. However only 200
of these lines are concerned with the actual IOHandler class and the rest are the
implementations for Editline, IOHandlerConfirm and the Curses interface. All these
large features also cause that the IOHandler (which is in Core) has a large set of dependencies
on other parts of LLDB.

This patch splits out the code for the curses interface into its own file. This way
the simple IOHandler code is no longer buried in-between much larger functionalities.

Next up is splitting out the other IOHandlers into their own files and then move them
to more appropriate parts of LLDB.

Reviewers: labath, clayborg, JDevlieghere

Reviewed By: labath

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

4 years ago[AArch64][SVE] Add intrinsics for gather loads with 64-bit offsets
Sander de Smalen [Tue, 3 Dec 2019 11:25:07 +0000 (11:25 +0000)]
[AArch64][SVE] Add intrinsics for gather loads with 64-bit offsets

This patch adds the following intrinsics for gather loads with 64-bit offsets:
      * @llvm.aarch64.sve.ld1.gather (unscaled offset)
      * @llvm.aarch64.sve.ld1.gather.index (scaled offset)

These intrinsics map 1-1 to the following AArch64 instructions respectively (examples for half-words):
      * ld1h { z0.d }, p0/z, [x0, z0.d]
      * ld1h { z0.d }, p0/z, [x0, z0.d, lsl #1]

Committing on behalf of Andrzej Warzynski (andwar)

Reviewers: sdesmalen, huntergr, rovka, mgudim, dancgr, rengolin, efriedma

Reviewed By: efriedma

Tags: #llvm

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

4 years agoRevert "[LiveDebugValues] Introduce entry values of unmodified params"
Djordje Todorovic [Tue, 3 Dec 2019 12:06:38 +0000 (13:06 +0100)]
Revert "[LiveDebugValues] Introduce entry values of unmodified params"

This reverts commit rG4cfceb910692 due to LLDB test failing.

4 years ago[VPlan] Add dump function to VPlan class.
Florian Hahn [Tue, 3 Dec 2019 11:58:31 +0000 (11:58 +0000)]
[VPlan] Add dump function to VPlan class.

This adds a dump() function to VPlan, which uses the existing
operator<<.

This method provides a convenient way to dump a VPlan while debugging,
e.g. from lldb.

Reviewers: hsaito, Ayal, gilr, rengolin

Reviewed By: hsaito

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

4 years agoFix compatibility with python3 of clang-include-fixer.py
Yannick Brehon [Tue, 3 Dec 2019 11:52:59 +0000 (12:52 +0100)]
Fix compatibility with python3 of clang-include-fixer.py

clang-include-fixer was recently updated to be python3-compatible.
However, an exception handling clause was improperly using the deprecated `message` property of Exception classes, so the code was not yet entirely python3-compatible.

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

4 years ago[AArch64][SVE] Implement shift intrinsics
Kerry McLaughlin [Tue, 3 Dec 2019 11:26:18 +0000 (11:26 +0000)]
[AArch64][SVE] Implement shift intrinsics

Summary:
Adds the following intrinsics:
- asr & asrd
- insr
- lsl & lsr

This patch also adds a new AArch64ISD node (INSR) to represent the int_aarch64_sve_insr intrinsic.

Reviewers: huntergr, sdesmalen, dancgr, mgudim, rengolin, efriedma

Reviewed By: sdesmalen

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, cameron.mcinally, cfe-commits, llvm-commits

Tags: #llvm

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

4 years agogn build: Merge bc76dadb3cf
LLVM GN Syncbot [Tue, 3 Dec 2019 11:35:13 +0000 (11:35 +0000)]
gn build: Merge bc76dadb3cf

4 years ago[lldb][NFC] Extract searching for function SymbolContexts out of ClangExpressionDeclM...
Raphael Isemann [Fri, 29 Nov 2019 14:05:42 +0000 (15:05 +0100)]
[lldb][NFC] Extract searching for function SymbolContexts out of ClangExpressionDeclMap::LookupFunction

This code was just creating a new SymbolContextList with any found functions
in the front and orders them by how close they are to the current frame.
This refactors this code into its own function to make this more obvious.

Doesn't do any other changes to the code, so this is NFC.

4 years agoFix for buildbots
Sam Parker [Tue, 3 Dec 2019 11:30:38 +0000 (11:30 +0000)]
Fix for buildbots

Change pass name in pipeline test.

4 years ago[lldb] Remove all remaining tabs from TestReturnValue.py
Raphael Isemann [Tue, 3 Dec 2019 11:05:54 +0000 (12:05 +0100)]
[lldb] Remove all remaining tabs from TestReturnValue.py

I assumed this was just a single typo, but it seems we actually have
a whole bunch of tabs in this file which cause Python to complain
about mixing tabs and spaces.

4 years ago[CodeGen] Move ARMCodegenPrepare to TypePromotion
Sam Parker [Tue, 3 Dec 2019 11:00:32 +0000 (11:00 +0000)]
[CodeGen] Move ARMCodegenPrepare to TypePromotion

Convert ARMCodeGenPrepare into a generic type promotion pass by:
- Removing the insertion of arm specific intrinsics to handle narrow
  types as we weren't using this.
- Removing ARMSubtarget references.
- Now query a generic TLI object to know which types should be
  promoted and what they should be promoted to.
- Move all codegen tests into Transforms folder and testing using opt
  and not llc, which is how they should have been written in the
  first place...

The pass searches up from icmp operands in an attempt to safely
promote types so we can avoid generating unnecessary unsigned extends
during DAG ISel.

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

4 years ago[OpenCL] Fix mangling of single-overload builtins
Sven van Haastregt [Tue, 3 Dec 2019 11:07:48 +0000 (11:07 +0000)]
[OpenCL] Fix mangling of single-overload builtins

Commit 9a8d477a0e0 ("[OpenCL] Add builtin function attribute
handling", 2019-11-05) stopped Clang from mangling single-overload
builtins, which is incorrect.

4 years ago[lldb][NFC] Test going up/down one line in the multiline expression editor
Raphael Isemann [Tue, 3 Dec 2019 10:28:56 +0000 (11:28 +0100)]
[lldb][NFC] Test going up/down one line in the multiline expression editor

4 years ago[clang][CodeGen] Make use of cc1 instead of clang in the tests
Kadir Cetinkaya [Tue, 3 Dec 2019 11:02:12 +0000 (12:02 +0100)]
[clang][CodeGen] Make use of cc1 instead of clang in the tests

4 years agoFixup 6d18e53: xfail TestShowLocationDwarf5.py properly
Diana Picus [Tue, 3 Dec 2019 10:52:03 +0000 (11:52 +0100)]
Fixup 6d18e53: xfail TestShowLocationDwarf5.py properly

Forgot to squash this...

4 years ago[DWARF] Add support for parsing/dumping section indices in location lists
Pavel Labath [Thu, 21 Nov 2019 15:16:50 +0000 (16:16 +0100)]
[DWARF] Add support for parsing/dumping section indices in location lists

Summary:
This does exactly what it says on the box. The only small gotcha is the
section index computation for offset_pair entries, which can use either
the base address section, or the section from the offset_pair entry.
This is to support both the cases where the base address is relocated
(points to the base of the CU, typically), and the case where the base
address is a constant (typically zero) and relocations are on the
offsets themselves.

Reviewers: dblaikie, JDevlieghere, aprantl, SouraVX

Subscribers: hiraditya, llvm-commits, probinson

Tags: #llvm

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

4 years ago[lldb] Remove tab from TestReturnValue.py
Raphael Isemann [Tue, 3 Dec 2019 10:44:23 +0000 (11:44 +0100)]
[lldb] Remove tab from TestReturnValue.py

Mixing tabs and spaces makes Python exit with this error:

  File "llvm/lldb/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py", line 23
    return (self.getArchitecture() == "aarch64" and self.getPlatform() == "linux")
                                                                                 ^
TabError: inconsistent use of tabs and spaces in indentation

4 years ago[lldb] Move register info "augmentation" from gdb-remote into ABI
Pavel Labath [Tue, 3 Dec 2019 10:39:20 +0000 (11:39 +0100)]
[lldb] Move register info "augmentation" from gdb-remote into ABI

Summary:
Previously the ABI plugin exposed some "register infos" and the
gdb-remote code used those to fill in the missing bits. Now, the
"filling in" code is in the ABI plugin itself, and the gdb-remote code
just invokes that.

The motivation for this is two-fold:
a) the "augmentation" logic is useful outside of process gdb-remote. For
  instance, it would allow us to avoid repeating the register number
  definitions in minidump code.
b) It gives more implementation freedom to the ABI classes. Now that
  these "register infos" are essentially implementation details, classes
  can use other methods to obtain dwarf/eh_frame register numbers -- for
  instance they can consult llvm MC layer.

Since the augmentation code was not currently tested anywhere, I took
the opportunity to create a simple test for it.

Reviewers: jasonmolenda, clayborg, tatyana-krasnukha

Subscribers: aprantl, lldb-commits

Tags: #lldb

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

4 years ago[asan] Remove debug locations from alloca prologue instrumentation
Johannes Altmanninger [Mon, 2 Dec 2019 10:39:28 +0000 (11:39 +0100)]
[asan] Remove debug locations from alloca prologue instrumentation

Summary:
This fixes https://llvm.org/PR26673
"Wrong debugging information with -fsanitize=address"
where asan instrumentation causes the prologue end to be computed
incorrectly: findPrologueEndLoc, looks for the first instruction
with a debug location to determine the prologue end.  Since the asan
instrumentation instructions had debug locations, that prologue end was
at some instruction, where the stack frame is still being set up.

There seems to be no good reason for extra debug locations for the
asan instrumentations that set up the frame; they don't have a natural
source location.  In the debugger they are simply located at the start
of the function.

For certain other instrumentations like -fsanitize-coverage=trace-pc-guard
the same problem persists - that might be more work to fix, since it
looks like they rely on locations of the tracee functions.

This partly reverts aaf4bb239487e0a3b20a8eaf94fc641235ba2c29
"[asan] Set debug location in ASan function prologue"
whose motivation was to give debug location info to the coverage callback.
Its test only ensures that the call to @__sanitizer_cov_trace_pc_guard is
given the correct source location; as the debug location is still set in
ModuleSanitizerCoverage::InjectCoverageAtBlock, the test does not break.
So -fsanitize-coverage is hopefully unaffected - I don't think it should
rely on the debug locations of asan-generated allocas.

Related revision: 3c6c14d14b40adfb581940859ede1ac7d8ceae7a
"ASAN: Provide reliable debug info for local variables at -O0."

Below is how the X86 assembly version of the added test case changes.
We get rid of some .loc lines and put prologue_end where the user code starts.

```diff
--- 2.master.s 2019-12-02 12:32:38.982959053 +0100
+++ 2.patch.s 2019-12-02 12:32:41.106246674 +0100
@@ -45,8 +45,6 @@
  .cfi_offset %rbx, -24
  xorl %eax, %eax
  movl %eax, %ecx
- .Ltmp2:
-  .loc 1 3 0 prologue_end      # 2.c:3:0
  cmpl $0, __asan_option_detect_stack_use_after_return
  movl %edi, 92(%rbx)          # 4-byte Spill
  movq %rsi, 80(%rbx)          # 8-byte Spill
@@ -57,9 +55,7 @@
  callq __asan_stack_malloc_0
  movq %rax, 72(%rbx)          # 8-byte Spill
 .LBB1_2:
-  .loc 1 0 0 is_stmt 0         # 2.c:0:0
  movq 72(%rbx), %rax          # 8-byte Reload
-  .loc 1 3 0                   # 2.c:3:0
  cmpq $0, %rax
  movq %rax, %rcx
  movq %rax, 64(%rbx)          # 8-byte Spill
@@ -72,9 +68,7 @@
  movq %rax, %rsp
  movq %rax, 56(%rbx)          # 8-byte Spill
 .LBB1_4:
-  .loc 1 0 0                   # 2.c:0:0
  movq 56(%rbx), %rax          # 8-byte Reload
-  .loc 1 3 0                   # 2.c:3:0
  movq %rax, 120(%rbx)
  movq %rax, %rcx
  addq $32, %rcx
@@ -99,7 +93,6 @@
  movb %r8b, 31(%rbx)          # 1-byte Spill
  je .LBB1_7
 # %bb.5:
-  .loc 1 0 0                   # 2.c:0:0
  movq 40(%rbx), %rax          # 8-byte Reload
  andq $7, %rax
  addq $3, %rax
@@ -118,7 +111,8 @@
  movl %ecx, (%rax)
  movq 80(%rbx), %rdx          # 8-byte Reload
  movq %rdx, 128(%rbx)
- .loc 1 4 3 is_stmt 1         # 2.c:4:3
+.Ltmp2:
+ .loc 1 4 3 prologue_end      # 2.c:4:3
  movq %rax, %rdi
  callq f
  movq 48(%rbx), %rax          # 8-byte Reload
```

Reviewers: eugenis, aprantl

Reviewed By: eugenis

Subscribers: ormris, aprantl, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoTemporarily run machine-verifier once in test/CodeGen/SPARC/fp128.ll, so that
Jonas Paulsson [Tue, 3 Dec 2019 10:19:16 +0000 (11:19 +0100)]
Temporarily run machine-verifier once in test/CodeGen/SPARC/fp128.ll, so that
it XFAIL:s also without expensive checks.

See https://reviews.llvm.org/D63973

4 years agoImplicitNullChecks: Don't add a dead definition of DepMI as live-in
Jonas Paulsson [Tue, 19 Nov 2019 12:15:12 +0000 (13:15 +0100)]
ImplicitNullChecks: Don't add a dead definition of DepMI as live-in

This is one of the fixes needed to reapply D68267 which improves verification
of live-in lists.

Review: craig.topper
https://reviews.llvm.org/D70434

4 years ago[LiveDebugValues] Introduce entry values of unmodified params
Djordje Todorovic [Thu, 21 Nov 2019 10:07:39 +0000 (11:07 +0100)]
[LiveDebugValues] Introduce entry values of unmodified params

The idea is to remove front-end analysis for the parameter's value
modification and leave it to the value tracking system. Front-end in some
cases marks a parameter as modified even the line of code that modifies the
parameter gets optimized, that implies that this will cover more entry
values even. In addition, extending the support for modified parameters
will be easier with this approach.

Since the goal is to recognize if a parameter’s value has changed, the idea
at very high level is: If we encounter a DBG_VALUE other than the entry
value one describing the same variable (parameter), we can assume that the
variable’s value has changed and we should not track its entry value any
more. That would be ideal scenario, but due to various LLVM optimizations,
a variable’s value could be just moved around from one register to another
(and there will be additional DBG_VALUEs describing the same variable), so
we have to recognize such situation (otherwise, we will lose a lot of entry
values) and salvage the debug entry value.

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

4 years agoMark some tests as xfail on AArch64 Linux
Diana Picus [Tue, 19 Nov 2019 09:58:52 +0000 (10:58 +0100)]
Mark some tests as xfail on AArch64 Linux

I have either opened new bug reports for these tests, or added links to
existing bugs.

This should help make the lldb-aarch64-ubuntu buildbot green (there will
still be some unexpected passes that someone should look into, but those
can be handled later).