platform/upstream/llvm.git
5 years ago[hwasan] relax the rint-memory-usage.c test further
Kostya Serebryany [Fri, 7 Sep 2018 01:36:34 +0000 (01:36 +0000)]
[hwasan] relax the rint-memory-usage.c test further

llvm-svn: 341625

5 years ago[X86] Fix some incorrect comments. NFC
Craig Topper [Fri, 7 Sep 2018 01:29:42 +0000 (01:29 +0000)]
[X86] Fix some incorrect comments. NFC

llvm-svn: 341624

5 years agoEnable the fp-armv8 disassembler feature when disassembling Cortex-M
Jason Molenda [Fri, 7 Sep 2018 01:28:48 +0000 (01:28 +0000)]
Enable the fp-armv8 disassembler feature when disassembling Cortex-M
code.  This will enable disassembly of the optional subset of
neon that some Cortex cores support.  Add a unit test to check
that a few of these instructions disassemble as expected.

<rdar://problem/26674303>

llvm-svn: 341623

5 years ago[libfuzzer] Use cl driver mode for tests and enable another test on Windows
Jonathan Metzman [Fri, 7 Sep 2018 01:11:31 +0000 (01:11 +0000)]
[libfuzzer] Use cl driver mode for tests and enable another test on Windows

Summary:
When targeting MSVC: compile using clang's cl driver mode (this is needed for
libfuzzer's exit_on_src_pos feature). Don't use -lstdc++ when linking,
it isn't needed and causes a warning.
On Windows: Fix exit_on_src_pos.test by making sure debug info isn't
overwritten during compilation of second binary by using .exe extension.

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: aprantl, JDevlieghere

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

llvm-svn: 341622

5 years ago[analyzer] Add coverage information to plist output, update tests
George Karpenkov [Fri, 7 Sep 2018 00:44:17 +0000 (00:44 +0000)]
[analyzer] Add coverage information to plist output, update tests

Split tests which were still using FileCheck to compare plists.

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

llvm-svn: 341621

5 years ago[analyzer] [NFC] Prefer passing around reference to std::unique_ptr&
George Karpenkov [Fri, 7 Sep 2018 00:43:55 +0000 (00:43 +0000)]
[analyzer] [NFC] Prefer passing around reference to std::unique_ptr&

When object is owned elsewhere

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

llvm-svn: 341620

5 years ago[analyzer] Executed lines: store file IDs, not hashes.
George Karpenkov [Fri, 7 Sep 2018 00:43:37 +0000 (00:43 +0000)]
[analyzer] Executed lines: store file IDs, not hashes.

Raw FileIDs are needed for the PlistDiagnostics to produce stable filenames.

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

llvm-svn: 341619

5 years ago[analyzer] Do not add invalid source location to the coverage information
George Karpenkov [Fri, 7 Sep 2018 00:43:17 +0000 (00:43 +0000)]
[analyzer] Do not add invalid source location to the coverage information

Invalid source locations may arise from generated code.

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

llvm-svn: 341618

5 years ago[analyzer] Push updating-the-executed-lines logic into the BugReporter.
George Karpenkov [Fri, 7 Sep 2018 00:42:53 +0000 (00:42 +0000)]
[analyzer] Push updating-the-executed-lines logic into the BugReporter.

So it can be reused across different consumers.

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

llvm-svn: 341617

5 years ago[analyzer] Skip printing trivial nodes in exploded graph
George Karpenkov [Fri, 7 Sep 2018 00:42:32 +0000 (00:42 +0000)]
[analyzer] Skip printing trivial nodes in exploded graph

A node is considered to be trivial if it only has one successor, one
predecessor, and a state equal to the predecessor.
Can drastically (> 2x) reduce the size of the generated exploded
graph.

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

llvm-svn: 341616

5 years ago[hwasan] make the print-memory-usage.c less agressive: do not assume that malloc...
Kostya Serebryany [Fri, 7 Sep 2018 00:38:31 +0000 (00:38 +0000)]
[hwasan] make the print-memory-usage.c less agressive: do not assume that malloc can't happen before main

llvm-svn: 341615

5 years ago[llvm-strip] -p test fix for windows buildbots
Jordan Rupprecht [Fri, 7 Sep 2018 00:28:54 +0000 (00:28 +0000)]
[llvm-strip] -p test fix for windows buildbots

Windows ls prints dates as "1997-05-05" instead of "May 05 1997", so only check for a leading space.

llvm-svn: 341614

5 years agoRevert: [llvm-objcopy] Dwarf .debug section compression (Second Attempt).
Puyan Lotfi [Fri, 7 Sep 2018 00:28:25 +0000 (00:28 +0000)]
Revert: [llvm-objcopy] Dwarf .debug section compression (Second Attempt).

Various bots still fail for unknown reason.

llvm-svn: 341613

5 years ago[hwasan] Fix malloc overflow detection.
Evgeniy Stepanov [Fri, 7 Sep 2018 00:27:11 +0000 (00:27 +0000)]
[hwasan] Fix malloc overflow detection.

Check size limit before rounding up, otherwise malloc((size_t)-1)
would happily allocate 0 bytes.

Steal a nice test case from scudo.

llvm-svn: 341612

5 years ago[ELF] Check if LinkSec is nullptr when initializing SHF_LINK_ORDER sections
Fangrui Song [Fri, 7 Sep 2018 00:18:07 +0000 (00:18 +0000)]
[ELF] Check if LinkSec is nullptr when initializing SHF_LINK_ORDER sections

Summary: This protects lld from a null pointer dereference when a faulty input file has such invalid sh_link fields.

Reviewers: ruiu, espindola

Reviewed By: ruiu

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 341611

5 years ago[hwasan] change the thread list so that main_thread can also be removed
Kostya Serebryany [Fri, 7 Sep 2018 00:16:55 +0000 (00:16 +0000)]
[hwasan] change the thread list so that main_thread can also be removed

llvm-svn: 341610

5 years ago[PDB] Rename some files in the native reader.
Zachary Turner [Fri, 7 Sep 2018 00:12:56 +0000 (00:12 +0000)]
[PDB] Rename some files in the native reader.

By calling these NativeType<foo>.cpp, they will all be sorted
together, and it also distinguishes the types from the symbols.

llvm-svn: 341609

5 years ago[PDB] Create a SymbolCache class.
Zachary Turner [Fri, 7 Sep 2018 00:12:34 +0000 (00:12 +0000)]
[PDB] Create a SymbolCache class.

Part of the responsibility of the native PDB reader is to cache
symbols the first time they are accessed, so they can then be
looked up by an ID.  Furthermore, we need to resolve type indices
to records that we vend to the user, and other things.  Previously
this code was all thrown together a bit haphazardly in the native
session class, but it makes sense to collect all of this into a
single class whose sole responsibility is to manage the collection
of known symbols.

llvm-svn: 341608

5 years ago[llvm-objcopy] Dwarf .debug section compression support (zlib, zlib-gnu).
Puyan Lotfi [Thu, 6 Sep 2018 23:59:50 +0000 (23:59 +0000)]
[llvm-objcopy] Dwarf .debug section compression support (zlib, zlib-gnu).

  Second Attempt. Alignment issues resolved. zlib::isAvailable() detected.

  Usage:

  llvm-objcopy --compress-debug-sections=zlib foo.o
  llvm-objcopy --compress-debug-sections=zlib-gnu foo.o

  In both cases the debug section contents is compressed with zlib. In the GNU
  style case the header is the "ZLIB" magic string followed by the uint64 big-
  endian decompressed size. In the non-GNU mode the header is the
  Elf(32|64)_Chdr.

  Decompression support is coming soon.

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

llvm-svn: 341607

5 years ago[X86] Add RMW ADC patterns with load in operand 1.
Craig Topper [Thu, 6 Sep 2018 23:55:36 +0000 (23:55 +0000)]
[X86] Add RMW ADC patterns with load in operand 1.

ADC is commutable and the load could be in either operand, but we were only checking operand 0.

Ideally we'd mark X86adc_flag as commutable and tablegen would automatically do this, but the EFLAGS register mention is preventing it.

llvm-svn: 341606

5 years ago[X86] Add a test case showing failure to use the RMW form of ADC when the load is...
Craig Topper [Thu, 6 Sep 2018 23:55:34 +0000 (23:55 +0000)]
[X86] Add a test case showing failure to use the RMW form of ADC when the load is in operand 1 going into isel.

The ADC instruction is commutable, but we only have RMW isel patterns with a load on the left hand side. Nothing will canonicalize loads to the LHS on these ops. So we need two patterns.

llvm-svn: 341605

5 years agoFix SampleProf code on LLP64 platforms with stoull
Reid Kleckner [Thu, 6 Sep 2018 23:35:58 +0000 (23:35 +0000)]
Fix SampleProf code on LLP64 platforms with stoull

Otherwise, stoul will throw an out of range exception if the integer
doesn't fit in a 32-bit number.

llvm-svn: 341604

5 years ago[analyzer] [NFC] Move dumping program point into a separate function
George Karpenkov [Thu, 6 Sep 2018 23:08:27 +0000 (23:08 +0000)]
[analyzer] [NFC] Move dumping program point into a separate function

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

llvm-svn: 341603

5 years ago[analyzer] Dump stable identifiers for exploded nodes
George Karpenkov [Thu, 6 Sep 2018 23:08:07 +0000 (23:08 +0000)]
[analyzer] Dump stable identifiers for exploded nodes

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

llvm-svn: 341602

5 years ago[analyzer] Remove traces of ubigraph visualization
George Karpenkov [Thu, 6 Sep 2018 23:07:47 +0000 (23:07 +0000)]
[analyzer] Remove traces of ubigraph visualization

Ubigraph project has been dead since about 2008, and to the best of my
knowledge, no one was using it.
Previously, I wasn't able to launch the existing binary at all.

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

llvm-svn: 341601

5 years ago[analyzer] Dump a reproducible, deterministic ID of program state to exploded graph
George Karpenkov [Thu, 6 Sep 2018 23:07:26 +0000 (23:07 +0000)]
[analyzer] Dump a reproducible, deterministic ID of program state to exploded graph

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

llvm-svn: 341600

5 years agoProvide a method for generating deterministic IDs for pointers allocated in BumpPtrAl...
George Karpenkov [Thu, 6 Sep 2018 23:07:05 +0000 (23:07 +0000)]
Provide a method for generating deterministic IDs for pointers allocated in BumpPtrAllocator

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

llvm-svn: 341599

5 years ago[hwasan] Remove allocator interceptors.
Evgeniy Stepanov [Thu, 6 Sep 2018 22:53:08 +0000 (22:53 +0000)]
[hwasan] Remove allocator interceptors.

Summary:
When building without COMPILER_RT_HWASAN_WITH_INTERCEPTORS, skip
interceptors for malloc/free/etc and only export their versions with
__sanitizer_ prefix.

Also remove a hack in mallinfo() interceptor that does not apply to
hwasan.

Reviewers: kcc

Subscribers: kubamracek, krytarowski, llvm-commits

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

llvm-svn: 341598

5 years agoFix error with SmallString implicit conversion.
Zachary Turner [Thu, 6 Sep 2018 22:47:32 +0000 (22:47 +0000)]
Fix error with SmallString implicit conversion.

llvm-svn: 341597

5 years ago[X86] Add isel patterns for commuting X86adc_flag with a load in the LHS.
Craig Topper [Thu, 6 Sep 2018 22:41:44 +0000 (22:41 +0000)]
[X86] Add isel patterns for commuting X86adc_flag with a load in the LHS.

The peephole pass likely gets this normally, but we should be doing it during isel.

Ideally we'd just make the X86adc_flag pattern SDNPCommutable, but the tablegen doesn't handle that when one of the operands is a register reference.

llvm-svn: 341596

5 years ago[llvm-strip] Fix -p test to check for explicit spaces around dates, to avoid when...
Jordan Rupprecht [Thu, 6 Sep 2018 22:34:48 +0000 (22:34 +0000)]
[llvm-strip] Fix -p test to check for explicit spaces around dates, to avoid when the filename happens to contain 1995/1997.

llvm-svn: 341595

5 years ago[hwasan] fix pthread_exit
Kostya Serebryany [Thu, 6 Sep 2018 22:13:43 +0000 (22:13 +0000)]
[hwasan] fix pthread_exit

llvm-svn: 341594

5 years agoThe initial .text section generated in object files was missing the
Eric Christopher [Thu, 6 Sep 2018 22:09:31 +0000 (22:09 +0000)]
The initial .text section generated in object files was missing the
SHF_ARM_PURECODE flag when being built with the -mexecute-only flag.
All code sections of an ELF must have the flag set for the final .text
section to be execute-only, otherwise the flag gets removed.

A HasData flag is added to MCSection to aid in the determination that
the section is empty. A virtual setTargetSectionFlags is added to
MCELFObjectTargetWriter to allow subclasses to set target specific
section flags to be added to sections which we then use in the ARM
backend to set SHF_ARM_PURECODE.

Patch by Ivan Lozano!

Reviewed By: echristo

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

llvm-svn: 341593

5 years ago[hwasan] introduce __hwasan_print_memory_usage
Kostya Serebryany [Thu, 6 Sep 2018 22:08:41 +0000 (22:08 +0000)]
[hwasan] introduce __hwasan_print_memory_usage

llvm-svn: 341592

5 years ago[SampleFDO] Make sample profile loader unaware of compact format change.
Wei Mi [Thu, 6 Sep 2018 22:03:37 +0000 (22:03 +0000)]
[SampleFDO] Make sample profile loader unaware of compact format change.

The patch tries to make sample profile loader independent of profile format
change. It moves compact format related code into FunctionSamples and
SampleProfileReader classes, and sample profile loader only has to interact
with those two classes and will be unaware of profile format changes.

The cleanup also contain some fixes to further remove the difference between
compactbinary format and binary format. After the cleanup using different
formats originated from the same profile will generate the same binaries,
which we verified by compiling two large server benchmarks w/wo thinlto.

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

llvm-svn: 341591

5 years agoFix a configure issue with Visual Studio generators.
Zachary Turner [Thu, 6 Sep 2018 22:00:38 +0000 (22:00 +0000)]
Fix a configure issue with Visual Studio generators.

We can't put the unittest source dir map in the configuration
specific directory because VS doesn't have a configure-specific
directory, instead it only knows this at runtime.  So we have
to remove this from the path.  This in turn means that the path
will be slightly different in VS configurations vs non vs
configurations.  In the former, the source map will be in the
parent directory of the executable, and in the latter it will
be in the same directory as the executable.  So check both.

llvm-svn: 341590

5 years agoRevert r341413
Scott Linder [Thu, 6 Sep 2018 21:38:56 +0000 (21:38 +0000)]
Revert r341413

Causes a regression in expensive checks.

llvm-svn: 341589

5 years agoOutput per-function size-info remarks
Jessica Paquette [Thu, 6 Sep 2018 21:19:54 +0000 (21:19 +0000)]
Output per-function size-info remarks

This patch adds per-function size information remarks. Previously, passing
-Rpass-analysis=size-info would only give you per-module changes. By adding
the ability to do this per-function, it's easier to see which functions
contributed the most to size changes.

https://reviews.llvm.org/D51467

llvm-svn: 341588

5 years ago[LoopPassManager] MemorySSA should be preserved when enabled.
Alina Sbirlea [Thu, 6 Sep 2018 20:54:24 +0000 (20:54 +0000)]
[LoopPassManager] MemorySSA should be preserved when enabled.

llvm-svn: 341587

5 years agoReland rL341509: "[llvm-dwp] Use buffer_stream if output file is not seekable (e...
Fangrui Song [Thu, 6 Sep 2018 20:26:54 +0000 (20:26 +0000)]
Reland rL341509: "[llvm-dwp] Use buffer_stream if output file is not seekable (e.g. "-")"

It caused ambiguity between llvm::cl::Optional and llvm::Optional, which
has been fixed by dropping `using namespace cl;` in favor of explicit
cl:: qualified names.

llvm-svn: 341586

5 years ago[COFF] don't mark lazy symbols as used in regular objects
Bob Haarman [Thu, 6 Sep 2018 20:23:56 +0000 (20:23 +0000)]
[COFF] don't mark lazy symbols as used in regular objects

Summary:
r338767 updated the COFF and wasm linker SymbolTable code to be
strutured more like the ELF linker's. That inadvertedly changed the
behavior of the COFF linker so that lazy symbols would be marked as
used in regular objects. This change adds an overload of the insert()
function, similar to the ELF linker, which does not perform that
marking.

Reviewers: ruiu, rnk, hans

Subscribers: aheejin, sunfish, llvm-commits

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

llvm-svn: 341585

5 years ago[llvm-dwp] Use cl:: instead of using namespace cl
Fangrui Song [Thu, 6 Sep 2018 20:23:34 +0000 (20:23 +0000)]
[llvm-dwp] Use cl:: instead of using namespace cl

`using namespace cl` makes llvm::cl::Optional (in Support/CommandLine.h) visible which will cause ambiguity when unqualified `Optional` is looked up (can also refer to llvm::Optional).

cl:: is used much more than `using namespace cl`, so let's not use the latter.

Also append \n to the argument of cl::ParseCommandLineOptions

llvm-svn: 341584

5 years agoFix reported range of partial token replacement
Stephen Kelly [Thu, 6 Sep 2018 20:16:34 +0000 (20:16 +0000)]
Fix reported range of partial token replacement

Summary: Fixes bug: 38678

Reviewers: klimek, rsmith

Subscribers: cfe-commits

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

llvm-svn: 341583

5 years agoAdd missing #include for Testing/Support/SupportHelpers.h
Fangrui Song [Thu, 6 Sep 2018 20:01:06 +0000 (20:01 +0000)]
Add missing #include for Testing/Support/SupportHelpers.h

llvm-svn: 341582

5 years ago[ARC] Prevent InstPrinter from crashing on unknown condition codes.
Tatyana Krasnukha [Thu, 6 Sep 2018 19:58:26 +0000 (19:58 +0000)]
[ARC] Prevent InstPrinter from crashing on unknown condition codes.

Summary:
Instruction printer shouldn't crash with assertions due to incorrect input data. llvm_unreachable is not intended for runtime error handling.

Reviewers: petecoup

Reviewed By: petecoup

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

llvm-svn: 341581

5 years agoQuick fix for -DBUILD_SHARED_LIBS=on build after rL341502
Fangrui Song [Thu, 6 Sep 2018 19:51:20 +0000 (19:51 +0000)]
Quick fix for -DBUILD_SHARED_LIBS=on build after rL341502

libLLVMTestingSupport.so references a symbol in utils/unittest/UnitTestMain/TestMain.cpp (a layering issue) and will cause a link error because of -Wl,-z,defs (cmake/modules/HandleLLVMOptions.cmake)

Waiting zturner for a better fix.

llvm-svn: 341580

5 years ago[ORC] Make RuntimeDyldObjectLinkingLayer2 take memory managers by unique_ptr.
Lang Hames [Thu, 6 Sep 2018 19:39:26 +0000 (19:39 +0000)]
[ORC] Make RuntimeDyldObjectLinkingLayer2 take memory managers by unique_ptr.

The existing memory manager API can not be shared between objects when linking
concurrently (since there is no way to know which concurrent allocations were
performed on behalf of which object, and hence which allocations would be safe
to finalize when finalizeMemory is called). For now, we can work around this by
requiring a new memory manager for each object.

This change only affects the concurrent version of the ORC APIs.

llvm-svn: 341579

5 years ago[ORC] Remove the mapSectionAddress method from RuntimeDyldObjectLinkingLayer2.
Lang Hames [Thu, 6 Sep 2018 19:39:22 +0000 (19:39 +0000)]
[ORC] Remove the mapSectionAddress method from RuntimeDyldObjectLinkingLayer2.

Section address mappings can be applied using the RuntimeDyld instance passed to
the RuntimeDyld::MemoryManager::notifyObjectLoaded method. Proving an alternate
route via RuntimeDyldObjectLinkingLayer2 is redundant.

llvm-svn: 341578

5 years ago[llvm-ar] Move a variable declaration closer to where it is needed. NFC.
Martin Storsjo [Thu, 6 Sep 2018 19:03:24 +0000 (19:03 +0000)]
[llvm-ar] Move a variable declaration closer to where it is needed. NFC.

This was from a missed review comment from D51338.

llvm-svn: 341577

5 years ago[clangd] Add "Deprecated" field to Symbol and CodeCompletion.
Eric Liu [Thu, 6 Sep 2018 18:52:26 +0000 (18:52 +0000)]
[clangd] Add "Deprecated" field to Symbol and CodeCompletion.

Summary: Also set "deprecated" field in LSP CompletionItem.

Reviewers: sammccall, kadircet

Reviewed By: sammccall

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

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

llvm-svn: 341576

5 years ago[x86] add tests for pow --> cbrt; NFC
Sanjay Patel [Thu, 6 Sep 2018 18:42:55 +0000 (18:42 +0000)]
[x86] add tests for pow --> cbrt; NFC

llvm-svn: 341575

5 years agoMove init code in AArch64SelectionDAGTest to SetUpTestCase (NFC)
Scott Linder [Thu, 6 Sep 2018 18:40:35 +0000 (18:40 +0000)]
Move init code in AArch64SelectionDAGTest to SetUpTestCase (NFC)

llvm-svn: 341574

5 years agoRemove deprecated API
Stephen Kelly [Thu, 6 Sep 2018 18:26:30 +0000 (18:26 +0000)]
Remove deprecated API

Reviewers: teemperor!

Subscribers: cfe-commits

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

llvm-svn: 341573

5 years agoRe-land r334417 "[MS] Use mangled names and comdats for string merging with ASan"
Reid Kleckner [Thu, 6 Sep 2018 18:25:39 +0000 (18:25 +0000)]
Re-land r334417 "[MS] Use mangled names and comdats for string merging with ASan"

The issue with -fprofile-generate was fixed and the dependent CL
relanded in r340232.

llvm-svn: 341572

5 years ago[llvm-ar] Support * as comment char in MRI scripts
Martin Storsjo [Thu, 6 Sep 2018 18:10:45 +0000 (18:10 +0000)]
[llvm-ar] Support * as comment char in MRI scripts

MRI scripts have two comment chars, * and ;, but only the latter was
supported before.

Also allow leading spaces before comment chars (and before any command
string), and allow comments after a command.

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

llvm-svn: 341571

5 years ago[OPENMP] Fix PR38823: Do not emit vtable if it is not used in target
Alexey Bataev [Thu, 6 Sep 2018 17:56:28 +0000 (17:56 +0000)]
[OPENMP] Fix PR38823: Do not emit vtable if it is not used in target
context.

If the explicit template instantiation definition defined outside of the
target context, its vtable should not be marked as used. This is true
for other situations where the compiler want to emit vtables
unconditionally.

llvm-svn: 341570

5 years ago[libfuzzer] Correct typo in comment (test commit).
Jonathan Metzman [Thu, 6 Sep 2018 17:50:01 +0000 (17:50 +0000)]
[libfuzzer] Correct typo in comment (test commit).

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

llvm-svn: 341569

5 years ago[dsymutil] Reduce peak memory usage for the single threaded execution.
Jonas Devlieghere [Thu, 6 Sep 2018 17:31:59 +0000 (17:31 +0000)]
[dsymutil] Reduce peak memory usage for the single threaded execution.

Keeping the compile units in memory is expensive. For the single
threaded case we allocate them in the analyze part and deallocate them
again once we've finished cloning. This poses a problem in the single
threaded case where we did all the analysis first followed by all the
cloning. This meant we had all the link context in memory right after
analyzing finished.

This patch changes the way we order work in the single threaded case.
Instead of doing all the analysis and cloning in serial, we now
interleave the two so we can deallocate the memory as soon as a file is
processed. The result is binary identical and peak memory usage went
down from 13.43GB to 5.73GB for a debug build of trunk clang.

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

llvm-svn: 341568

5 years agoAMDGPU: Remove old hack for function addresses
Matt Arsenault [Thu, 6 Sep 2018 17:23:24 +0000 (17:23 +0000)]
AMDGPU: Remove old hack for function addresses

llvm-svn: 341567

5 years ago[Sema] Clean up some __builtin_*_chk diagnostics
Erik Pilkington [Thu, 6 Sep 2018 17:19:33 +0000 (17:19 +0000)]
[Sema] Clean up some __builtin_*_chk diagnostics

Namely, print the likely macro name when it's used, and include the actual
computed sizes in the diagnostic message, which are sometimes not obvious.

rdar://43909200

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

llvm-svn: 341566

5 years ago[NFC] - in preparation for adding nsw, nuw and exact as flags to MI
Michael Berg [Thu, 6 Sep 2018 17:07:29 +0000 (17:07 +0000)]
[NFC] - in preparation for adding nsw, nuw and exact as flags to MI

llvm-svn: 341565

5 years agoRe-commit "Enable DWARF accelerator tables by default when tuning for lldb (-glldb...
Pavel Labath [Thu, 6 Sep 2018 17:01:45 +0000 (17:01 +0000)]
Re-commit "Enable DWARF accelerator tables by default when tuning for lldb (-glldb => -gpubnames)""

This recommits r341472, which was reverted due to test failures on macos bots.

The issue was that a macos target implies -glldb which, together with
this patch added a -gpubnames switch where there previously wasn't one.
The intentions of those checks was to check that -gpubnames is not
emitted by default so I add an explicit -ggdb arg to those command lines
to get same behavior on all platforms (the fact that -glldb *does* set
-gpubnames is tested by a separate test).

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

llvm-svn: 341564

5 years ago[libomptarget] Remove two unneeded includes, NFCI.
Jonas Hahnfeld [Thu, 6 Sep 2018 17:00:57 +0000 (17:00 +0000)]
[libomptarget] Remove two unneeded includes, NFCI.

Follow-up to r340542 and r340767.

llvm-svn: 341563

5 years ago[libfuzzer] Fix fuzzer-oom.test on windows and reenable it.
Max Moroz [Thu, 6 Sep 2018 16:48:18 +0000 (16:48 +0000)]
[libfuzzer] Fix fuzzer-oom.test on windows and reenable it.

Summary: Patch by Jonathan Metzman (@metzman).

Reviewers: Dor1s, morehouse

Reviewed By: Dor1s

Subscribers: delcypher, llvm-commits, #sanitizers

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

llvm-svn: 341562

5 years agoFix a warning.
Zachary Turner [Thu, 6 Sep 2018 16:34:56 +0000 (16:34 +0000)]
Fix a warning.

llvm-svn: 341561

5 years agoReverting r 341390 because it is causing test failures on GreenDragon.
A Bergen [Thu, 6 Sep 2018 16:29:40 +0000 (16:29 +0000)]
Reverting r 341390 because it is causing test failures on GreenDragon.

http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental/52810/

llvm-svn: 341560

5 years ago[InstCombine] add xor+not folds
Sanjay Patel [Thu, 6 Sep 2018 16:23:40 +0000 (16:23 +0000)]
[InstCombine] add xor+not folds

This fold is needed to avoid a regression when we try
to recommit rL300977.
We can't see the most basic win currently because
demanded bits changes the patterns:
https://rise4fun.com/Alive/plpp

llvm-svn: 341559

5 years agoARM64: improve non-zero memset isel by ~2x
JF Bastien [Thu, 6 Sep 2018 16:03:32 +0000 (16:03 +0000)]
ARM64: improve non-zero memset isel by ~2x

Summary:
I added a few ARM64 memset codegen tests in r341406 and r341493, and annotated
where the generated code was bad. This patch fixes the majority of the issues by
requesting that a 2xi64 vector be used for memset of 32 bytes and above.

The patch leaves the former request for f128 unchanged, despite f128
materialization being suboptimal: doing otherwise runs into other asserts in
isel and makes this patch too broad.

This patch hides the issue that was present in bzero_40_stack and bzero_72_stack
because the code now generates in a better order which doesn't have the store
offset issue. I'm not aware of that issue appearing elsewhere at the moment.

<rdar://problem/44157755>

Reviewers: t.p.northover, MatzeB, javed.absar

Subscribers: eraman, kristof.beyls, chrib, dexonsmith, llvm-commits

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

llvm-svn: 341558

5 years ago[InstCombine] add tests for xor-not; NFC
Sanjay Patel [Thu, 6 Sep 2018 15:35:01 +0000 (15:35 +0000)]
[InstCombine] add tests for xor-not; NFC

These tests demonstrate a missing fold that would
also be needed to avoid a regression when we try
to recommit rL300977.

llvm-svn: 341557

5 years agoRemove unnecessary semicolon to silence -Wpedantic warning. NFCI.
Simon Pilgrim [Thu, 6 Sep 2018 15:16:17 +0000 (15:16 +0000)]
Remove unnecessary semicolon to silence -Wpedantic warning. NFCI.

llvm-svn: 341556

5 years agoRemove unnecessary semicolon to silence -Wpedantic warning. NFCI.
Simon Pilgrim [Thu, 6 Sep 2018 15:15:28 +0000 (15:15 +0000)]
Remove unnecessary semicolon to silence -Wpedantic warning. NFCI.

llvm-svn: 341555

5 years ago[MSan] store origins for variadic function parameters in __msan_va_arg_origin_tls
Alexander Potapenko [Thu, 6 Sep 2018 15:14:36 +0000 (15:14 +0000)]
[MSan] store origins for variadic function parameters in __msan_va_arg_origin_tls

Add the __msan_va_arg_origin_tls TLS array to keep the origins for variadic function parameters.
Change the instrumentation pass to store parameter origins in this array.

This is a reland of r341528.

test/msan/vararg.cc doesn't work on Mips, PPC and AArch64 (because this
patch doesn't touch them), XFAIL these arches.
Also turned out Clang crashed on i80 vararg arguments because of
incorrect origin type returned by getOriginPtrForVAArgument() - fixed it
and added a test.

llvm-svn: 341554

5 years ago[OpenCL] Relax diagnostics on OpenCL access qualifiers
Andrew Savonichev [Thu, 6 Sep 2018 15:10:26 +0000 (15:10 +0000)]
[OpenCL] Relax diagnostics on OpenCL access qualifiers

Summary:
Emit warning for multiple access qualifiers if they do not conflict.

Patch by Alexey Bader

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Subscribers: asavonic, bader, cfe-commits

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

llvm-svn: 341553

5 years ago[clangd] Fix Dex initialization
Kirill Bobyrev [Thu, 6 Sep 2018 15:10:10 +0000 (15:10 +0000)]
[clangd] Fix Dex initialization

This patch sets URI schemes of Dex to SymbolCollector's default schemes
in case callers tried to pass empty list of schemes. This was the case
for initialization in Clangd main and was a reason of incorrect
behavior.

Also, it fixes a bug with missed `continue;` after spotting invalid URI
scheme conversion.

llvm-svn: 341552

5 years ago[libc++] Add a link to the Release notes from the main libc++ documentation
Louis Dionne [Thu, 6 Sep 2018 15:05:43 +0000 (15:05 +0000)]
[libc++] Add a link to the Release notes from the main libc++ documentation

llvm-svn: 341551

5 years ago[libcxx] Add ReleaseNotes.rst file for release notes
Louis Dionne [Thu, 6 Sep 2018 14:46:22 +0000 (14:46 +0000)]
[libcxx] Add ReleaseNotes.rst file for release notes

llvm-svn: 341550

5 years agoRevert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"
Sam McCall [Thu, 6 Sep 2018 14:27:40 +0000 (14:27 +0000)]
Revert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"

This reverts commit r341519, which generates debug info that causes
backend crashes. (with -split-dwarf-file)

Details in https://reviews.llvm.org/D50495

llvm-svn: 341549

5 years agoFix march triple used test from rL341475
Diogo N. Sampaio [Thu, 6 Sep 2018 14:13:10 +0000 (14:13 +0000)]
Fix march triple used test from rL341475

Change the march triple of test files, possible fixing
test failures due rL341475

llvm-svn: 341548

5 years agoFix the -print-multi-directory flag to print the selected multilib.
Christian Bruel [Thu, 6 Sep 2018 14:03:44 +0000 (14:03 +0000)]
Fix the -print-multi-directory flag to print the selected multilib.

Summary: Fix -print-multi-directory to print the selected multilib

Reviewers: jroelofs

Reviewed By: jroelofs

Subscribers: jroelofs, timshen, thakis, srhines, cfe-commits

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

llvm-svn: 341547

5 years ago[RISCV][NFC] Rework test/MC/RISCV/rv{32,64}* to allow testing of symbol operands
Alex Bradbury [Thu, 6 Sep 2018 13:41:04 +0000 (13:41 +0000)]
[RISCV][NFC] Rework test/MC/RISCV/rv{32,64}* to allow testing of symbol operands

Standardise on check lines:
* CHECK-ASM
* CHECK-OBJ
* CHECK-ASM-AND-OBJ

This allows for the addition of tests involving symbol operands, which will
not result in identical instructions in both assembly and disassembled object
output.

This commit doesn't exploit this reworking to increase test coverage of symbol
operands - that will come in a future patch.

llvm-svn: 341546

5 years ago[InstCombine] fix formatting in SimplifyDemandedVectorElts->Select; NFCI
Sanjay Patel [Thu, 6 Sep 2018 13:19:22 +0000 (13:19 +0000)]
[InstCombine] fix formatting in SimplifyDemandedVectorElts->Select; NFCI

I'm preparing to add the same functionality both here and to the DAG
version of this code in D51696 / D51433, so try to make those cases
as similar as possible to avoid bugs.

llvm-svn: 341545

5 years ago[clangd] NFC: Use TopN instead of std::priority_queue
Kirill Bobyrev [Thu, 6 Sep 2018 13:15:03 +0000 (13:15 +0000)]
[clangd] NFC: Use TopN instead of std::priority_queue

Quality.cpp defines a structure for convenient storage of Top N items,
it should be used instead of the `std::priority_queue` with slightly
obscure semantics.

This patch does not affect functionality.

Reviewed By: sammccall

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

llvm-svn: 341544

5 years ago[clangd] NFC: mark single-parameter constructors explicit
Kirill Bobyrev [Thu, 6 Sep 2018 13:06:04 +0000 (13:06 +0000)]
[clangd] NFC: mark single-parameter constructors explicit

Code health: prevent implicit conversions to user-defined types.

Reviewed By: sammccall

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

llvm-svn: 341543

5 years ago[clangd] Implement proximity path boosting for Dex
Kirill Bobyrev [Thu, 6 Sep 2018 12:54:43 +0000 (12:54 +0000)]
[clangd] Implement proximity path boosting for Dex

This patch introduces `PathURI` Search Token kind and utilizes it to
uprank symbols which are defined in files with small distance to the
directory where the fuzzy find request is coming from (e.g. files user
is editing).

Reviewed By: ioeric

Reviewers: ioeric, sammccall

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

llvm-svn: 341542

5 years ago[MSan] revert r341528 to unbreak the bots
Alexander Potapenko [Thu, 6 Sep 2018 12:19:27 +0000 (12:19 +0000)]
[MSan] revert r341528 to unbreak the bots

llvm-svn: 341541

5 years agoARM: wrap call to __clzsi2 so that the name is correct on MachO.
Tim Northover [Thu, 6 Sep 2018 12:13:46 +0000 (12:13 +0000)]
ARM: wrap call to __clzsi2 so that the name is correct on MachO.

MachO symbols are prefixed with an extra '_' (that's 3 in total for this
function), so assembly calls have to go through a wrapper to insert any prefix
needed.

llvm-svn: 341540

5 years ago[OpenCL] Disallow negative attribute arguments
Andrew Savonichev [Thu, 6 Sep 2018 11:54:09 +0000 (11:54 +0000)]
[OpenCL] Disallow negative attribute arguments

Summary:
Negative arguments in kernel attributes are silently bitcast'ed to
unsigned, for example:

    __attribute__((reqd_work_group_size(1, -1, 1)))
    __kernel void k() {}

is a complete equivalent of:

    __attribute__((reqd_work_group_size(1, 4294967294, 1)))
    __kernel void k() {}

This is likely an error, so the patch forbids negative arguments in
several OpenCL attributes. Users who really want 4294967294 can still
use it as an unsigned representation.

Reviewers: Anastasia, yaxunl, bader

Reviewed By: Anastasia, yaxunl, bader

Subscribers: bader, cfe-commits

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

llvm-svn: 341539

5 years ago[clangd] Fix data race in async fuzzyFind tests.
Ilya Biryukov [Thu, 6 Sep 2018 11:04:56 +0000 (11:04 +0000)]
[clangd] Fix data race in async fuzzyFind tests.

llvm-svn: 341538

5 years ago[LoopInterchange] Cleanup unused variables.
Florian Hahn [Thu, 6 Sep 2018 10:41:01 +0000 (10:41 +0000)]
[LoopInterchange] Cleanup unused variables.

llvm-svn: 341537

5 years agoFix argument type in MachineInstr::hasPropertyInBundle
Sven van Haastregt [Thu, 6 Sep 2018 10:25:59 +0000 (10:25 +0000)]
Fix argument type in MachineInstr::hasPropertyInBundle

The MCID::Flag enumeration now has more than 32 items, this means that
the hasPropertyBundle argument 'Mask' can overflow.

This patch changes the argument to be 64 bits instead.

Patch by Mikael Nilsson.

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

llvm-svn: 341536

5 years agoReland [ClangUserExpression][NFC] Removed unused code
Raphael Isemann [Thu, 6 Sep 2018 10:24:11 +0000 (10:24 +0000)]
Reland [ClangUserExpression][NFC] Removed unused code

The GetLanguageForExpr has side effects, so we can't remove this
call without breaking the completion mechanism. However, we can
keep the change that gets rid of this unnecessary variable.

llvm-svn: 341535

5 years ago[clangd] Set SymbolID for sema macros so that they can be merged with index macros.
Eric Liu [Thu, 6 Sep 2018 09:59:37 +0000 (09:59 +0000)]
[clangd] Set SymbolID for sema macros so that they can be merged with index macros.

Reviewers: sammccall

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

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

llvm-svn: 341534

5 years ago[LoopInterchange] Move preheader creation to transform stage and simplify.
Florian Hahn [Thu, 6 Sep 2018 09:57:27 +0000 (09:57 +0000)]
[LoopInterchange] Move preheader creation to transform stage and simplify.

There is no need to create preheaders in the analysis stage, we only
need them when adjusting the branches. Also, the only cases we need to
create our own preheaders is when they have more than 1 predecessors or
PHI nodes (even with only 1 predecessor, we could have an LCSSA phi
node). I have simplified the conditions and added some assertions to be
sure. Because we know the inner and outer loop need to be tightly
nested, it is sufficient to check if the inner loop preheader is the
outer loop header to check if we need to create a new preheader.

Reviewers: efriedma, mcrosier, karthikthecool

Reviewed By: efriedma

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

llvm-svn: 341533

5 years agoRevert "[ClangUserExpression][NFC] Removed unused code"
Raphael Isemann [Thu, 6 Sep 2018 09:42:44 +0000 (09:42 +0000)]
Revert "[ClangUserExpression][NFC] Removed unused code"

GetLanguageForExpr has side effects, so this actually breaks
the completion. Should fix TestExprCompletion.

llvm-svn: 341532

5 years ago[NFC] Simplify inner structure of InstructionPrecedenceTracking
Max Kazantsev [Thu, 6 Sep 2018 09:29:42 +0000 (09:29 +0000)]
[NFC] Simplify inner structure of InstructionPrecedenceTracking

Currently it has a set KnownBlocks that marks blocks as having cached
answers and a map FirstSpecialInsts that maps these blocks to first
special instructions in them. The value in the map is always non-null,
and for blocks that are known to have no special instructions the map
does not have an instance.

This patch removes KnownBlocks as obsolete. Instead, for blocks that
are known to have no special instructions, we just put a nullptr value.
This makes the code much easier to read.

llvm-svn: 341531

5 years ago[MSan] store origins for variadic function parameters in __msan_va_arg_origin_tls
Alexander Potapenko [Thu, 6 Sep 2018 08:50:11 +0000 (08:50 +0000)]
[MSan] store origins for variadic function parameters in __msan_va_arg_origin_tls

Add the __msan_va_arg_origin_tls TLS array to keep the origins for
variadic function parameters.
Change the instrumentation pass to store parameter origins in this array.

llvm-svn: 341528

5 years ago[SLC] Add an alignment to CreateGlobalString
David Green [Thu, 6 Sep 2018 08:42:17 +0000 (08:42 +0000)]
[SLC] Add an alignment to CreateGlobalString

Previously the alignment on the newly created global strings was not set,
meaning that DataLayout::getPreferredAlignment was free to overalign it
to 16 bytes. This caused unnecessary code bloat with the padding between
variables.

The main example of this happening was the printf->puts optimisation in
SimplifyLibCalls, but as the change here is made in
IRBuilderBase::CreateGlobalString, other globals using this will now be
aligned too.

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

llvm-svn: 341527

5 years agoReturn "[NFC] Add severe validation of InstructionPrecedenceTracking"
Max Kazantsev [Thu, 6 Sep 2018 08:33:02 +0000 (08:33 +0000)]
Return "[NFC] Add severe validation of InstructionPrecedenceTracking"

This validation patch has been reverted as rL341147 because of conserns raised by
@reames. This revision returns it as is to raise a discussion and address the concerns.

Differential Revision: https://reviews.llvm.org/D51523
Reviewed By: reames

llvm-svn: 341526

5 years ago[MSan] Make sure variadic function arguments do not overflow __msan_va_arg_tls
Alexander Potapenko [Thu, 6 Sep 2018 08:21:54 +0000 (08:21 +0000)]
[MSan] Make sure variadic function arguments do not overflow __msan_va_arg_tls

Turns out that calling a variadic function with too many (e.g. >100 i64's)
arguments overflows __msan_va_arg_tls, which leads to smashing other TLS
data with function argument shadow values.

getShadow() already checks for kParamTLSSize and returns clean shadow if
the argument does not fit, so just skip storing argument shadow for such
arguments.

llvm-svn: 341525

5 years ago[DebugInfo] Generate debug information for labels. (Fix PR37395)
Hsiangkai Wang [Thu, 6 Sep 2018 06:03:36 +0000 (06:03 +0000)]
[DebugInfo] Generate debug information for labels. (Fix PR37395)

Generate DILabel metadata and call llvm.dbg.label after label
statement to associate the metadata with the label.

After fixing PR37395.
After fixing problems in LiveDebugVariables.

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

llvm-svn: 341519