platform/upstream/llvm.git
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

7 years agoRemove unnecessary local variable.
Rui Ueyama [Tue, 11 Jul 2017 20:33:04 +0000 (20:33 +0000)]
Remove unnecessary local variable.

llvm-svn: 307703

7 years ago[ProfileData] Add new option to dump topn hottest functions
Xinliang David Li [Tue, 11 Jul 2017 20:30:43 +0000 (20:30 +0000)]
[ProfileData] Add new option to dump topn hottest functions

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

llvm-svn: 307702

7 years agoFix clang-tidy diagnostic.cpp test on Windows
Reid Kleckner [Tue, 11 Jul 2017 20:22:17 +0000 (20:22 +0000)]
Fix clang-tidy diagnostic.cpp test on Windows

llvm-svn: 307701

7 years ago[NewGVN] Check for congruency of memory accesses.
Davide Italiano [Tue, 11 Jul 2017 19:49:12 +0000 (19:49 +0000)]
[NewGVN] Check for congruency of memory accesses.

This is fine as nothing in the code relies on leader and memory
leader being the same for a given congruency class. Ack'ed by
Dan.

Fixes PR33720.

llvm-svn: 307699

7 years agoreverting 307677.
Michael Zuckerman [Tue, 11 Jul 2017 19:46:11 +0000 (19:46 +0000)]
reverting 307677.

llvm-svn: 307698

7 years ago[OPENMP] Skip BuildMemberExpr() in BuildFieldReferenceExpr(), NFC, by Kai Noda
Alexey Bataev [Tue, 11 Jul 2017 19:43:28 +0000 (19:43 +0000)]
[OPENMP] Skip BuildMemberExpr() in BuildFieldReferenceExpr(), NFC, by Kai Noda

In the OpenMP mode, we don't need to call BuildMemberExpr() only to discard its
return value. BuildDeclRefExpr() is called instead.

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

llvm-svn: 307697

7 years agoUse internal_strncpy to copy filename in linux procmaps
Francis Ricci [Tue, 11 Jul 2017 19:40:54 +0000 (19:40 +0000)]
Use internal_strncpy to copy filename in linux procmaps

Cleaner than using a while loop to copy the string character by character.

Reviewers: alekseyshl, glider

Subscribers: llvm-commits

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

llvm-svn: 307696

7 years agoInline function to get mac segment address range
Francis Ricci [Tue, 11 Jul 2017 19:40:53 +0000 (19:40 +0000)]
Inline function to get mac segment address range

Summary:
This function is only called once and is fairly simple. Inline to
keep API simple.

Reviewers: alekseyshl, kubamracek

Subscribers: llvm-commits

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

llvm-svn: 307695

7 years ago[NewGVN] Fix an innocent typo I found while debugging PR33720.
Davide Italiano [Tue, 11 Jul 2017 19:19:45 +0000 (19:19 +0000)]
[NewGVN] Fix an innocent typo I found while debugging PR33720.

llvm-svn: 307694

7 years ago[OPENMP] Add restriction for reduction clause in taskloop directives.
Alexey Bataev [Tue, 11 Jul 2017 19:16:44 +0000 (19:16 +0000)]
[OPENMP] Add restriction for reduction clause in taskloop directives.

Added checks for the reduction clauses in the taskloop directives:
1. Only addressable items must be used in reduction clauses.
2. Reduction clauses cannot be used with nogroup clauses.

llvm-svn: 307693

7 years ago[NewGVN] Clarify the function invariants formatting them properly.
Davide Italiano [Tue, 11 Jul 2017 19:15:36 +0000 (19:15 +0000)]
[NewGVN] Clarify the function invariants formatting them properly.

llvm-svn: 307692

7 years ago[PPC] Fix one test case regression for patch https://reviews.llvm.org/D34337.
Tony Jiang [Tue, 11 Jul 2017 19:07:10 +0000 (19:07 +0000)]
[PPC] Fix one test case regression for patch https://reviews.llvm.org/D34337.

llvm-svn: 307691

7 years agoDelete redundant InVersionScript field.
Rafael Espindola [Tue, 11 Jul 2017 18:59:45 +0000 (18:59 +0000)]
Delete redundant InVersionScript field.

Thanks to Rui for the suggestion.

llvm-svn: 307690

7 years agoRefactor MemoryMappingLayout::Next to use a single struct instead of output parameter...
Francis Ricci [Tue, 11 Jul 2017 18:54:00 +0000 (18:54 +0000)]
Refactor MemoryMappingLayout::Next to use a single struct instead of output parameters. NFC.

Summary:
This is the first in a series of patches to refactor sanitizer_procmaps
to allow MachO section information to be exposed on darwin.

In addition, grouping all segment information in a single struct is
cleaner than passing it through a large set of output parameters, and
avoids the need for annotations of NULL parameters for unneeded
information.

The filename string is optional and must be managed and supplied by the
calling function. This is to allow the MemoryMappedSegment struct to be
stored on the stack without causing overly large stack sizes.

Reviewers: alekseyshl, kubamracek, glider

Subscribers: emaste, llvm-commits

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

llvm-svn: 307688

7 years ago[LibFuzzer] Fix `-Wcomment` warning emitted by GCC.
Dan Liew [Tue, 11 Jul 2017 18:27:52 +0000 (18:27 +0000)]
[LibFuzzer] Fix `-Wcomment` warning emitted by GCC.

```
./FuzzerIOWindows.cpp:185:1: warning: multi-line comment [-Wcomment]
 // Parse a directory ending in separator, like: SomeDir\
 ^
./FuzzerIOWindows.cpp:200:1: warning: multi-line comment [-Wcomment]
 // Parse a servername and share, like: SomeServer\SomeShare\
 ^
```

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

llvm-svn: 307687

7 years ago[LibFuzzer] Fix `-Wpedantic` warning reported by Eric Christopher.
Dan Liew [Tue, 11 Jul 2017 18:27:48 +0000 (18:27 +0000)]
[LibFuzzer] Fix `-Wpedantic` warning reported by Eric Christopher.

The warning is reproducible with GCC 4.8. Thanks to David Blaikie for
the suggested fix.

The reported warning was

```
/usr/local/google/home/echristo/sources/llvm/lib/Fuzzer/FuzzerExtFunctions.def:29:10: warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object [-Wpedantic]
 EXT_FUNC(__lsan_enable, void, (), false);
          ^
/usr/local/google/home/echristo/sources/llvm/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp:44:24: note: in definition of macro ‘EXT_FUNC’
   CheckFnPtr((void *)::NAME, #NAME, WARN);
                        ^
```

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

llvm-svn: 307686

7 years ago[asan] Fix asan_device_setup --use-su mode on Android 7.x.
Evgeniy Stepanov [Tue, 11 Jul 2017 18:18:50 +0000 (18:18 +0000)]
[asan] Fix asan_device_setup --use-su mode on Android 7.x.

mount command does not accept -o remount,rw flag on some versions of Android.
mount -o rw,remount works everywhere.

llvm-svn: 307685

7 years ago[msan] Only check shadow memory for operands that are sized.
Evgeniy Stepanov [Tue, 11 Jul 2017 18:13:52 +0000 (18:13 +0000)]
[msan] Only check shadow memory for operands that are sized.

Fixes PR33347: https://bugs.llvm.org/show_bug.cgi?id=33347.

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

Patch by Matt Morehouse.

llvm-svn: 307684

7 years agoRename z_Linux_asm.s to z_Linux_asm.S
Dimitry Andric [Tue, 11 Jul 2017 18:04:56 +0000 (18:04 +0000)]
Rename z_Linux_asm.s to z_Linux_asm.S

Summary:
On Unix, a .S file is normally an assembly source which must be
preprocessed with a C preprocessor, while a .s file is "plain" assembly.
The former is handled by the compiler driver (cc), the latter is
directly passed to the assembler binary (as).

Because z_Linux_asm.s is supposed to be preprocessed, rename it to .S,
so it can be automatically picked up correctly by build systems.

Reviewers: AndreyChurbanov, emaste, jlpeyton

Reviewed By: AndreyChurbanov

Subscribers: mgorny, openmp-commits

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

llvm-svn: 307680