platform/upstream/llvm.git
4 years ago[libunwind] Fix issues introduced in r374606
Petr Hosek [Sat, 12 Oct 2019 01:50:57 +0000 (01:50 +0000)]
[libunwind] Fix issues introduced in r374606

There are few differences in compile flags introduced in r374606
which are causing libcxx-libcxxabi-libunwind-armv8-linux to fail.
This change should address all of those, I've compared the generated
build file from before r374606 and with this change and the set of
flags is the same modulo order.

llvm-svn: 374624

4 years ago[asan] Return true from instrumentModule
Vitaly Buka [Sat, 12 Oct 2019 01:50:36 +0000 (01:50 +0000)]
[asan] Return true from instrumentModule

createSanitizerCtorAndInitFunctions always change the module.

llvm-svn: 374623

4 years ago[platform process list] add a flag for showing the processes of all users
Walter Erquinigo [Sat, 12 Oct 2019 01:33:21 +0000 (01:33 +0000)]
[platform process list] add a flag for showing the processes of all users

Summary:
For context: https://reviews.llvm.org/D68293

We need a way to show all the processes on android regardless of the user id.
When you run `platform process list`, you only see the processes with the same user as the user that launched lldb-server. However, it's quite useful to see all the processes, though, and it will lay a foundation for full apk debugging support from lldb.

Before:
```
PID    PARENT USER       TRIPLE                   NAME
====== ====== ========== ======================== ============================
3234   1                 aarch64-unknown-linux-android adbd
8034   3234              aarch64-unknown-linux-android sh
9096   3234              aarch64-unknown-linux-android sh
9098   9096              aarch64-unknown-linux-android lldb-server
(lldb) ^D
```

Now:
```
(lldb) platform process list -x
205 matching processes were found on "remote-android"
PID    PARENT USER       TRIPLE                   NAME
====== ====== ========== ======================== ============================
1      0                                          init
524    1                                          init
525    1                                          init
531    1                                          ueventd
568    1                                          logd
569    1                 aarch64-unknown-linux-android servicemanager
570    1                 aarch64-unknown-linux-android hwservicemanager
571    1                 aarch64-unknown-linux-android vndservicemanager
577    1                 aarch64-unknown-linux-android qseecomd
580    577               aarch64-unknown-linux-android qseecomd
...
23816  979                                        com.android.providers.calendar
24600  979                                        com.verizon.mips.services
27888  979                                        com.hualai
28043  2378                                       com.android.chrome:sandboxed_process0
31449  979                                        com.att.shm
31779  979                                        com.samsung.android.authfw
31846  979                                        com.samsung.android.server.iris
32014  979                                        com.samsung.android.MtpApplication
32045  979                                        com.samsung.InputEventApp
```

Reviewers: labath,xiaobai,aadsm,clayborg

Subscribers:

> llvm-svn: 374584

llvm-svn: 374622

4 years agoRevert "[platform process list] add a flag for showing the processes of all users"
Walter Erquinigo [Sat, 12 Oct 2019 01:08:50 +0000 (01:08 +0000)]
Revert "[platform process list] add a flag for showing the processes of all users"

This reverts commit 08781f4c53a177662c029d3da9c407ba65ae6747.

llvm-svn: 374621

4 years ago[platform process list] add a flag for showing the processes of all users
Walter Erquinigo [Sat, 12 Oct 2019 00:44:50 +0000 (00:44 +0000)]
[platform process list] add a flag for showing the processes of all users

Summary:
For context: https://reviews.llvm.org/D68293

We need a way to show all the processes on android regardless of the user id.
When you run `platform process list`, you only see the processes with the same user as the user that launched lldb-server. However, it's quite useful to see all the processes, though, and it will lay a foundation for full apk debugging support from lldb.

Before:
```
PID    PARENT USER       TRIPLE                   NAME
====== ====== ========== ======================== ============================
3234   1                 aarch64-unknown-linux-android adbd
8034   3234              aarch64-unknown-linux-android sh
9096   3234              aarch64-unknown-linux-android sh
9098   9096              aarch64-unknown-linux-android lldb-server
(lldb) ^D
```

Now:
```
(lldb) platform process list -x
205 matching processes were found on "remote-android"
PID    PARENT USER       TRIPLE                   NAME
====== ====== ========== ======================== ============================
1      0                                          init
524    1                                          init
525    1                                          init
531    1                                          ueventd
568    1                                          logd
569    1                 aarch64-unknown-linux-android servicemanager
570    1                 aarch64-unknown-linux-android hwservicemanager
571    1                 aarch64-unknown-linux-android vndservicemanager
577    1                 aarch64-unknown-linux-android qseecomd
580    577               aarch64-unknown-linux-android qseecomd
...
23816  979                                        com.android.providers.calendar
24600  979                                        com.verizon.mips.services
27888  979                                        com.hualai
28043  2378                                       com.android.chrome:sandboxed_process0
31449  979                                        com.att.shm
31779  979                                        com.samsung.android.authfw
31846  979                                        com.samsung.android.server.iris
32014  979                                        com.samsung.android.MtpApplication
32045  979                                        com.samsung.InputEventApp
```

Reviewers: labath,xiaobai,aadsm,clayborg

Subscribers:

> llvm-svn: 374584

llvm-svn: 374620

4 years agoDebugInfo: Fix msan use-of-uninitialized exposed by r374600
David Blaikie [Sat, 12 Oct 2019 00:27:12 +0000 (00:27 +0000)]
DebugInfo: Fix msan use-of-uninitialized exposed by r374600

llvm-svn: 374619

4 years ago[llvm-profdata] Make "malformed-ptr-to-counter-array.test" textual
Vedant Kumar [Sat, 12 Oct 2019 00:23:15 +0000 (00:23 +0000)]
[llvm-profdata] Make "malformed-ptr-to-counter-array.test" textual

As pointed out in https://reviews.llvm.org/D66979 post-commit, making
this test textual would make it more maintainable.

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

llvm-svn: 374617

4 years agoTemporarily Revert [platform process list] add a flag for showing the processes of...
Adrian Prantl [Sat, 12 Oct 2019 00:03:40 +0000 (00:03 +0000)]
Temporarily Revert [platform process list] add a flag for showing the processes of all users

as it breaks the bots.

This reverts r374609 (git commit 696d3cf8ad6f3a0b3019c87526d561bb77ad538e)

llvm-svn: 374616

4 years ago[X86] Fold a VTRUNCS/VTRUNCUS+store into a saturating truncating store.
Craig Topper [Sat, 12 Oct 2019 00:01:08 +0000 (00:01 +0000)]
[X86] Fold a VTRUNCS/VTRUNCUS+store into a saturating truncating store.

We already did this for VTRUNCUS with a specific combination of
types. This extends this to VTRUNCS and handles any types where
a truncating store is legal.

llvm-svn: 374615

4 years ago[X86] Add test case showing missing opportunity to fold vmovsdb into a store after...
Craig Topper [Sat, 12 Oct 2019 00:00:59 +0000 (00:00 +0000)]
[X86] Add test case showing missing opportunity to fold vmovsdb into a store after type legalization. NFC

llvm-svn: 374614

4 years agoDebugInfo: Reduce the scope of some variables related to debug_ranges emission
David Blaikie [Fri, 11 Oct 2019 23:51:24 +0000 (23:51 +0000)]
DebugInfo: Reduce the scope of some variables related to debug_ranges emission

Minor tidy up/NFC

llvm-svn: 374613

4 years ago[libFuzzer] Don't prefix absolute paths in fuchsia.
Jake Ehrlich [Fri, 11 Oct 2019 23:35:13 +0000 (23:35 +0000)]
[libFuzzer] Don't prefix absolute paths in fuchsia.

The ExecuteCommand function in fuchsia used to prefix the
getOutputFile for each command run with the artifact_prefix flag if
it was available, because fuchsia components don't have a writable working
directory. However, if a file with a global path is provided, fuchsia
should honor that.

An example of this is using the global /tmp directory to store stuff.
In fuchsia it ended up being translated to data///tmp, whereas we want
to make sure it is using /tmp (which is available to components using the
isolated-temp feature).

To test this I made the change, compiled fuchsia with this toolchain and
ran a fuzzer with the -fork=1 flag (that mode makes use of the /tmp
directory). I also tested that normal fuzzing workflow was not affected
by this.

Author: charco (Marco Vanotti)
Differential Revision: https://reviews.llvm.org/D68774

llvm-svn: 374612

4 years agogn build: (manually) merge r374606 better
Nico Weber [Fri, 11 Oct 2019 23:22:36 +0000 (23:22 +0000)]
gn build: (manually) merge r374606 better

llvm-svn: 374611

4 years agogn build: Merge r235758
GN Sync Bot [Fri, 11 Oct 2019 23:12:04 +0000 (23:12 +0000)]
gn build: Merge r235758

llvm-svn: 374610

4 years ago[platform process list] add a flag for showing the processes of all users
Walter Erquinigo [Fri, 11 Oct 2019 23:10:34 +0000 (23:10 +0000)]
[platform process list] add a flag for showing the processes of all users

Summary:
For context: https://reviews.llvm.org/D68293

We need a way to show all the processes on android regardless of the user id.
When you run `platform process list`, you only see the processes with the same user as the user that launched lldb-server. However, it's quite useful to see all the processes, though, and it will lay a foundation for full apk debugging support from lldb.

Before:
```
PID    PARENT USER       TRIPLE                   NAME
====== ====== ========== ======================== ============================
3234   1                 aarch64-unknown-linux-android adbd
8034   3234              aarch64-unknown-linux-android sh
9096   3234              aarch64-unknown-linux-android sh
9098   9096              aarch64-unknown-linux-android lldb-server
(lldb) ^D
```

Now:
```
(lldb) platform process list -x
205 matching processes were found on "remote-android"
PID    PARENT USER       TRIPLE                   NAME
====== ====== ========== ======================== ============================
1      0                                          init
524    1                                          init
525    1                                          init
531    1                                          ueventd
568    1                                          logd
569    1                 aarch64-unknown-linux-android servicemanager
570    1                 aarch64-unknown-linux-android hwservicemanager
571    1                 aarch64-unknown-linux-android vndservicemanager
577    1                 aarch64-unknown-linux-android qseecomd
580    577               aarch64-unknown-linux-android qseecomd
...
23816  979                                        com.android.providers.calendar
24600  979                                        com.verizon.mips.services
27888  979                                        com.hualai
28043  2378                                       com.android.chrome:sandboxed_process0
31449  979                                        com.att.shm
31779  979                                        com.samsung.android.authfw
31846  979                                        com.samsung.android.server.iris
32014  979                                        com.samsung.android.MtpApplication
32045  979                                        com.samsung.InputEventApp
```

Reviewers: labath,xiaobai,aadsm,clayborg

Subscribers:

> llvm-svn: 374584

llvm-svn: 374609

4 years agogn build: Cmanually) merge r374590
Nico Weber [Fri, 11 Oct 2019 23:05:24 +0000 (23:05 +0000)]
gn build: Cmanually) merge r374590

llvm-svn: 374608

4 years ago[AMDGPU] Use GCN prefix in dpp_combine.mir. NFC.
Stanislav Mekhanoshin [Fri, 11 Oct 2019 22:28:04 +0000 (22:28 +0000)]
[AMDGPU] Use GCN prefix in dpp_combine.mir. NFC.

llvm-svn: 374607

4 years ago[libunwind] Refactor CMake flag checks to match libc++ and libc++abi
Petr Hosek [Fri, 11 Oct 2019 22:22:29 +0000 (22:22 +0000)]
[libunwind] Refactor CMake flag checks to match libc++ and libc++abi

libunwind was using its own set of macros/functions for flag checking
which was similar but different from libc++ and libc++abi. This made
it difficult to replicate the same checks across projects, in fact
there were some checks that appear to have been copy & pasted from
another project and that were broken in the standalone libunwind build.
This change refactors flag checks to match libc++ and libc++abi using
a copy of HandleLibunwindFlags.cmake which is derived from the versions
used by the other projects. This also paves a road to deduplicating and
unifying HandleLibunwindFlags.cmake, HandleLibcxxabiFlags.cmake and
HandleLibcxxFlags.cmake post monorepo switch.

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

llvm-svn: 374606

4 years ago[AMDGPU] link dpp pseudos and real instructions on gfx10
Stanislav Mekhanoshin [Fri, 11 Oct 2019 22:03:36 +0000 (22:03 +0000)]
[AMDGPU] link dpp pseudos and real instructions on gfx10

This defaults to zero fi operand, but we do not expose it
anyway. Should we expose it later it needs to be added to
the pseudo.

This enables dpp combining on gfx10.

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

llvm-svn: 374604

4 years agoRevert "[platform process list] add a flag for showing the processes of all users"
Walter Erquinigo [Fri, 11 Oct 2019 21:58:49 +0000 (21:58 +0000)]
Revert "[platform process list] add a flag for showing the processes of all users"

Summary:
This reverts commit e4ac611cd787f3f0e727a394e96fb1a5c3b19ccb.

There's a failure according to http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/2538/testReport/junit/lldb-api/functionalities_gdb_remote_client/TestPlatformClient_py/

Reviewers: labath, aadsm, clayborg

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374603

4 years ago[lit] Small cleanups in main.py
Julian Lettner [Fri, 11 Oct 2019 21:57:09 +0000 (21:57 +0000)]
[lit] Small cleanups in main.py

* Extract separate function for running tests from main
* Push single-usage imports to point of usage
* Remove unnecessary sys.exit(0) calls

Reviewed By: rnk

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

llvm-svn: 374602

4 years ago[lit] Change regex filter to ignore case
Julian Lettner [Fri, 11 Oct 2019 21:57:06 +0000 (21:57 +0000)]
[lit] Change regex filter to ignore case

Make regex filter `--filter=REGEX` option more lenient via
`re.IGNORECASE`.

Reviewed By: yln

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

llvm-svn: 374601

4 years agoDebugInfo: Use base address selection entries for debug_loc
David Blaikie [Fri, 11 Oct 2019 21:52:41 +0000 (21:52 +0000)]
DebugInfo: Use base address selection entries for debug_loc

Unify the range and loc emission (for both DWARFv4 and DWARFv5 style lists) and take advantage of that unification to use strategic base addresses for loclists.

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

llvm-svn: 374600

4 years ago[mips] Remove unused local variables. NFC
Simon Atanasyan [Fri, 11 Oct 2019 21:51:39 +0000 (21:51 +0000)]
[mips] Remove unused local variables. NFC

llvm-svn: 374599

4 years ago[mips] Store 64-bit `li.d' operand as a single 8-byte value
Simon Atanasyan [Fri, 11 Oct 2019 21:51:33 +0000 (21:51 +0000)]
[mips] Store 64-bit `li.d' operand as a single 8-byte value

Now assembler generates two consecutive `.4byte` directives to store
64-bit `li.d' operand. The first directive stores high 4-byte of the
value. The second directive stores low 4-byte of the value. But on
64-bit system we load this value at once and get wrong result if the
system is little-endian.

This patch fixes the bug. It stores the `li.d' operand as a single
8-byte value.

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

llvm-svn: 374598

4 years ago[mips] Use less instruction to load zero into FPR by li.s / li.d pseudos
Simon Atanasyan [Fri, 11 Oct 2019 21:51:23 +0000 (21:51 +0000)]
[mips] Use less instruction to load zero into FPR by li.s / li.d pseudos

If `li.s` or `li.d` loads zero into a FPR, it's not necessary to load
zero into `at` GPR register and then move its value into a floating
point register. We can use as a source register the `zero / $0` one.

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

llvm-svn: 374597

4 years ago[ObjC] Remove default parameter no caller was providing. NFC intended.
Volodymyr Sapsai [Fri, 11 Oct 2019 21:21:02 +0000 (21:21 +0000)]
[ObjC] Remove default parameter no caller was providing. NFC intended.

Currently there is no need to make ObjCTypeParamType have a canonical type
different from the one in corresponding ObjCTypeParamDecl. So remove the
corresponding unused API.

llvm-svn: 374596

4 years ago[GISel][UnitTest] Fix a bunch of tests that were not doing anything
Quentin Colombet [Fri, 11 Oct 2019 20:58:26 +0000 (20:58 +0000)]
[GISel][UnitTest] Fix a bunch of tests that were not doing anything

After r368065, all the tests using GISelMITest must call setUp() before
doing anything, otherwise the TargetMachine is not going to be set up.
A few tests added after that commit were not doing that and ended up
testing effectively nothing.

Fix the setup of all the tests and fix the failing tests.

llvm-svn: 374595

4 years agoRelease notes: Add the option WarnForDeadNestedAssignments
Sylvestre Ledru [Fri, 11 Oct 2019 20:33:43 +0000 (20:33 +0000)]
Release notes: Add the option WarnForDeadNestedAssignments
https://reviews.llvm.org/D66733

llvm-svn: 374593

4 years agoRevert 374373: [Codegen] Alter the default promotion for saturating adds and subs
David Green [Fri, 11 Oct 2019 20:33:03 +0000 (20:33 +0000)]
Revert 374373: [Codegen] Alter the default promotion for saturating adds and subs

This commit is not extending the promoted integers as it should. Reverting
whilst I look into the details.

llvm-svn: 374592

4 years agoSet GNUC version in the LLDB expression parser.
Adrian Prantl [Fri, 11 Oct 2019 20:27:51 +0000 (20:27 +0000)]
Set GNUC version in the LLDB expression parser.

This adapts LLDB for https://reviews.llvm.org/D68055.

Darwin's libC headers expect the GNUC macro to be set.

llvm-svn: 374591

4 years ago[Mips][llvm-exegesis] Add a Mips target
Simon Atanasyan [Fri, 11 Oct 2019 20:26:08 +0000 (20:26 +0000)]
[Mips][llvm-exegesis] Add a Mips target

The target does just enough to be able to run llvm-exegesis in latency
mode for at least some opcodes.

Patch by MiloÅ¡ Stojanović.

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

llvm-svn: 374590

4 years ago[GISel][CallLowering] Enable vector support in argument lowering
Quentin Colombet [Fri, 11 Oct 2019 20:22:57 +0000 (20:22 +0000)]
[GISel][CallLowering] Enable vector support in argument lowering

The exciting code is actually already enough to handle the splitting
of vector arguments but we were lacking a test case.

This commit adds a test case for vector argument lowering involving
splitting and enable the related support in call lowering.

llvm-svn: 374589

4 years ago[MachineIRBuilder] Fix an assertion failure with buildMerge
Quentin Colombet [Fri, 11 Oct 2019 20:22:47 +0000 (20:22 +0000)]
[MachineIRBuilder] Fix an assertion failure with buildMerge

Teach buildMerge how to deal with scalar to vector kind of requests.

Prior to this patch, buildMerge would issue either a G_MERGE_VALUES
when all the vregs are scalars or a G_CONCAT_VECTORS when the destination
vreg is a vector.
G_CONCAT_VECTORS was actually not the proper instruction when the source
vregs were scalars and the compiler would assert that the sources must
be vectors. Instead we want is to issue a G_BUILD_VECTOR when we are
in this situation.

This patch fixes that.

llvm-svn: 374588

4 years ago[NativePDB] Remove unused references to ClangASTImporter
Alex Langford [Fri, 11 Oct 2019 20:12:29 +0000 (20:12 +0000)]
[NativePDB] Remove unused references to ClangASTImporter

llvm-svn: 374587

4 years agoAdd -fgnuc-version to ClangModuleCompilationOptions on Darwin.
Adrian Prantl [Fri, 11 Oct 2019 19:54:09 +0000 (19:54 +0000)]
Add -fgnuc-version to ClangModuleCompilationOptions on Darwin.

This adapts LLDB for https://reviews.llvm.org/D68055.

Darwin's libC headers expect the GNUC macro to be set.

llvm-svn: 374585

4 years ago[platform process list] add a flag for showing the processes of all users
Walter Erquinigo [Fri, 11 Oct 2019 19:41:12 +0000 (19:41 +0000)]
[platform process list] add a flag for showing the processes of all users

Summary:
For context: https://reviews.llvm.org/D68293

We need a way to show all the processes on android regardless of the user id.
When you run `platform process list`, you only see the processes with the same user as the user that launched lldb-server. However, it's quite useful to see all the processes, though, and it will lay a foundation for full apk debugging support from lldb.

Before:
```
PID    PARENT USER       TRIPLE                   NAME
====== ====== ========== ======================== ============================
3234   1                 aarch64-unknown-linux-android adbd
8034   3234              aarch64-unknown-linux-android sh
9096   3234              aarch64-unknown-linux-android sh
9098   9096              aarch64-unknown-linux-android lldb-server
(lldb) ^D
```

Now:
```
(lldb) platform process list -x
205 matching processes were found on "remote-android"
PID    PARENT USER       TRIPLE                   NAME
====== ====== ========== ======================== ============================
1      0                                          init
524    1                                          init
525    1                                          init
531    1                                          ueventd
568    1                                          logd
569    1                 aarch64-unknown-linux-android servicemanager
570    1                 aarch64-unknown-linux-android hwservicemanager
571    1                 aarch64-unknown-linux-android vndservicemanager
577    1                 aarch64-unknown-linux-android qseecomd
580    577               aarch64-unknown-linux-android qseecomd
...
23816  979                                        com.android.providers.calendar
24600  979                                        com.verizon.mips.services
27888  979                                        com.hualai
28043  2378                                       com.android.chrome:sandboxed_process0
31449  979                                        com.att.shm
31779  979                                        com.samsung.android.authfw
31846  979                                        com.samsung.android.server.iris
32014  979                                        com.samsung.android.MtpApplication
32045  979                                        com.samsung.InputEventApp
```

Reviewers: labath,xiaobai,aadsm,clayborg

Subscribers:

llvm-svn: 374584

4 years agomake ConstString allocate memory in non-tiny chunks
Lubos Lunak [Fri, 11 Oct 2019 19:34:39 +0000 (19:34 +0000)]
make ConstString allocate memory in non-tiny chunks

BumpPtrAllocator allocates in 4KiB chunks, which with any larger
project is going to result in a large number of allocations.
Increasing allocation size this way can save 10%-20% of symbol
load time for a huge C++ project with correctly built debuginfo.

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

llvm-svn: 374583

4 years agollvm-dwarfdump: Add verbose printing for debug_loclists
David Blaikie [Fri, 11 Oct 2019 19:06:35 +0000 (19:06 +0000)]
llvm-dwarfdump: Add verbose printing for debug_loclists

llvm-svn: 374582

4 years ago[Stats] Convert some ad-hoc header search stats to ALWAYS_ENABLED_STATISTIC.
Volodymyr Sapsai [Fri, 11 Oct 2019 18:22:34 +0000 (18:22 +0000)]
[Stats] Convert some ad-hoc header search stats to ALWAYS_ENABLED_STATISTIC.

rdar://problem/55715134

Reviewers: dsanders, bogner, rtereshin

Reviewed By: dsanders

Subscribers: hiraditya, jkorous, dexonsmith, ributzka, cfe-commits, llvm-commits

Tags: #llvm

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

llvm-svn: 374581

4 years agoSuppress false-positive -Wdeprecated-volatile warning from __is_*_assignable(volatile...
Richard Smith [Fri, 11 Oct 2019 17:59:09 +0000 (17:59 +0000)]
Suppress false-positive -Wdeprecated-volatile warning from __is_*_assignable(volatile T&, U).

llvm-svn: 374580

4 years ago[X86][SSE] Add support for v4i8 add reduction
Simon Pilgrim [Fri, 11 Oct 2019 17:54:15 +0000 (17:54 +0000)]
[X86][SSE] Add support for v4i8 add reduction

llvm-svn: 374579

4 years ago[lldb] Fix python packages install path
Haibo Huang [Fri, 11 Oct 2019 17:44:14 +0000 (17:44 +0000)]
[lldb] Fix python packages install path

Reviewers: mgorny

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374577

4 years agoIOHandler: fall back on File::Read if a FILE* isn't available.
Lawrence D'Anna [Fri, 11 Oct 2019 17:43:32 +0000 (17:43 +0000)]
IOHandler: fall back on File::Read if a FILE* isn't available.

Summary:
IOHandler needs to read lines of input from a lldb::File.
The way it currently does this using, FILE*, which is something
we want to avoid now.   I'd prefer to just replace the FILE* code
with calls to File::Read, but it contains an awkward and
delicate workaround specific to ctrl-C handling on windows, and
it's not clear if or how that workaround would translate to
lldb::File.

So in this patch, we use use the FILE* if it's available, and only
fall back on File::Read if that's the only option.

I think this is a reasonable approach here for two reasons.  First
is that interactive terminal support is the one area where FILE*
can't be avoided.   We need them for libedit and curses anyway,
and using them here as well is consistent with that pattern.

The second reason is that the comments express a hope that the
underlying windows bug that's being worked around will be fixed one
day, so hopefully when that happens, that whole path can be deleted.

Reviewers: JDevlieghere, jasonmolenda, labath, lanza

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374576

4 years agogn build: (manually) merge r374110
Nico Weber [Fri, 11 Oct 2019 17:42:24 +0000 (17:42 +0000)]
gn build: (manually) merge r374110

llvm-svn: 374575

4 years ago[lldb] Mark import-std-module/empty-module as libc++ test
Raphael Isemann [Fri, 11 Oct 2019 17:34:44 +0000 (17:34 +0000)]
[lldb] Mark import-std-module/empty-module as libc++ test

Same as with the import-std-module/sysroot test before.

llvm-svn: 374574

4 years ago[clang][IFS] Fixing assert in clang interface stubs for enums, records, typedefs
Puyan Lotfi [Fri, 11 Oct 2019 17:24:11 +0000 (17:24 +0000)]
[clang][IFS] Fixing assert in clang interface stubs for enums, records, typedefs

The clang IFS ASTConsumer was asserting on enums, records (struct definitions in
C), and typedefs. All it needs to do is skip them because the stub just needs to
expose global object instances and functions.

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

llvm-svn: 374573

4 years ago[lldb] Add import-std-module/sysroot to the libc++ test category.
Raphael Isemann [Fri, 11 Oct 2019 17:17:58 +0000 (17:17 +0000)]
[lldb] Add import-std-module/sysroot to the libc++ test category.

We essentially test libc++ in a sysroot here so let's make sure
that we actually only run this test on platforms where libc++
testing is enabled.

llvm-svn: 374572

4 years agoUpdate clang module map for new excluded .def file.
Richard Smith [Fri, 11 Oct 2019 17:00:34 +0000 (17:00 +0000)]
Update clang module map for new excluded .def file.

llvm-svn: 374571

4 years ago[lldb-test] Modify lldb-test to print out ASTs from symbol file
Shafik Yaghmour [Fri, 11 Oct 2019 16:36:20 +0000 (16:36 +0000)]
[lldb-test] Modify lldb-test to print out ASTs from symbol file

Summary:
Currently when invoking lldb-test symbols -dump-ast it parses all the debug symbols and calls print(...) on the TranslationUnitDecl.
While useful the TranslationUnitDecl::print(...) method gives us a higher level view then the dump from ASTDumper which is what we get when we invoke dump() on a specific AST node.
The main motivation for this change is allow us to verify that the AST nodes we create when we parse DWARF. For example in order to verify we are correctly using DIFlagExportSymbols added by D66667

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

llvm-svn: 374570

4 years agoFix test failure with 374562 on Hexagon
Erich Keane [Fri, 11 Oct 2019 16:30:45 +0000 (16:30 +0000)]
Fix test failure with 374562 on Hexagon

__builtin_assume_aligned takes a size_t which is a 32 bit int on
hexagon.  Thus, the constant gets converted to a 32 bit value, resulting
in 0 not being a power of 2.  This patch changes the constant being
passed to 2**30 so that it fails, but doesnt exceed 30 bits.

llvm-svn: 374569

4 years ago[AArch64] add tests for (v)select-of-constants; NFC
Sanjay Patel [Fri, 11 Oct 2019 16:10:23 +0000 (16:10 +0000)]
[AArch64] add tests for (v)select-of-constants; NFC

These are copied from existing test files in x86/PPC.

llvm-svn: 374568

4 years ago[AArch64][SVE] Implement sdot and udot (lane) intrinsics
Kerry McLaughlin [Fri, 11 Oct 2019 15:53:41 +0000 (15:53 +0000)]
[AArch64][SVE] Implement sdot and udot (lane) intrinsics

Summary:
Implements the following arithmetic intrinsics:
  - int_aarch64_sve_sdot
  - int_aarch64_sve_sdot_lane
  - int_aarch64_sve_udot
  - int_aarch64_sve_udot_lane

This patch includes tests for the Subdivide4Argument type added by D67549

Reviewers: sdesmalen, SjoerdMeijer, greened, rengolin, rovka

Reviewed By: sdesmalen

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

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

llvm-svn: 374566

4 years ago[VPlan] Add moveAfter to VPRecipeBase.
Florian Hahn [Fri, 11 Oct 2019 15:36:55 +0000 (15:36 +0000)]
[VPlan] Add moveAfter to VPRecipeBase.

This patch adds a moveAfter method to VPRecipeBase, which can be used to
move elements after other elements, across VPBasicBlocks, if necessary.

Reviewers: dcaballe, hsaito, rengolin, hfinkel

Reviewed By: dcaballe

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

llvm-svn: 374565

4 years ago[AIX] Use .space instead of .zero in assembly
David Tenty [Fri, 11 Oct 2019 15:07:28 +0000 (15:07 +0000)]
[AIX] Use .space instead of .zero in assembly

Summary:
The AIX system assembler does not understand .zero, so we should prefer
emitting .space.

Subscribers: nemanjai, hiraditya, kbarton, MaskRay, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 374564

4 years agoReland r374450 with Richard Smith's comments and test fixed.
Erich Keane [Fri, 11 Oct 2019 14:59:44 +0000 (14:59 +0000)]
Reland r374450 with Richard Smith's comments and test fixed.

The behavior from the original patch has changed, since we're no longer
allowing LLVM to just ignore the alignment.  Instead, we're just
assuming the maximum possible alignment.

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

llvm-svn: 374562

4 years ago[AMDGPU][MC][GFX9][GFX10] Corrected number of src operands for ds_[read/write]_addtid_b32
Dmitry Preobrazhensky [Fri, 11 Oct 2019 14:53:26 +0000 (14:53 +0000)]
[AMDGPU][MC][GFX9][GFX10] Corrected number of src operands for ds_[read/write]_addtid_b32

See https://bugs.llvm.org/show_bug.cgi?id=37941

Reviewers: arsenm, rampitec

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

llvm-svn: 374561

4 years agogn build: Merge r374558
GN Sync Bot [Fri, 11 Oct 2019 14:48:31 +0000 (14:48 +0000)]
gn build: Merge r374558

llvm-svn: 374560

4 years ago[AMDGPU][MC][GFX6][GFX7][GFX10] Added instructions buffer_atomic_[fcmpswap/fmin/fmax]*
Dmitry Preobrazhensky [Fri, 11 Oct 2019 14:44:51 +0000 (14:44 +0000)]
[AMDGPU][MC][GFX6][GFX7][GFX10] Added instructions buffer_atomic_[fcmpswap/fmin/fmax]*

See https://bugs.llvm.org/show_bug.cgi?id=28232

Reviewers: arsenm, rampitec

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

llvm-svn: 374559

4 years ago[libTooling] Move `RewriteRule` abstraction into its own header and impl.
Yitzhak Mandelbaum [Fri, 11 Oct 2019 14:43:46 +0000 (14:43 +0000)]
[libTooling] Move `RewriteRule` abstraction into its own header and impl.

Summary: Move the `RewriteRule` class and related declarations into its own set
of files (header, implementation). Only the `Transformer` class is left in the
Transformer-named files. This change clarifies the distinction between the
`RewriteRule` class, which is essential to the Transformer library, and the
`Transformer` class, which is only one possible `RewriteRule` interpreter
(compare to `TransformerClangTidyCheck`, a clang-tidy based interpreter).

Reviewers: gribozavr

Subscribers: jfb, cfe-commits

Tags: #clang

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

llvm-svn: 374558

4 years ago[AMDGPU][MC][GFX10] Enabled null for 64-bit dst operands
Dmitry Preobrazhensky [Fri, 11 Oct 2019 14:35:11 +0000 (14:35 +0000)]
[AMDGPU][MC][GFX10] Enabled null for 64-bit dst operands

See https://bugs.llvm.org/show_bug.cgi?id=43524

Reviewers: arsenm, rampitec

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

llvm-svn: 374557

4 years ago[llvm] [ocaml] Support linking against dylib
Michal Gorny [Fri, 11 Oct 2019 14:32:43 +0000 (14:32 +0000)]
[llvm] [ocaml] Support linking against dylib

Support linking OCaml modules against LLVM dylib when requested,
rather than against static libs that might not be installed at all.

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

llvm-svn: 374556

4 years ago[DAGCombiner] fold vselect-of-constants to shift
Sanjay Patel [Fri, 11 Oct 2019 14:17:56 +0000 (14:17 +0000)]
[DAGCombiner] fold vselect-of-constants to shift

The diffs suggest that we are missing some more basic
analysis/transforms, but this keeps the vector path in
sync with the scalar (rL374397). This is again a
preliminary step for introducing the reverse transform
in IR as proposed in D63382.

llvm-svn: 374555

4 years agoFix compilation warnings. NFC.
Michael Liao [Fri, 11 Oct 2019 14:09:44 +0000 (14:09 +0000)]
Fix compilation warnings. NFC.

llvm-svn: 374554

4 years ago[AMDGPU][MC] Corrected parsing of optional operands
Dmitry Preobrazhensky [Fri, 11 Oct 2019 14:05:09 +0000 (14:05 +0000)]
[AMDGPU][MC] Corrected parsing of optional operands

See https://bugs.llvm.org/show_bug.cgi?id=43486

Reviewers: artem.tamazov, arsenm

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

llvm-svn: 374553

4 years ago[libTooling] Change Stencil equality to use `toString()`
Yitzhak Mandelbaum [Fri, 11 Oct 2019 14:02:03 +0000 (14:02 +0000)]
[libTooling] Change Stencil equality to use `toString()`

Summary:
Removes the `isEqual` method from StencilPartInterface and modifies equality to
use the string representation returned by the `toString` method for comparison.

This means the `run` and `selection` stencils return true by default, and
clients should be cautious in relying on equality operator for comparison of
stencils containing parts generated by these functions.

It also means we no longer need the custom RTTI support (typeId() and
down_cast()), so it has been removed.

Patch by Harshal T. Lehri.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 374552

4 years agoUpdated add_new_check.py to create checker tests in the new directory
Dmitri Gribenko [Fri, 11 Oct 2019 13:46:55 +0000 (13:46 +0000)]
Updated add_new_check.py to create checker tests in the new directory

llvm-svn: 374551

4 years ago[ClangTidy] Separate tests for infrastructure and checkers, fixup
Dmitri Gribenko [Fri, 11 Oct 2019 13:16:49 +0000 (13:16 +0000)]
[ClangTidy] Separate tests for infrastructure and checkers, fixup

Renamed a file that I missed in r374540.

llvm-svn: 374549

4 years ago[mips] Follow-up to r374544. Fix test case.
Simon Atanasyan [Fri, 11 Oct 2019 12:58:37 +0000 (12:58 +0000)]
[mips] Follow-up to r374544. Fix test case.

llvm-svn: 374548

4 years ago[Tests] Output of od can be lower or upper case (llvm-objcopy/yaml2obj).
Kai Nacke [Fri, 11 Oct 2019 12:50:57 +0000 (12:50 +0000)]
[Tests] Output of od can be lower or upper case (llvm-objcopy/yaml2obj).

The command `od -t x` is used to dump data in hex format.
The LIT tests assumes that the hex characters are in lowercase.
However, there are also platforms which use uppercase letter.

To solve this issue the tests are updated to use the new
`--ignore-case` option of FileCheck.

Reviewers: Bigcheese, jakehehrlich, rupprecht, espindola, alexshap, jhenderson

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

llvm-svn: 374547

4 years ago[lldb] Insert break to avoid unannotated fall-through
Kadir Cetinkaya [Fri, 11 Oct 2019 12:33:47 +0000 (12:33 +0000)]
[lldb] Insert break to avoid unannotated fall-through

llvm-svn: 374545

4 years ago[mips] Fix loading "double" immediate into a GPR and FPR
Simon Atanasyan [Fri, 11 Oct 2019 12:33:12 +0000 (12:33 +0000)]
[mips] Fix loading "double" immediate into a GPR and FPR

If a "double" (64-bit) value has zero low 32-bits, it's possible to load
such value into a GP/FP registers as an instruction immediate. But now
assembler loads only high 32-bits of the value.

For example, if a target register is GPR the `li.d $4, 1.0` instruction
converts into the `lui $4, 16368` one. As a result, we get `0x3FF00000`
in the register. While a correct representation of the `1.0` value is
`0x3FF0000000000000`. The patch fixes that.

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

llvm-svn: 374544

4 years ago[MS ABI]: Fix mangling function arguments for template types to be compatible with...
Nico Weber [Fri, 11 Oct 2019 12:27:51 +0000 (12:27 +0000)]
[MS ABI]: Fix mangling function arguments for template types to be compatible with MSVC

MS name mangling supports cache for first 10 distinct function
arguments.  The error was when non cached template type occurred twice
(e.g. 11th and 12th).  For such case in code there is another cache
table TemplateArgStrings (for performance reasons).  Then one '@'
character at the end of the mangled name taken from this table was
missing.  For other cases the missing '@' character was added in
the call to mangleSourceName(TemplateMangling) in the cache miss code,
but the cache hit code didn't add it.

This fixes a regression from r362560.

Patch by Adam Folwarczny <adamf88@gmail.com>!

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

llvm-svn: 374543

4 years ago[LLD][ELF] - Update test cases after llvm-readobj change.
George Rimar [Fri, 11 Oct 2019 12:27:20 +0000 (12:27 +0000)]
[LLD][ELF] - Update test cases after llvm-readobj change.

https://reviews.llvm.org/D68704 changed the output format.

llvm-svn: 374542

4 years ago[llvm-readobj] - Remove excessive fields when dumping "Version symbols".
George Rimar [Fri, 11 Oct 2019 12:27:11 +0000 (12:27 +0000)]
[llvm-readobj] - Remove excessive fields when dumping "Version symbols".

This removes a few fields that are not useful:
"Section Name", "Address", "Offset" and "Link"
(they duplicated the information available under
the "Sections [" tag).

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

llvm-svn: 374541

4 years ago[ClangTidy] Separate tests for infrastructure and checkers
Dmitri Gribenko [Fri, 11 Oct 2019 12:05:42 +0000 (12:05 +0000)]
[ClangTidy] Separate tests for infrastructure and checkers

Summary:
This change moves tests for checkers and infrastructure into separate
directories, making it easier to find infrastructure tests. Tests for
checkers are already easy to find because they are named after the
checker. Tests for infrastructure were difficult to find because they
were outnumbered by tests for checkers. Now they are in a separate
directory.

Reviewers: jfb, jdoerfert, lebedev.ri

Subscribers: srhines, nemanjai, aheejin, kbarton, christof, mgrang, arphaman, jfb, lebedev.ri, cfe-commits

Tags: #clang

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

llvm-svn: 374540

4 years agoDead Virtual Function Elimination
Oliver Stannard [Fri, 11 Oct 2019 11:59:55 +0000 (11:59 +0000)]
Dead Virtual Function Elimination

Currently, it is hard for the compiler to remove unused C++ virtual
functions, because they are all referenced from vtables, which are referenced
by constructors. This means that if the constructor is called from any live
code, then we keep every virtual function in the final link, even if there
are no call sites which can use it.

This patch allows unused virtual functions to be removed during LTO (and
regular compilation in limited circumstances) by using type metadata to match
virtual function call sites to the vtable slots they might load from. This
information can then be used in the global dead code elimination pass instead
of the references from vtables to virtual functions, to more accurately
determine which functions are reachable.

To make this transformation safe, I have changed clang's code-generation to
always load virtual function pointers using the llvm.type.checked.load
intrinsic, instead of regular load instructions. I originally tried writing
this using clang's existing code-generation, which uses the llvm.type.test
and llvm.assume intrinsics after doing a normal load. However, it is possible
for optimisations to obscure the relationship between the GEP, load and
llvm.type.test, causing GlobalDCE to fail to find virtual function call
sites.

The existing linkage and visibility types don't accurately describe the scope
in which a virtual call could be made which uses a given vtable. This is
wider than the visibility of the type itself, because a virtual function call
could be made using a more-visible base class. I've added a new
!vcall_visibility metadata type to represent this, described in
TypeMetadata.rst. The internalization pass and libLTO have been updated to
change this metadata when linking is performed.

This doesn't currently work with ThinLTO, because it needs to see every call
to llvm.type.checked.load in the linkage unit. It might be possible to
extend this optimisation to be able to use the ThinLTO summary, as was done
for devirtualization, but until then that combination is rejected in the
clang driver.

To test this, I've written a fuzzer which generates random C++ programs with
complex class inheritance graphs, and virtual functions called through object
and function pointers of different types. The programs are spread across
multiple translation units and DSOs to test the different visibility
restrictions.

I've also tried doing bootstrap builds of LLVM to test this. This isn't
ideal, because only classes in anonymous namespaces can be optimised with
-fvisibility=default, and some parts of LLVM (plugins and bugpoint) do not
work correctly with -fvisibility=hidden. However, there are only 12 test
failures when building with -fvisibility=hidden (and an unmodified compiler),
and this change does not cause any new failures for either value of
-fvisibility.

On the 7 C++ sub-benchmarks of SPEC2006, this gives a geomean code-size
reduction of ~6%, over a baseline compiled with "-O2 -flto
-fvisibility=hidden -fwhole-program-vtables". The best cases are reductions
of ~14% in 450.soplex and 483.xalancbmk, and there are no code size
increases.

I've also run this on a set of 8 mbed-os examples compiled for Armv7M, which
show a geomean size reduction of ~3%, again with no size increases.

I had hoped that this would have no effect on performance, which would allow
it to awlays be enabled (when using -fwhole-program-vtables). However, the
changes in clang to use the llvm.type.checked.load intrinsic are causing ~1%
performance regression in the C++ parts of SPEC2006. It should be possible to
recover some of this perf loss by teaching optimisations about the
llvm.type.checked.load intrinsic, which would make it worth turning this on
by default (though it's still dependent on -fwhole-program-vtables).

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

llvm-svn: 374539

4 years ago[FileCheck] Implement --ignore-case option.
Kai Nacke [Fri, 11 Oct 2019 11:59:14 +0000 (11:59 +0000)]
[FileCheck] Implement --ignore-case option.

The FileCheck utility is enhanced to support a `--ignore-case`
option. This is useful in cases where the output of Unix tools
differs in case (e.g. case not specified by Posix).

Reviewers: Bigcheese, jakehehrlich, rupprecht, espindola, alexshap, jhenderson, MaskRay

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

llvm-svn: 374538

4 years ago[LLDB] [lldb-server] Use llvm::InitLLVM for doing unicode conversion of arguments...
Martin Storsjo [Fri, 11 Oct 2019 11:47:07 +0000 (11:47 +0000)]
[LLDB] [lldb-server] Use llvm::InitLLVM for doing unicode conversion of arguments for windows

This should allow lldb-server to operate on files with non-ascii
pathnames.

I tried looking around in lldb/tools, and this seemed like the only
other tool (other than the main lldb driver itself) that would be
used (implicitly) by an end user (which could be working in
non-ascii paths).

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

llvm-svn: 374537

4 years ago[SCEV] Add stricter verification option.
Florian Hahn [Fri, 11 Oct 2019 11:46:40 +0000 (11:46 +0000)]
[SCEV] Add stricter verification option.

Currently -verify-scev only fails if there is a constant difference
between two BE counts. This misses a lot of cases.

This patch adds a -verify-scev-strict options, which fails for any
non-zero differences, if used together with -verify-scev.

With the stricter checking, some unit tests fail because
of mis-matches, especially around IndVarSimplify.

If there is no reason I am missing for just checking constant deltas, I
am planning on looking into the various failures.

Reviewers: efriedma, sanjoy.google, reames, atrick

Reviewed By: sanjoy.google

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

llvm-svn: 374535

4 years ago[X86] isFNEG - add recursion depth limit
Simon Pilgrim [Fri, 11 Oct 2019 11:34:18 +0000 (11:34 +0000)]
[X86] isFNEG - add recursion depth limit

Now that its used by isNegatibleForFree we should try to avoid costly deep recursion

llvm-svn: 374534

4 years ago[llvm-exegesis] Show noise cluster in analysis output.
Clement Courbet [Fri, 11 Oct 2019 11:33:18 +0000 (11:33 +0000)]
[llvm-exegesis] Show noise cluster in analysis output.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 374533

4 years agominidump: Use llvm memory info list parser
Pavel Labath [Fri, 11 Oct 2019 11:23:40 +0000 (11:23 +0000)]
minidump: Use llvm memory info list parser

llvm-svn: 374532

4 years agoProcessInstanceInfoMatch: Don't match processes with no name if a name match was...
Pavel Labath [Fri, 11 Oct 2019 10:56:54 +0000 (10:56 +0000)]
ProcessInstanceInfoMatch: Don't match processes with no name if a name match was requested, take 2

Summary:
The previous attempt at making nameless process not match when searching for a
given name failed because the macos implementation was depending on this detail
in its partial matching strategy. Doing partial matching to avoid expensive
lookups is a perfectly valid thing to do, the way it was implemented seems
somewhat unexpected.

This patch implements it differently by providing special
methods in the ProcessInstanceInfoMatch which match only a subset of fields,
and changes mac host code to use those instead.

Then, it re-applies r373925 to get make the ProcessInstanceInfoMatch with a
name *not* match a nameless process.

Reviewers: JDevlieghere, teemperor, jingham

Subscribers: wallace, lldb-commits

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

llvm-svn: 374529

4 years ago[Windows] Use information from the PE32 exceptions directory to construct unwind...
Aleksandr Urakov [Fri, 11 Oct 2019 09:03:29 +0000 (09:03 +0000)]
[Windows] Use information from the PE32 exceptions directory to construct unwind plans

This patch adds an implementation of unwinding using PE EH info. It allows to
get almost ideal call stacks on 64-bit Windows systems (except some epilogue
cases, but I believe that they can be fixed with unwind plan disassembly
augmentation in the future).

To achieve the goal the CallFrameInfo abstraction was made. It is based on the
DWARFCallFrameInfo class interface with a few changes to make it less
DWARF-specific.

To implement the new interface for PECOFF object files the class PECallFrameInfo
was written. It uses the next helper classes:

- UnwindCodesIterator helps to iterate through UnwindCode structures (and
  processes chained infos transparently);
- EHProgramBuilder with the use of UnwindCodesIterator constructs EHProgram;
- EHProgram is, by fact, a vector of EHInstructions. It creates an abstraction
  over the low-level unwind codes and simplifies work with them. It contains
  only the information that is relevant to unwinding in the unified form. Also
  the required unwind codes are read from the object file only once with it;
- EHProgramRange allows to take a range of EHProgram and to build an unwind row
  for it.

So, PECallFrameInfo builds the EHProgram with EHProgramBuilder, takes the ranges
corresponding to every offset in prologue and builds the rows of the resulted
unwind plan. The resulted plan covers the whole range of the function except the
epilogue.

Reviewers: jasonmolenda, asmith, amccarth, clayborg, JDevlieghere, stella.stamenova, labath, espindola

Reviewed By: jasonmolenda

Subscribers: leonid.mashinskiy, emaste, mgorny, aprantl, arichardson, MaskRay, lldb-commits, llvm-commits

Tags: #lldb

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

llvm-svn: 374528

4 years agoInsert module constructors in a module pass
Vitaly Buka [Fri, 11 Oct 2019 08:47:03 +0000 (08:47 +0000)]
Insert module constructors in a module pass

Summary:
If we insert them from function pass some analysis may be missing or invalid.
Fixes PR42877.

Reviewers: eugenis, leonardchan

Reviewed By: leonardchan

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

> llvm-svn: 374481
Signed-off-by: Vitaly Buka <vitalybuka@google.com>
llvm-svn: 374527

4 years ago[LLDB] [Driver] Use llvm::InitLLVM to do unicode argument conversion on Windows
Martin Storsjo [Fri, 11 Oct 2019 08:44:51 +0000 (08:44 +0000)]
[LLDB] [Driver] Use llvm::InitLLVM to do unicode argument conversion on Windows

This avoids the currently MSVC specific codepath of using the
wchar entry point and converting that to utf8.

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

llvm-svn: 374526

4 years ago[lldb] Fix crash in CxxModuleHandler when std module is empty
Raphael Isemann [Fri, 11 Oct 2019 08:42:22 +0000 (08:42 +0000)]
[lldb] Fix crash in CxxModuleHandler when std module is empty

We currently don't handle the error in the Expected we get
when searching for an equal local DeclContext. Usually this can't
happen as this would require that we have a STL container and
we can find libc++'s std module, but when we load the module in
the expression parser the module doesn't even contain the 'std'
namespace. The only way I see to test this is by having a fake
'std' module that requires a special define to actually provide
its contents, while it will just be empty (that is, it doesn't
even contain the 'std' namespace) without that define. LLDB currently
doesn't know about that define in the expression parser, so it
will load the wrong 'empty' module which should trigger this error.

Also removed the 'auto' for that variable as the function name
doesn't make it obvious that this is an expected and not just
a optional/ptr (which is how this slipped in from the start).

llvm-svn: 374525

4 years ago[TableGen] Fix a bug that MCSchedClassDesc is interfered between different SchedModel
QingShan Zhang [Fri, 11 Oct 2019 08:36:54 +0000 (08:36 +0000)]
[TableGen] Fix a bug that MCSchedClassDesc is interfered between different SchedModel

Assume that, ModelA has scheduling resource for InstA and ModelB has scheduling resource for InstB. This is what the llvm::MCSchedClassDesc looks like:

llvm::MCSchedClassDesc ModelASchedClasses[] = {
...
InstA, 0, ...
InstB, -1,...
};

llvm::MCSchedClassDesc ModelBSchedClasses[] = {
...
InstA, -1,...
InstB, 0,...
};
The -1 means invalid num of macro ops, while it is valid if it is >=0. This is what we look like now:

llvm::MCSchedClassDesc ModelASchedClasses[] = {
...
InstA, 0, ...
InstB, 0,...
};

llvm::MCSchedClassDesc ModelBSchedClasses[] = {
...
InstA, 0,...
InstB, 0,...
};
And compiler hit the assertion here because the SCDesc is valid now for both InstA and InstB.

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

llvm-svn: 374524

4 years ago[X86] Add v8i64->v8i8 ssat/usat/packus truncate tests to min-legal-vector-width.ll
Craig Topper [Fri, 11 Oct 2019 07:24:36 +0000 (07:24 +0000)]
[X86] Add v8i64->v8i8 ssat/usat/packus truncate tests to min-legal-vector-width.ll

I wonder if we should split the v8i8 stores in order to form
two v4i8 saturating truncating stores. This would remove the
unpckl needed to concatenated the v4i8 results to make a
single store.

llvm-svn: 374519

4 years ago[ADT][Statistics] Fix test after rL374490
Kadir Cetinkaya [Fri, 11 Oct 2019 07:19:54 +0000 (07:19 +0000)]
[ADT][Statistics] Fix test after rL374490

llvm-svn: 374518

4 years agoFix modules build for r374337
Pavel Labath [Fri, 11 Oct 2019 07:16:19 +0000 (07:16 +0000)]
Fix modules build for r374337

A modules build failed with the following error:
  call to function 'operator&' that is neither visible in the template definition nor found by argument-dependent lookup

Fix that by declaring the appropriate operators in the llvm::minidump
namespace.

llvm-svn: 374517

4 years ago[X86] Always define the tzcnt intrinsics even when _MSC_VER is defined.
Craig Topper [Fri, 11 Oct 2019 06:07:53 +0000 (06:07 +0000)]
[X86] Always define the tzcnt intrinsics even when _MSC_VER is defined.

These intrinsics use llvm.cttz intrinsics so are always available
even without the bmi feature. We already don't check for the bmi
feature on the intrinsics themselves. But we were blocking the
include of the header file with _MSC_VER unless BMI was enabled
on the command line.

Fixes PR30506.

llvm-svn: 374516

4 years ago[PowerPC] Remove assertion "Shouldn't overwrite a register before it is killed"
Yi-Hong Lyu [Fri, 11 Oct 2019 05:32:29 +0000 (05:32 +0000)]
[PowerPC] Remove assertion "Shouldn't overwrite a register before it is killed"

The assertion is everzealous and fail tests like:

  renamable $x3 = LI8 0
  STD renamable $x3, 16, $x1
  renamable $x3 = LI8 0

Remove the assertion since killed flag of $x3 is not mandentory.

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

llvm-svn: 374515

4 years ago[NFC] run specific pass instead of whole -O3 pipeline for popcount recoginzation...
Chen Zheng [Fri, 11 Oct 2019 05:30:18 +0000 (05:30 +0000)]
[NFC] run specific pass instead of whole -O3 pipeline for popcount recoginzation testcase.

llvm-svn: 374514

4 years ago[InstCombine] recognize popcount.
Chen Zheng [Fri, 11 Oct 2019 05:13:56 +0000 (05:13 +0000)]
[InstCombine] recognize popcount.

  This patch recognizes popcount intrinsic according to algorithm from website
  http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel

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

llvm-svn: 374512

4 years ago[libc++] Fix linker script generation
Petr Hosek [Fri, 11 Oct 2019 04:54:35 +0000 (04:54 +0000)]
[libc++] Fix linker script generation

Handle the case when libc++abi and libunwind are being built together
with libc++ in the runtimes build. This logic was used in the previous
implementation but dropped in r374116.

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

llvm-svn: 374510

4 years ago[X86] Add a DAG combine to turn v16i16->v16i8 VTRUNCUS+store into a saturating trunca...
Craig Topper [Fri, 11 Oct 2019 04:16:49 +0000 (04:16 +0000)]
[X86] Add a DAG combine to turn v16i16->v16i8 VTRUNCUS+store into a saturating truncating store.

llvm-svn: 374509

4 years ago[X86] Add test case for trunc_packus_v16i32_v16i8_store to min-legal-vector-width.ll
Craig Topper [Fri, 11 Oct 2019 04:02:04 +0000 (04:02 +0000)]
[X86] Add test case for trunc_packus_v16i32_v16i8_store to min-legal-vector-width.ll

We aren't folding the vpmovuswb into the store.

llvm-svn: 374507

4 years ago[CVP] Remove a masking operation if range information implies it's a noop
Philip Reames [Fri, 11 Oct 2019 03:48:56 +0000 (03:48 +0000)]
[CVP] Remove a masking operation if range information implies it's a noop

This is really a known bits style transformation, but known bits isn't context sensitive. The particular case which comes up happens to involve a range which allows range based reasoning to eliminate the mask pattern, so handle that case specifically in CVP.

InstCombine likes to generate the mask-by-low-bits pattern when widening an arithmetic expression which includes a zext in the middle.

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

llvm-svn: 374506