platform/upstream/llvm.git
7 years ago[OPENMP] Emit implicit taskgroup block around taskloop directives.
Alexey Bataev [Wed, 12 Jul 2017 18:09:32 +0000 (18:09 +0000)]
[OPENMP] Emit implicit taskgroup block around taskloop directives.

If taskloop directive has no associated nogroup clause, it must emitted
inside implicit taskgroup block. Runtime supports it, but we need to
generate implicit taskgroup block explicitly to support future
reductions codegen.

llvm-svn: 307822

7 years ago[x86] improve SBB optimizations for SETB/SETA with subtract
Sanjay Patel [Wed, 12 Jul 2017 17:56:46 +0000 (17:56 +0000)]
[x86] improve SBB optimizations for SETB/SETA with subtract

This is another step towards removing a combine that turns sext
into select of constants and preparing the backend for an IR
future where select is the canonical form.

Earlier commits in this area:
https://reviews.llvm.org/rL306040
https://reviews.llvm.org/rL306072
https://reviews.llvm.org/rL307404 (https://reviews.llvm.org/D34652)
https://reviews.llvm.org/rL307471

llvm-svn: 307821

7 years agoBring back InVersionScript.
Rafael Espindola [Wed, 12 Jul 2017 17:49:17 +0000 (17:49 +0000)]
Bring back InVersionScript.

We were producing bogus warnings without it.

llvm-svn: 307820

7 years ago[x86] add tests for improving sbb transforms; NFC
Sanjay Patel [Wed, 12 Jul 2017 17:44:50 +0000 (17:44 +0000)]
[x86] add tests for improving sbb transforms; NFC

We're subtracting X from X the hard way...

llvm-svn: 307819

7 years ago[clang-tidy] Add a new Android check "android-cloexec-socket"
Yan Wang [Wed, 12 Jul 2017 17:43:36 +0000 (17:43 +0000)]
[clang-tidy] Add a new Android check "android-cloexec-socket"

Summary: socket() is better to include SOCK_CLOEXEC in its type argument to avoid the file descriptor leakage.

Reviewers: chh, Eugene.Zelenko, alexfh, hokein, aaron.ballman

Reviewed By: chh, alexfh

Subscribers: srhines, mgorny, JDevlieghere, xazax.hun, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 307818

7 years agoGlobalISel: Handle selection of G_IMPLICIT_DEF in AArch64
Justin Bogner [Wed, 12 Jul 2017 17:32:32 +0000 (17:32 +0000)]
GlobalISel: Handle selection of G_IMPLICIT_DEF in AArch64

A generic variant of IMPLICIT_DEF was added in r306875, but this
survives to selection and hits a `Cannot Select`. Add handling that
converts the note to a regular IMPLICIT_DEF.

llvm-svn: 307817

7 years agoOn Darwin, start building the TSan dylib for the iOS simulator.
Kuba Mracek [Wed, 12 Jul 2017 17:30:54 +0000 (17:30 +0000)]
On Darwin, start building the TSan dylib for the iOS simulator.

llvm-svn: 307816

7 years agoFix the declaration of DARWIN_PREFER_PUBLIC_SDK cmake variable (move before the return).
Kuba Mracek [Wed, 12 Jul 2017 17:11:53 +0000 (17:11 +0000)]
Fix the declaration of DARWIN_PREFER_PUBLIC_SDK cmake variable (move before the return).

llvm-svn: 307815

7 years ago[PPCGCodeGen] Differentiate kernels based on their parent Scop
Singapuram Sanjay Srivallabh [Wed, 12 Jul 2017 16:46:19 +0000 (16:46 +0000)]
[PPCGCodeGen] Differentiate kernels based on their parent Scop

Summary:
Add a sequence number that identifies a ptx_kernel's parent Scop within a function to it's name to differentiate it from other kernels produced from the same function, yet different Scops.

Kernels produced from different Scops can end up having the same name. Consider a function with 2 Scops and each Scop being able to produce just one kernel. Both of these kernels have the name "kernel_0". This can lead to the wrong kernel being launched when the runtime picks a kernel from its cache based on the name alone. This patch supplements D33985, by differentiating kernels across Scops as well.

Previously (even before D33985) while profiling kernels generated through JIT e.g. Julia, [[ https://groups.google.com/d/msg/polly-dev/J1j587H3-Qw/mR-jfL16BgAJ | kernels associated with different functions, and even different SCoPs within a function, would be grouped together due to the common name ]]. This patch prevents this grouping and the kernels are reported separately.

Reviewers: grosser, bollu

Reviewed By: grosser

Subscribers: mehdi_amini, nemanjai, pollydev, kbarton

Tags: #polly

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

llvm-svn: 307814

7 years ago[diagtool] Add a 'find-diagnostic-id' subcommand that converts a name of
Alex Lorenz [Wed, 12 Jul 2017 16:41:49 +0000 (16:41 +0000)]
[diagtool] Add a 'find-diagnostic-id' subcommand that converts a name of
the diagnostic to its enum value

This will be used by a script that invokes clang in a debugger and forces it
to stop when it reports a particular diagnostic.

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

llvm-svn: 307813

7 years ago[clang-tidy] Ignore blank spaces between cast's ")" and its sub expr.
Haojian Wu [Wed, 12 Jul 2017 16:38:59 +0000 (16:38 +0000)]
[clang-tidy] Ignore blank spaces between cast's ")" and its sub expr.

Summary:
Before the change:

`auto i = (Enum) 5;` => `auto i = static_cast<Enum>( 5);`

After the change:

`auto i = (Enum) 5;` => `auto i = static_cast<Enum>(5);`

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

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

llvm-svn: 307812

7 years agoAdd a test for r307754
George Burgess IV [Wed, 12 Jul 2017 16:30:37 +0000 (16:30 +0000)]
Add a test for r307754

As promised in D35003.

Uses -codegenprepare instead of -instcombine since we hit the same
buggy path anyway, and CGP lets us keep this test really simple
(instcombine likes turning the alloca T, N into alloca [N x T], which
hides the bug this is testing for).

llvm-svn: 307811

7 years ago[clang-tidy] add regression test to performance-unnecessary-value-param
Chih-Hung Hsieh [Wed, 12 Jul 2017 16:27:00 +0000 (16:27 +0000)]
[clang-tidy] add regression test to performance-unnecessary-value-param

This test shows the problem in https://bugs.llvm.org/show_bug.cgi?id=33734

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

llvm-svn: 307810

7 years ago[clang] buildFixItInsertionLine should use Hints of the same FID and LineNo
Chih-Hung Hsieh [Wed, 12 Jul 2017 16:25:40 +0000 (16:25 +0000)]
[clang] buildFixItInsertionLine should use Hints of the same FID and LineNo

Fix bug https://bugs.llvm.org/show_bug.cgi?id=33734

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

llvm-svn: 307809

7 years ago[mips][mt][5/7] Add support for fork and yield instructions.
Simon Dardis [Wed, 12 Jul 2017 16:23:57 +0000 (16:23 +0000)]
[mips][mt][5/7] Add support for fork and yield instructions.

Reviewers: slthakur, atanasyan

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

llvm-svn: 307808

7 years agoAdd back a CHECK line.
Rafael Espindola [Wed, 12 Jul 2017 16:14:00 +0000 (16:14 +0000)]
Add back a CHECK line.

I accidentally removed it in r307730.

Thanks to Martin Storsjö for noticing!

llvm-svn: 307801

7 years ago[NFC] [SCEVValidator] Make parameter name of `hasScalarDepsInsideRegion` consistent.
Siddharth Bhat [Wed, 12 Jul 2017 15:32:30 +0000 (15:32 +0000)]
[NFC] [SCEVValidator] Make parameter name of `hasScalarDepsInsideRegion` consistent.

`SCEV` parameter is called as `Expr` in `SCEVValidator.cpp`, as well
as in other functions in `SCEVValidator.h`.

llvm-svn: 307800

7 years ago[CodeGen] Add dependency printer
Evandro Menezes [Wed, 12 Jul 2017 15:30:59 +0000 (15:30 +0000)]
[CodeGen] Add dependency printer

Add SDep printer to make debugging sessions more productive.

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

llvm-svn: 307799

7 years ago[scudo] PRNG makeover
Kostya Kortchinsky [Wed, 12 Jul 2017 15:29:08 +0000 (15:29 +0000)]
[scudo] PRNG makeover

Summary:
This follows the addition of `GetRandom` with D34412. We remove our
`/dev/urandom` code and use the new function. Additionally, change the PRNG for
a slightly faster version. One of the issues with the old code is that we have
64 full bits of randomness per "next", using only 8 of those for the Salt and
discarding the rest. So we add a cached u64 in the PRNG that can serve up to
8 u8 before having to call the "next" function again.

During some integration work, I also realized that some very early processes
(like `init`) do not benefit from `/dev/urandom` yet. So if there is no
`getrandom` syscall as well, we have to fallback to some sort of initialization
of the PRNG.

Now a few words on why XoRoShiRo and not something else. I have played a while
with various PRNGs on 32 & 64 bit platforms. Some results are below. LCG 32 & 64
are usually faster but produce respectively 15 & 31 bits of entropy, meaning
that to get a full 64-bit, you would need to call them several times. The simple
XorShift is fast, produces 32 bits but is mediocre with regard to PRNG test
suites, PCG is slower overall, and XoRoShiRo is faster than XorShift128+ and
produces full 64 bits.

%%%
root@tulip-chiphd:/data # ./randtest.arm
[+] starting xs32...
[?] xs32 duration: 22431833053ns
[+] starting lcg32...
[?] lcg32 duration: 14941402090ns
[+] starting pcg32...
[?] pcg32 duration: 44941973771ns
[+] starting xs128p...
[?] xs128p duration: 48889786981ns
[+] starting lcg64...
[?] lcg64 duration: 33831042391ns
[+] starting xos128p...
[?] xos128p duration: 44850878605ns

root@tulip-chiphd:/data # ./randtest.aarch64
[+] starting xs32...
[?] xs32 duration: 22425151678ns
[+] starting lcg32...
[?] lcg32 duration: 14954255257ns
[+] starting pcg32...
[?] pcg32 duration: 37346265726ns
[+] starting xs128p...
[?] xs128p duration: 22523807219ns
[+] starting lcg64...
[?] lcg64 duration: 26141304679ns
[+] starting xos128p...
[?] xos128p duration: 14937033215ns
%%%

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: aemerson, kristof.beyls, llvm-commits

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

llvm-svn: 307798

7 years ago[X86/FastIsel] Fall-back to SelectionDAG when lowering soft-floats.
Davide Italiano [Wed, 12 Jul 2017 15:26:06 +0000 (15:26 +0000)]
[X86/FastIsel] Fall-back to SelectionDAG when lowering soft-floats.

FastIsel can't handle them, so we would end up crashing during
register class selection.
Fixes PR26522.

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

llvm-svn: 307797

7 years agoAdd element atomic memmove intrinsic
Daniel Neilson [Wed, 12 Jul 2017 15:25:26 +0000 (15:25 +0000)]
Add element atomic memmove intrinsic

Summary: Continuing the work from https://reviews.llvm.org/D33240, this change introduces an element unordered-atomic memmove intrinsic. This intrinsic is essentially memmove with the implementation requirement that all loads/stores used for the copy are done with unordered-atomic loads/stores of a given element size.

Reviewers: eli.friedman, reames, mkazantsev, skatkov

Reviewed By: reames

Subscribers: llvm-commits

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

llvm-svn: 307796

7 years ago[clang-format] Keep level of comment before an empty line
Krasimir Georgiev [Wed, 12 Jul 2017 15:21:43 +0000 (15:21 +0000)]
[clang-format] Keep level of comment before an empty line

Summary:
This patch fixes bug https://bugs.llvm.org/show_bug.cgi?id=3313: a comment line
was aligned with the next #ifdef even in the presence of an empty line between
them.

Reviewers: djasper, klimek

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 307795

7 years ago[ELF] - Allow moving location counter backward in some cases.
George Rimar [Wed, 12 Jul 2017 14:50:25 +0000 (14:50 +0000)]
[ELF] - Allow moving location counter backward in some cases.

Patch removes restriction about moving location counter
backwards outside of output sections declarations.

That may be useful for some apps relying on such scripts,
known example is linux kernel.

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

llvm-svn: 307794

7 years ago[mips][mt][4/7] Add IAS support for dvpe, evpe instructions.
Simon Dardis [Wed, 12 Jul 2017 14:48:27 +0000 (14:48 +0000)]
[mips][mt][4/7] Add IAS support for dvpe, evpe instructions.

Reviewers: slthakur, atanasyan

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

llvm-svn: 307793

7 years ago[ELF] - Give a symbol version extracted from name a priority over version set by...
George Rimar [Wed, 12 Jul 2017 13:54:42 +0000 (13:54 +0000)]
[ELF] - Give a symbol version extracted from name a priority over version set by script.

This fixes PR33712.

Imagine following script and code:

VER1 { global: foo; local: *; };
VER2 { global: foo; };

.global bar
bar:
.symver bar, foo@VER1

.global zed
zed:
.symver zed, foo@@VER2

We add foo@@VER2 as foo to symbol table, because have to resolve references to
foo for default symbols.
Later we are trying to assign symbol versions from script. For that we are searching for 'foo'
again. Here it is placed under VER1 and VER2 at the same time, we find it twice and trying to
set version again both times, hence LLD shows a warning.
Though sample code is correct: we have 2 different versions of foo.

Patch gives a symbol version extracted from name a priority over version set by script.

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

llvm-svn: 307792

7 years ago[clang-tidy] Add new modernize use unary assert check
Gabor Horvath [Wed, 12 Jul 2017 13:43:35 +0000 (13:43 +0000)]
[clang-tidy] Add new modernize use unary assert check

Patch by: Lilla Barancsuk

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

llvm-svn: 307791

7 years ago[X86][SSE] Fix file check prefix warning breaking buildbots
Simon Pilgrim [Wed, 12 Jul 2017 13:41:13 +0000 (13:41 +0000)]
[X86][SSE] Fix file check prefix warning breaking buildbots

llvm-svn: 307790

7 years agoMake shell redirection construct portable
Kamil Rytarowski [Wed, 12 Jul 2017 13:24:46 +0000 (13:24 +0000)]
Make shell redirection construct portable

Summary:
NetBSD shell sh(1) does not support ">& /dev/null" construct.
This is bashism. The portable and POSIX solution is to use:
"> /dev/null 2>&1".

This change fixes 22 Unexpected Failures on NetBSD/amd64
for the "check-llvm" target.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dim, rnk

Reviewed By: joerg, rnk

Subscribers: rnk, davide, llvm-commits

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

llvm-svn: 307789

7 years ago[ARM] Adjust ifcvt heuristic for the diamond ifcvt case
John Brawn [Wed, 12 Jul 2017 13:23:10 +0000 (13:23 +0000)]
[ARM] Adjust ifcvt heuristic for the diamond ifcvt case

When we have a diamond ifcvt the fallthough block will have a branch at the end
of it that disappears when predicated, so discount it from the predication cost.

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

llvm-svn: 307788

7 years ago[clang-tidy] add_new_check.py updates ReleaseNotes.rst now
Alexander Kornienko [Wed, 12 Jul 2017 13:13:41 +0000 (13:13 +0000)]
[clang-tidy] add_new_check.py updates ReleaseNotes.rst now

llvm-svn: 307787

7 years agotsan: remove some clock-related stats
Dmitry Vyukov [Wed, 12 Jul 2017 12:54:38 +0000 (12:54 +0000)]
tsan: remove some clock-related stats

The stats are too dependent on implementation
and won't be relevant in future.

llvm-svn: 307786

7 years agotsan: refactor SyncClock code
Dmitry Vyukov [Wed, 12 Jul 2017 12:50:36 +0000 (12:50 +0000)]
tsan: refactor SyncClock code

1. Add SyncClock::ResetImpl which removes code
   duplication between ctor and Reset.
2. Move SyncClock::Resize to SyncClock methods,
   currently it's defined between ThreadClock methods.

llvm-svn: 307785

7 years agotsan: prepare clock for future changes
Dmitry Vyukov [Wed, 12 Jul 2017 12:45:20 +0000 (12:45 +0000)]
tsan: prepare clock for future changes

Pass ClockCache to ThreadClock::set and introduce ThreadCache::ResetCached.
For now both are unused, but will reduce future diffs.

llvm-svn: 307784

7 years ago[X86][SSE] Add 512-bit (iX bitcast(vXi1)) test cases
Simon Pilgrim [Wed, 12 Jul 2017 12:44:10 +0000 (12:44 +0000)]
[X86][SSE] Add 512-bit (iX bitcast(vXi1)) test cases

Improves test coverage for pre-AVX512 targets as well

llvm-svn: 307783

7 years ago[MainLoop] Fix possible use of an invalid iterator
Petr Pavlu [Wed, 12 Jul 2017 12:38:31 +0000 (12:38 +0000)]
[MainLoop] Fix possible use of an invalid iterator

Store file descriptors from loop.m_read_fds (if FORCE_PSELECT is
defined) and signals from loop.m_signals that need to be processed in
MainLoop::RunImpl::ProcessEvents() into a separate vector and then
iterate over this container to invoke the callbacks.

This prevents a problem where when the code iterated directly over
m_read_fds/m_signals, a callback invoked from within the loop could
modify these variables and invalidate the loop iterator. This would then
result in an assertion failure in llvm::DenseMapIterator::operator++().

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

llvm-svn: 307782

7 years agotsan: s/-1/kInvalidTid/
Dmitry Vyukov [Wed, 12 Jul 2017 12:36:44 +0000 (12:36 +0000)]
tsan: s/-1/kInvalidTid/

llvm-svn: 307781

7 years agotsan: give debug names to dense allocators
Dmitry Vyukov [Wed, 12 Jul 2017 12:34:12 +0000 (12:34 +0000)]
tsan: give debug names to dense allocators

Improves crash message on dense alloc overflow.
Allows to understand what alloc overflowed.

llvm-svn: 307780

7 years ago[mips][mt] Add missing files from last commit
Simon Dardis [Wed, 12 Jul 2017 12:33:40 +0000 (12:33 +0000)]
[mips][mt] Add missing files from last commit

llvm-svn: 307779

7 years agotsan: don't create sync objects on acquire-load
Dmitry Vyukov [Wed, 12 Jul 2017 12:28:23 +0000 (12:28 +0000)]
tsan: don't create sync objects on acquire-load

Don't create sync object if it does not exist yet. For example, an atomic
pointer is initialized to nullptr and then periodically acquire-loaded.

llvm-svn: 307778

7 years agotsan: add another test for clock growth
Dmitry Vyukov [Wed, 12 Jul 2017 12:25:03 +0000 (12:25 +0000)]
tsan: add another test for clock growth

llvm-svn: 307777

7 years agotsan: add test for __tsan_java_find
Dmitry Vyukov [Wed, 12 Jul 2017 12:23:31 +0000 (12:23 +0000)]
tsan: add test for __tsan_java_find

The test should have been added in 289682
"tsan: allow Java VM iterate over allocated objects"
but I forgot to avn add.

Author: Alexander Smundak (asmundak)
Reviewed in https://reviews.llvm.org/D27720

llvm-svn: 307776

7 years agofix typo in document; NFC
Hiroshi Inoue [Wed, 12 Jul 2017 12:16:22 +0000 (12:16 +0000)]
fix typo in document; NFC

llvm-svn: 307775

7 years ago[mips][mt][3/7] Add IAS support for emt, dmt instructions.
Simon Dardis [Wed, 12 Jul 2017 11:57:44 +0000 (11:57 +0000)]
[mips][mt][3/7] Add IAS support for emt, dmt instructions.

Reviewers: slthakur, atanasyan

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

llvm-svn: 307774

7 years agoFixing Android builder
Ravitheja Addepally [Wed, 12 Jul 2017 11:54:17 +0000 (11:54 +0000)]
Fixing Android builder

llvm-svn: 307773

7 years ago[Linker] Add directives to support mixing ARM/Thumb module-level inline asm.
Florian Hahn [Wed, 12 Jul 2017 11:52:28 +0000 (11:52 +0000)]
[Linker] Add directives to support mixing ARM/Thumb module-level inline asm.

Summary:
By prepending `.text .thumb .balign 2` to the module-level inline
assembly from a Thumb module, the assembler will generate the assembly
from that module as Thumb, even if the destination module uses an ARM
triple. Similar directives are used for module-level inline assembly in
ARM modules.

The alignment and instruction set are reset based on the target triple
before emitting the first function label.

Reviewers: olista01, tejohnson, echristo, t.p.northover, rafael

Reviewed By: echristo

Subscribers: aemerson, javed.absar, eraman, kristof.beyls, llvm-commits

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

llvm-svn: 307772

7 years ago[libclang] Support for querying whether an enum is scoped
Alex Lorenz [Wed, 12 Jul 2017 11:35:11 +0000 (11:35 +0000)]
[libclang] Support for querying whether an enum is scoped

This commit allows checking whether an enum declaration is scoped
through libclang and clang.cindex (Python).

Patch by Johann Klähn!

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

llvm-svn: 307771

7 years agoRevert r307769 (Forgot to mention the name of the contributor).
Alex Lorenz [Wed, 12 Jul 2017 11:34:14 +0000 (11:34 +0000)]
Revert r307769 (Forgot to mention the name of the contributor).

llvm-svn: 307770

7 years ago[libclang] Support for querying whether an enum is scoped
Alex Lorenz [Wed, 12 Jul 2017 11:31:37 +0000 (11:31 +0000)]
[libclang] Support for querying whether an enum is scoped

This commit allows checking whether an enum declaration is scoped
through libclang and clang.cindex (Python).

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

llvm-svn: 307769

7 years agoAdding Support for Error Strings in Remote Packets
Ravitheja Addepally [Wed, 12 Jul 2017 11:15:34 +0000 (11:15 +0000)]
Adding Support for Error Strings in Remote Packets

Summary:
This patch adds support for sending strings along with
error codes in the reply packets. The implementation is
based on the feedback recieved in the lldb-dev mailing
list. The patch also adds an extra packet for the client
to query if the server has the capability to provide
strings along with error replys.

Reviewers: labath, jingham, sas, lldb-commits, clayborg

Reviewed By: labath, clayborg

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

llvm-svn: 307768

7 years ago[ELF] - Fix handling of weak symbols from static library when using version script.
George Rimar [Wed, 12 Jul 2017 11:09:46 +0000 (11:09 +0000)]
[ELF] - Fix handling of weak symbols from static library when using version script.

When version script was used, binding opf undefined weak symbols sometimes
was calculated as STB_LOCAL, making them non-preemtible what
broke correct relocations handling logic for them.

Fixes PR33738.

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

llvm-svn: 307767

7 years ago[ARM] GlobalISel: Simplify inst selector code. NFC
Diana Picus [Wed, 12 Jul 2017 10:31:16 +0000 (10:31 +0000)]
[ARM] GlobalISel: Simplify inst selector code. NFC

Refactor CmpHelper into something simpler. It was overkill to use
templates for this - instead, use a simple CmpConstants structure to
hold the opcodes and other constants that are different when selecting
int / float / double comparisons. Also, extract some of the helpers that
were in CmpHelper into ARMInstructionSelector and make use of some of
them when selecting other things than just compares.

llvm-svn: 307766

7 years ago[Polly] [Tests] Update `lit.cfg` uses of `lit.util.capture` to `subprocess.check_output`
Siddharth Bhat [Wed, 12 Jul 2017 09:42:05 +0000 (09:42 +0000)]
[Polly] [Tests] Update `lit.cfg` uses of `lit.util.capture` to `subprocess.check_output`

- `lit.util.capture` was removed in `r306625`.
- Replace `lit.util.capture` to `subprocess.check_output` as LLVM did.
- LLVM revision of this change: `https://reviews.llvm.org/D35088`.

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

llvm-svn: 307765

7 years ago[PM] Fix a silly bug in my recent update to the CG update logic.
Chandler Carruth [Wed, 12 Jul 2017 09:08:11 +0000 (09:08 +0000)]
[PM] Fix a silly bug in my recent update to the CG update logic.

I used the wrong variable to update. This was even covered by a unittest
I wrote, and the comments for the unittest were correct (if confusing)
but the test itself just matched the buggy behavior. =[

llvm-svn: 307764

7 years ago[ARM] GlobalISel: Select s64 G_FCMP
Diana Picus [Wed, 12 Jul 2017 09:01:54 +0000 (09:01 +0000)]
[ARM] GlobalISel: Select s64 G_FCMP

Very similar to how we select s32 G_FCMP, the only thing that is
different is the exact opcodes that we use.

llvm-svn: 307763

7 years agoHave Module::createRNG return a unique_ptr
Serge Guelton [Wed, 12 Jul 2017 08:03:44 +0000 (08:03 +0000)]
Have Module::createRNG return a unique_ptr

Instead of a raw pointer, this makes memory management safer.

llvm-svn: 307762

7 years ago[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess.
Michael Zuckerman [Wed, 12 Jul 2017 08:01:44 +0000 (08:01 +0000)]
[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess.
Adding base test for AVX512

llvm-svn: 307761

7 years agoExpose some type-conversion functions as part of the IRGen ABI.
John McCall [Wed, 12 Jul 2017 07:44:17 +0000 (07:44 +0000)]
Expose some type-conversion functions as part of the IRGen ABI.

Patch by Benoit Vey!

llvm-svn: 307760

7 years agoCFG: Add CFGElement for automatic variables that leave the scope
Matthias Gehre [Wed, 12 Jul 2017 07:04:19 +0000 (07:04 +0000)]
CFG: Add CFGElement for automatic variables that leave the scope

Summary:
This mimics the implementation for the implicit destructors. The
generation of this scope leaving elements is hidden behind
a flag to the CFGBuilder, thus it should not affect existing code.

Currently, I'm missing a test (it's implicitly tested by the clang-tidy
lifetime checker that I'm proposing).
I though about a test using debug.DumpCFG, but then I would
have to add an option to StaticAnalyzer/Core/AnalyzerOptions
to enable the scope leaving CFGElement,
which would only be useful to that particular test.

Any other ideas how I could make a test for this feature?

Reviewers: krememek, jordan_rose

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D15031

llvm-svn: 307759

7 years ago[X86] Synchronize the ProcessorFeatures enum used by getHostCPUName with the enum...
Craig Topper [Wed, 12 Jul 2017 06:49:58 +0000 (06:49 +0000)]
[X86] Synchronize the ProcessorFeatures enum used by getHostCPUName with the enum in libgcc and soon compiler-rt.

This adds all the feature bits libgcc has. They will soon be added to compiler-rt as well. This adds a second 32 bit feature variable to hold the bits that are needed by getHostCPUName that are not in libgcc. libgcc had already used 31 of the 32 bits in the existing variable and we needed 3 bits so at minimum 2 bits would spill over. I chose to move all 3.

llvm-svn: 307758

7 years ago[X86] Sync ProcessorTypes and ProcessorSubtypes enums used by getHostCPUName with...
Craig Topper [Wed, 12 Jul 2017 06:49:57 +0000 (06:49 +0000)]
[X86] Sync ProcessorTypes and ProcessorSubtypes enums used by getHostCPUName with the version proposed to for compiler-rt's cpu_model.c

This keeps the starting entries in the enums in sync with what's in gcc and in review D35214 for compiler-rt.

llvm-svn: 307757

7 years ago[X86] Cleanup the switches in getHostCPUName to remove impossible combinations.
Craig Topper [Wed, 12 Jul 2017 06:49:56 +0000 (06:49 +0000)]
[X86] Cleanup the switches in getHostCPUName to remove impossible combinations.

llvm-svn: 307756

7 years ago[X86] Remove 'barcelona' string from getHostCPUName. Use 'amdfam10' instead. The...
Craig Topper [Wed, 12 Jul 2017 06:49:55 +0000 (06:49 +0000)]
[X86] Remove 'barcelona' string from getHostCPUName. Use 'amdfam10' instead. The x86 backend doesn't distinguish.

llvm-svn: 307755

7 years ago[MemoryBuiltins] Allow truncation in visitAllocaInst()
Mikael Holmen [Wed, 12 Jul 2017 06:19:10 +0000 (06:19 +0000)]
[MemoryBuiltins] Allow truncation in visitAllocaInst()

Summary:
Solves PR33689.

If the pointer size is less than the size of the type used for the array
size in an alloca (the <ty> type below) then we could trigger the assert in
the PR. In that example we have pointer size i16 and <ty> is i32.

<result> = alloca [inalloca] <type> [, <ty> <NumElements>] [, align <alignment>]

Handle the situation by allowing truncation as well as zero extension in
ObjectSizeOffsetVisitor::visitAllocaInst().

Also, we now detect overflow in visitAllocaInst(), similar to how it was
already done in visitCallSite().

Reviewers: craig.topper, rnk, george.burgess.iv

Reviewed By: george.burgess.iv

Subscribers: davide, llvm-commits

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

llvm-svn: 307754

7 years agoRevert "[PDB] Use a more appropriate message for a fatal error"
Vitaly Buka [Wed, 12 Jul 2017 04:34:17 +0000 (04:34 +0000)]
Revert "[PDB] Use a more appropriate message for a fatal error"
Revert "[PDB] Tweak bad type index error handling"

check-lld with asan detects use-after-poison.

This reverts commits r307733 and r307726.

llvm-svn: 307752

7 years agoFix unrepresentable enum for clang-cl unstable ABI
Ben Craig [Wed, 12 Jul 2017 01:45:13 +0000 (01:45 +0000)]
Fix unrepresentable enum for clang-cl unstable ABI

When using LIBCXX_ABI_UNSTABLE=YES, clang-cl gave the following warning:

P:\llvm_master\src\llvm\projects\libcxx\include\string(683,51):
warning: enumerator value is not representable in the underlying type
'int' [-Wmicrosoft-enum-value]

Fixed by switching from enums to static const size_type.

https://reviews.llvm.org/D35174

llvm-svn: 307751

7 years agoRemove redundant newline.
Rui Ueyama [Wed, 12 Jul 2017 01:43:01 +0000 (01:43 +0000)]
Remove redundant newline.

llvm-svn: 307750

7 years agoRemove <__refstring> header; Move it into source directory.
Eric Fiselier [Wed, 12 Jul 2017 01:38:35 +0000 (01:38 +0000)]
Remove <__refstring> header; Move it into source directory.

The libc++ <__refstring> headers has no real reason why it should
be a public header that libc++ ships. The only reason it was in the include
directory was because libc++abi needed it to build the library.

However keeping <__refstring> a header had other problems, like requiring its
dependancies to also be in the headers. For that reason this patch
moves it into the source directory.

To work around libc++abi's need for this header a duplicated copy was added
to libc++abi in r307748. While duplicating the code is an unfortunate solution
it's the best solution that's currently possible.

In the future I would like to start a discussion on the mailing lists about
making libc++abi build as a sub-project of libc++, requiring the libc++ sources
always be present.

llvm-svn: 307749

7 years agoRemove dependancy on __refstring header; use local copy instead.
Eric Fiselier [Wed, 12 Jul 2017 01:34:21 +0000 (01:34 +0000)]
Remove dependancy on __refstring header; use local copy instead.

This patch removes the dependancy on libc++'s __refstring header,
which was only a header in the first place so that libc++abi could
build library code using it, and not because libc++ needed it in
the headers.

This patch allows libc++ to stop shipping <__refstring> publicaly
at the cost of duplicating it across projects. Ideally libc++abi
would always require the libc++ sources when building, but that's
a separate discussion I plan to start on the mailing lists shortly.

llvm-svn: 307748

7 years agoSpecify complete target triple in test
Matthias Braun [Wed, 12 Jul 2017 01:16:50 +0000 (01:16 +0000)]
Specify complete target triple in test

This should fix the problems on the greendragon build.

llvm-svn: 307747

7 years agoRevert "[libc++] Refactoring __sync_* builtins; NFC (Reland)"
Eric Fiselier [Wed, 12 Jul 2017 01:16:33 +0000 (01:16 +0000)]
Revert "[libc++] Refactoring __sync_* builtins; NFC (Reland)"

This reverts commit r307595. The commit had some issues that needed
to first be addressed in review.

llvm-svn: 307746

7 years agoFix minor typo introduced in r276404
Don Hinton [Wed, 12 Jul 2017 01:15:46 +0000 (01:15 +0000)]
Fix minor typo introduced in r276404

Summary:
A space was added between '-' and 'help' when emitting help output.

See https://reviews.llvm.org/D22621 for details.

Reviewers: MaggieYi, vsk

Reviewed By: vsk

Subscribers: llvm-commits

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

llvm-svn: 307745

7 years agoLowerTypeTests: When importing functions skip definitions where the summary contains...
Peter Collingbourne [Wed, 12 Jul 2017 00:39:12 +0000 (00:39 +0000)]
LowerTypeTests: When importing functions skip definitions where the summary contains a decl.

This normally indicates mixed CFI + non-CFI compilation, and will
result in us treating the function in the same way as a function
defined outside of the LTO unit.

Part of PR33752.

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

llvm-svn: 307744

7 years ago[ODRHash] Revert r307720 to fix buildbot.
Richard Trieu [Wed, 12 Jul 2017 00:38:27 +0000 (00:38 +0000)]
[ODRHash] Revert r307720 to fix buildbot.

llvm-svn: 307743

7 years ago[Dominators][NFC] Remove extra semicolon...
Jakub Kuderski [Wed, 12 Jul 2017 00:29:16 +0000 (00:29 +0000)]
[Dominators][NFC] Remove extra semicolon...

to silence a gcc warning.

llvm-svn: 307742

7 years ago[WebAssembly] Expose the offset of each data segment
Sam Clegg [Wed, 12 Jul 2017 00:24:54 +0000 (00:24 +0000)]
[WebAssembly] Expose the offset of each data segment

Summary:
This allows tools like lld that process relocations
to apply data relocation correctly. This information
is required because relocation are stored as section
offset.

Subscribers: jfb, dschuff, jgravelle-google, aheejin

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

llvm-svn: 307741

7 years agoFix unused variable warnings
Konstantin Zhuravlyov [Wed, 12 Jul 2017 00:15:53 +0000 (00:15 +0000)]
Fix unused variable warnings

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

llvm-svn: 307740

7 years ago[tsan] Update test to r307338
Vitaly Buka [Wed, 12 Jul 2017 00:14:05 +0000 (00:14 +0000)]
[tsan] Update test to r307338

r307338 enabled new optimization reducing number of operation in tested functions.
There is no any performance regression detectable with TsanRtlTest DISABLED_BENCH.Mop* tests.

llvm-svn: 307739

7 years agoSimplify interface now that we don't need to pass IsPCRel. NFC.
Rafael Espindola [Tue, 11 Jul 2017 23:56:10 +0000 (23:56 +0000)]
Simplify interface now that we don't need to pass IsPCRel. NFC.

llvm-svn: 307734

7 years ago[PDB] Use a more appropriate message for a fatal error
Reid Kleckner [Tue, 11 Jul 2017 23:44:51 +0000 (23:44 +0000)]
[PDB] Use a more appropriate message for a fatal error

llvm-svn: 307733

7 years ago[codeview] Change readobj symbol dumping format
Reid Kleckner [Tue, 11 Jul 2017 23:41:41 +0000 (23:41 +0000)]
[codeview] Change readobj symbol dumping format

Avoid duplicating DictScope with hand-written names everywhere.  Print
the S_-prefixed symbol kind for every record. This should make it easier
to search for certain kinds of records when debugging PDB linking.

llvm-svn: 307732

7 years ago[CMake] Support multi-target runtimes build
Petr Hosek [Tue, 11 Jul 2017 23:41:15 +0000 (23:41 +0000)]
[CMake] Support multi-target runtimes build

This changes adds support for building runtimes for multiple
different targets using LLVM runtimes directory.

The implementation follow the model used already by the builtins
build which already supports this option. To specify the runtimes
targets to be built, use the LLVM_RUNTIME_TARGETS variable, where
the valuae is the list of targets to build runtimes for. To pass
a per target variable to the runtimes build, you can set
RUNTIMES_<target>_<variable> where <variable> will be passed to the
runtimes build for <target>.

Each runtime target (except for the default one) will be installed
into lib/<target> subdirectory. Build targets will be suffixed with
the target name.

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

llvm-svn: 307731

7 years agoFully fix the movw/movt addend.
Rafael Espindola [Tue, 11 Jul 2017 23:18:25 +0000 (23:18 +0000)]
Fully fix the movw/movt addend.

The issue is not if the value is pcrel. It is whether we have a
relocation or not.

If we have a relocation, the static linker will select the upper
bits. If we don't have a relocation, we have to do it.

llvm-svn: 307730

7 years ago[IPO] Temporarily rollback r307215.
Davide Italiano [Tue, 11 Jul 2017 23:10:17 +0000 (23:10 +0000)]
[IPO] Temporarily rollback r307215.

[GlobalOpt] Remove unreachable blocks before optimizing a function.
While the change is presumably correct, it exposes a latent bug
in DI which breaks on of the CFI checks. I'll analyze it further
and try to understand what's going on.

llvm-svn: 307729

7 years agoUpdate now that the llvm-mc bug is fixed.
Rafael Espindola [Tue, 11 Jul 2017 22:56:51 +0000 (22:56 +0000)]
Update now that the llvm-mc bug is fixed.

llvm-svn: 307728

7 years ago[Dominators] Use a custom DFS implementation
Jakub Kuderski [Tue, 11 Jul 2017 22:55:04 +0000 (22:55 +0000)]
[Dominators] Use a custom DFS implementation

Summary:
Custom DFS implementation allows us to skip over certain nodes without adding them to the visited map, which is not easily doable with llvm's dfs iterators. What's more, caching predecessors becomes easy.

This patch implements a single DFS function (template) for both forward and reverse DFS, which should be easier to maintain then separate two ones.

Skipping over nodes based on a predicate will be necessary later to implement incremental updates.

There also seems to be a very slight performance improved when bootstrapping clang with this patch on my machine (3:28s -> 3:26s) .

Reviewers: dberlin, sanjoy, davide, grosser

Reviewed By: dberlin

Subscribers: llvm-commits

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

llvm-svn: 307727

7 years ago[PDB] Tweak bad type index error handling
Reid Kleckner [Tue, 11 Jul 2017 22:37:50 +0000 (22:37 +0000)]
[PDB] Tweak bad type index error handling

Translate invalid type indices to a sentinel value instead of skipping
the record. Skipping records isn't a good recovery method, because we
can skip a scope open or close record, which will confuse the scope
management code.

We currently have lots of invalid type indices on Microsoft-provided
standard libraries, because the LF_TYPESERVER2 records contain absolute
paths that are only valid on their build servers. Our type server
handlers need to look at other things (GUIDs) to find these type server
PDBs.

llvm-svn: 307726

7 years ago[codeview] Fix type index discovery for four symbol records
Reid Kleckner [Tue, 11 Jul 2017 22:37:25 +0000 (22:37 +0000)]
[codeview] Fix type index discovery for four symbol records

I encountered these when linking LLD, which uses atls.lib. Those objects
appear to use these uncommon symbol records:

  0x115E S_HEAPALLOCSITE
  0x113D S_ENVBLOCK
  0x1113 S_GTHREAD32
  0x1153 S_FILESTATIC

llvm-svn: 307725

7 years agoEnhance synchscope representation (clang)
Konstantin Zhuravlyov [Tue, 11 Jul 2017 22:23:37 +0000 (22:23 +0000)]
Enhance synchscope representation (clang)

Relevant changes required for r307722.

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

llvm-svn: 307723

7 years agoEnhance synchscope representation
Konstantin Zhuravlyov [Tue, 11 Jul 2017 22:23:00 +0000 (22:23 +0000)]
Enhance synchscope representation

  OpenCL 2.0 introduces the notion of memory scopes in atomic operations to
  global and local memory. These scopes restrict how synchronization is
  achieved, which can result in improved performance.

  This change extends existing notion of synchronization scopes in LLVM to
  support arbitrary scopes expressed as target-specific strings, in addition to
  the already defined scopes (single thread, system).

  The LLVM IR and MIR syntax for expressing synchronization scopes has changed
  to use *syncscope("<scope>")*, where <scope> can be "singlethread" (this
  replaces *singlethread* keyword), or a target-specific name. As before, if
  the scope is not specified, it defaults to CrossThread/System scope.

  Implementation details:
    - Mapping from synchronization scope name/string to synchronization scope id
      is stored in LLVM context;
    - CrossThread/System and SingleThread scopes are pre-defined to efficiently
      check for known scopes without comparing strings;
    - Synchronization scope names are stored in SYNC_SCOPE_NAMES_BLOCK in
      the bitcode.

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

llvm-svn: 307722

7 years ago[ODRHash] Support more method types.
Richard Trieu [Tue, 11 Jul 2017 22:10:49 +0000 (22:10 +0000)]
[ODRHash] Support more method types.

Hash CXXConstructorDecl and CXXDestructorDecl.  Extend the diagnostics from
CXXMethodDecl to include constructors and destructors.

llvm-svn: 307720

7 years ago[CodeGen] Rename DEBUG_TYPE to match passnames
Evandro Menezes [Tue, 11 Jul 2017 22:08:28 +0000 (22:08 +0000)]
[CodeGen] Rename DEBUG_TYPE to match passnames

Rename missing DEBUG_TYPE "machine-scheduler" from backend files, which were
absent from https://reviews.llvm.org/rL303921.

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

llvm-svn: 307719

7 years ago[x86] auto-generate full checks; NFC
Sanjay Patel [Tue, 11 Jul 2017 22:04:36 +0000 (22:04 +0000)]
[x86] auto-generate full checks; NFC

llvm-svn: 307718

7 years ago[mips][mt] Correct spelling error in comment. NFCI.
Simon Dardis [Tue, 11 Jul 2017 21:36:58 +0000 (21:36 +0000)]
[mips][mt] Correct spelling error in comment. NFCI.

llvm-svn: 307717

7 years ago[mips][mt][2/7] Implement .module and .set directives for the MT ASE.
Simon Dardis [Tue, 11 Jul 2017 21:28:36 +0000 (21:28 +0000)]
[mips][mt][2/7] Implement .module and .set directives for the MT ASE.

This patch implements the .module and .set directives for the MT ASE,
notably that .module sets the relevant flags in .MIPS.abiflags and .set
doesn't.

Reviewers: slthakur, atanasyan

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

llvm-svn: 307716

7 years ago[clangd] Fix Go to Definition not working in VSCode extension
Marc-Andre Laperle [Tue, 11 Jul 2017 21:26:18 +0000 (21:26 +0000)]
[clangd] Fix Go to Definition not working in VSCode extension

Summary:
The URI conversion logic was returning 'undefined' when going from server to
VSCode which broke the Go to Definition functionality.

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 307715

7 years ago[ARM, ELF] Don't shift movt relocation offsets
Martin Storsjo [Tue, 11 Jul 2017 21:07:10 +0000 (21:07 +0000)]
[ARM, ELF] Don't shift movt relocation offsets

For ELF, a movw+movt pair is handled as two separate relocations.
If an offset should be applied to the symbol address, this offset is
stored as an immediate in the instruction (as opposed to stored as an
offset in the relocation itself).

Even though the actual value stored in the movt immediate after linking
is the top half of the value, we need to store the unshifted offset
prior to linking. When the relocation is made during linking, the offset
gets added to the target symbol value, and the upper half of the value
is stored in the instruction.

This makes sure that movw+movt with offset symbols get properly
handled, in case the offset addition in the lower half should be
carried over to the upper half.

This makes the output from the additions to the test case match
the output from GNU binutils.

For COFF and MachO, the movw/movt relocations are handled as a pair,
and the overflow from the lower half gets carried over to the movt,
so they should keep the shifted offset just as before.

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

llvm-svn: 307713

7 years agoswitch on enum should be exhaustive and warning-free
Tim Hammerquist [Tue, 11 Jul 2017 21:06:20 +0000 (21:06 +0000)]
switch on enum should be exhaustive and warning-free

Summary:
Testing the value of type_code against the closed enum TypeCodes
provides statically verifiable completeness of testing. However, one
branch assigns to type_code by casting directly from a masked integer
value. This is currently handled by adding a default: case after
checking each TypeCodes instance. This patch introduces a bool variable
containing the "default" state value, allowing the switch to be
exhaustive, protect against future instances not being handled in the
switch, and preserves the original logic.

This addresses the warning:
warning: default label in switch which covers all enumeration values
[-Wcovered-switch-default]

As an issue of maintainability, the bitmask on line 524 handles the
current values of TypeCodes enum, but this will be invalid if the enum
is extended. This patch does not address this, and a more closed
conversion from cfinfoa -> TypeCodes would help protect against this.

Reviewers: spyffe, lhames, sas

Reviewed By: sas

Subscribers: sas, lldb-commits

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

llvm-svn: 307712

7 years ago [AArch64] Remove unused IsDarwin & IsNotDarwin predicates (NFCI).
Florian Hahn [Tue, 11 Jul 2017 20:56:24 +0000 (20:56 +0000)]
 [AArch64] Remove unused IsDarwin & IsNotDarwin predicates (NFCI).

Reviewers: t.p.northover, rengolin

Reviewed By: t.p.northover

Subscribers: aemerson, javed.absar, llvm-commits, kristof.beyls

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

llvm-svn: 307706

7 years ago[LoopUnrollRuntime] NFC: Add some debugging trace messages for why loop wasn't unrolled.
Anna Thomas [Tue, 11 Jul 2017 20:44:37 +0000 (20:44 +0000)]
[LoopUnrollRuntime] NFC: Add some debugging trace messages for why loop wasn't unrolled.

llvm-svn: 307705

7 years ago[WWW] Add a section to Getting Started about building out-of-tree
Philip Pfaffe [Tue, 11 Jul 2017 20:37:28 +0000 (20:37 +0000)]
[WWW] Add a section to Getting Started about building out-of-tree

llvm-svn: 307704