platform/upstream/llvm.git
5 years agoAMDGPU: Fix crashes in invalid call cases
Matt Arsenault [Thu, 28 Feb 2019 00:28:44 +0000 (00:28 +0000)]
AMDGPU: Fix crashes in invalid call cases

We have to at least tolerate calls to kernels, possibly with a
mismatched calling convention on the callsite.

llvm-svn: 355049

5 years agoGlobalISel: Implement fewerElementsVector for phi
Matt Arsenault [Thu, 28 Feb 2019 00:16:32 +0000 (00:16 +0000)]
GlobalISel: Implement fewerElementsVector for phi

llvm-svn: 355048

5 years agoGlobalISel: Implement moreElementsVector for phi
Matt Arsenault [Thu, 28 Feb 2019 00:01:05 +0000 (00:01 +0000)]
GlobalISel: Implement moreElementsVector for phi

llvm-svn: 355047

5 years ago[Sanitizer] Attempt to fix linker error on ARM variants
Julian Lettner [Wed, 27 Feb 2019 23:47:00 +0000 (23:47 +0000)]
[Sanitizer] Attempt to fix linker error on ARM variants

Previous commit:
https://github.com/llvm/llvm-project/commit/a0884da62a471f08c65a03e337aea23203a43eb8

llvm-svn: 355046

5 years ago[compiler-rt] Windows Trace Logging for error reports.
Matthew G McGovern [Wed, 27 Feb 2019 23:43:50 +0000 (23:43 +0000)]
[compiler-rt] Windows Trace Logging for error reports.

Adds option for collecting sanitixer dumps via trace logging.
    - Set log_to_syslog=1 to enable this output.
    - Consult https://aka.ms/windowstracelogging for details on use.

llvm-svn: 355045

5 years ago[InstrProf] Use separate comdat group for data and counters
Reid Kleckner [Wed, 27 Feb 2019 23:38:44 +0000 (23:38 +0000)]
[InstrProf] Use separate comdat group for data and counters

Summary:
I hadn't realized that instrumentation runs before inlining, so we can't
use the function as the comdat group. Doing so can create relocations
against discarded sections when references to discarded __profc_
variables are inlined into functions outside the function's comdat
group.

In the future, perhaps we should consider standardizing the comdat group
names that ELF and COFF use. It will save object file size, since
__profv_$sym won't appear in the symbol table again.

Reviewers: xur, vsk

Subscribers: eraman, hiraditya, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

llvm-svn: 355044

5 years ago[NFC][libc++] Update comment about oldest supported macosx for back-deployment
Louis Dionne [Wed, 27 Feb 2019 23:36:22 +0000 (23:36 +0000)]
[NFC][libc++] Update comment about oldest supported macosx for back-deployment

llvm-svn: 355043

5 years agoRemove unnecessary demangling operation (NFC)
Adrian Prantl [Wed, 27 Feb 2019 22:54:47 +0000 (22:54 +0000)]
Remove unnecessary demangling operation (NFC)

This extra call to the demangler doesn't affect the performance of C++
because the result is being cached anyway; but I'm working on a patch
to the Swift branch that uses extra contextual information to provide
a more accurate demangling result. In that case this call would be
extra and unnecessary work.

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

llvm-svn: 355042

5 years ago[sanitizer] Fix compilation errors in r355030.
Evgeniy Stepanov [Wed, 27 Feb 2019 22:23:51 +0000 (22:23 +0000)]
[sanitizer] Fix compilation errors in r355030.

Disable hwasan interceptor on non-linux, non-x86-or-arm platforms.
Add @plt to the asm call that clang intergrated-as infers but gcc does
not.

llvm-svn: 355041

5 years ago[MemorySSA] Make insertDef insert corresponding phi nodes.
Alina Sbirlea [Wed, 27 Feb 2019 22:20:22 +0000 (22:20 +0000)]
[MemorySSA] Make insertDef insert corresponding phi nodes.

Summary:
The original assumption for the insertDef method was that it would not
materialize Defs out of no-where, hence it will not insert phis needed
after inserting a Def.

However, when cloning an instruction (use case used in LICM), we do
materialize Defs "out of no-where". If the block receiving a Def has at
least one other Def, then no processing is needed. If the block just
received its first Def, we must check where Phi placement is needed.
The only new usage of insertDef is in LICM, hence the trigger for the bug.

But the original goal of the method also fails to apply for the move()
method. If we move a Def from the entry point of a diamond to either the
left or right blocks, then the merge block must add a phi.
While this usecase does not currently occur, or may be viewed as an
incorrect transformation, MSSA must behave corectly given the scenario.

Resolves PR40749 and PR40754.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 355040

5 years ago[NFC][Sanitizer] Pull up GetStackTrace into sanitizer_common
Julian Lettner [Wed, 27 Feb 2019 22:16:02 +0000 (22:16 +0000)]
[NFC][Sanitizer] Pull up GetStackTrace into sanitizer_common

We already independently declare GetStackTrace in all (except TSan)
sanitizer runtime headers. Lets move it to sanitizer_stacktrace.h to
have one canonical way to fill in a BufferedStackFrame. Also enables us
to use it in sanitizer_common itself.

This patch defines GetStackTrace for TSan and moves the function from
ubsan_diag.cc to ubsan_diag_standalone.cc to avoid duplicate symbols
for the UBSan-ASan runtime.

Other than that this patch just moves the code out of headers and into
the correct namespace.

Reviewers: vitalybuka

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

llvm-svn: 355039

5 years agoDefault to Secure PLT on PPC for NetBSD and OpenBSD.
Joerg Sonnenberger [Wed, 27 Feb 2019 21:53:14 +0000 (21:53 +0000)]
Default to Secure PLT on PPC for NetBSD and OpenBSD.
This matches the default settings of clang.

llvm-svn: 355038

5 years agoRemove dependency from Host -> Core.
Zachary Turner [Wed, 27 Feb 2019 21:53:08 +0000 (21:53 +0000)]
Remove dependency from Host -> Core.

I wasn't actually trying to eliminate this one, but looks like
it happened as a side effect of moving Symbols out of Host.

llvm-svn: 355037

5 years ago[clang][index-while-building][NFC] FileIndexRecord - Comments, replace auto with...
Jan Korous [Wed, 27 Feb 2019 21:48:02 +0000 (21:48 +0000)]
[clang][index-while-building][NFC] FileIndexRecord - Comments, replace auto with type

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

llvm-svn: 355036

5 years ago[clang][index-while-building] FileIndexRecord
Jan Korous [Wed, 27 Feb 2019 21:47:40 +0000 (21:47 +0000)]
[clang][index-while-building] FileIndexRecord

Basic data structures for index

Tests are missing from this patch - will be covered properly by tests for the whole feature.
I'm just trying to split into smaller patches to make it easier for reviewers.

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

llvm-svn: 355035

5 years agoFixup compilation/test failures after r354960 and r355013.
James Y Knight [Wed, 27 Feb 2019 21:47:35 +0000 (21:47 +0000)]
Fixup compilation/test failures after r354960 and r355013.

llvm-svn: 355034

5 years agoUse Secure PLT as default on NetBSD/PowerPC.
Joerg Sonnenberger [Wed, 27 Feb 2019 21:46:01 +0000 (21:46 +0000)]
Use Secure PLT as default on NetBSD/PowerPC.

llvm-svn: 355033

5 years agoMove Host/Symbols.cpp to Symbols/LocateSymbolFile.cpp
Zachary Turner [Wed, 27 Feb 2019 21:42:10 +0000 (21:42 +0000)]
Move Host/Symbols.cpp to Symbols/LocateSymbolFile.cpp

Given that we have a target named Symbols, one wonders why a
file named Symbols.cpp is not in this target.  To be clear,
the functions exposed from this file are really focused on
*locating* a symbol file on a given host, which is where the
ambiguity comes in.  However, it makes more sense conceptually
to be in the Symbols target. While some of the specific places
to search for symbol files might change depending on the Host,
this is not inherently true in the same way that, for example,
"accessing the file system" or "starting threads" is
fundamentally dependent on the Host.

PDBs, for example, recently became a reality on non-Windows platforms,
and it's theoretically possible that DSYMs could become a thing on non
MacOSX platforms (maybe in a remote debugging scenario). Other types of
symbol files, such as DWO, DWP, etc have never been tied to any Host
platform anyway.

After this patch, there is only one remaining dependency from
Host to Target.

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

llvm-svn: 355032

5 years ago[llvm-cxxfilt] Re-enable split and demangle stdin input on certain non-alphanumerics.
Matt Davis [Wed, 27 Feb 2019 21:39:11 +0000 (21:39 +0000)]
[llvm-cxxfilt] Re-enable split and demangle stdin input on certain non-alphanumerics.

This restores the patch that splits demangled stdin input on
non-alphanumerics.  I had reverted this patch earlier because it broke
Windows build-bots.  I have updated the test so that it passes on
Windows.

I was running the test from powershell and never saw the issue until I
switched to the mingw shell.

This reverts commit 628ab5c6820bdf3bb5a8e494b0fd9e7312ce7150.

llvm-svn: 355031

5 years ago[hwasan, asan] Intercept vfork.
Evgeniy Stepanov [Wed, 27 Feb 2019 21:11:50 +0000 (21:11 +0000)]
[hwasan, asan] Intercept vfork.

Summary:
Intercept vfork on arm, aarch64, i386 and x86_64.

Reviewers: pcc, vitalybuka

Subscribers: kubamracek, mgorny, javed.absar, krytarowski, kristof.beyls, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 355030

5 years ago[LLD][COFF] Support /threads[:no] like the ELF driver
Alexandre Ganea [Wed, 27 Feb 2019 20:53:50 +0000 (20:53 +0000)]
[LLD][COFF] Support /threads[:no] like the ELF driver

Differential review: https://reviews.llvm.org/D58594

llvm-svn: 355029

5 years ago[hwasan] Fix tests after .cc->.cpp renaming.
Evgeniy Stepanov [Wed, 27 Feb 2019 20:50:35 +0000 (20:50 +0000)]
[hwasan] Fix tests after .cc->.cpp renaming.

llvm-svn: 355028

5 years ago[OPENMP]Delay emission of the error for unsupported types.
Alexey Bataev [Wed, 27 Feb 2019 20:29:45 +0000 (20:29 +0000)]
[OPENMP]Delay emission of the error for unsupported types.

If the type is unsupported on the device side, it still must be emitted,
but we should emit errors for operations with such types.

llvm-svn: 355027

5 years agoPass arguments correctly to the objc object checker on arm64
Jim Ingham [Wed, 27 Feb 2019 20:27:25 +0000 (20:27 +0000)]
Pass arguments correctly to the objc object checker on arm64

Traditionally objc had two entry points, objc_msgSend for scalar
return methods, and objc_msgSend_stret for struct return convention
methods.  But on arm64 the second was not needed (since arm64 doesn't
use an argument register for the struct return pointer) so it was removed.

The code that dispatches to the objc object checker when it sees some
flavor of objc_msgSend was not aware of this change so was sending the
wrong arguments to the checker.

<rdar://problem/48315890>

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

llvm-svn: 355026

5 years agoSeperate volatility and atomicity/ordering in SelectionDAG
Philip Reames [Wed, 27 Feb 2019 20:20:08 +0000 (20:20 +0000)]
Seperate volatility and atomicity/ordering in SelectionDAG

At the moment, we mark every atomic memory access as being also volatile. This is unnecessarily conservative and prohibits many legal transforms (DCE, folding, etc..).

This patch removes MOVolatile from the MachineMemOperands of atomic, but not volatile, instructions. This should be strictly NFC after a series of previous patches which have gone in to ensure backend code is conservative about handling of isAtomic MMOs. Once it's in and baked for a bit, we'll start working through removing unnecessary bailouts one by one. We applied this same strategy to the middle end a few years ago, with good success.

To make sure this patch itself is NFC, it is build on top of a series of other patches which adjust code to (for the moment) be as conservative for an atomic access as for a volatile access and build up a test corpus (mostly in test/CodeGen/X86/atomics-unordered.ll)..

Previously landed

    D57593 Fix a bug in the definition of isUnordered on MachineMemOperand
    D57596 [CodeGen] Be conservative about atomic accesses as for volatile
    D57802 Be conservative about unordered accesses for the moment
    rL353959: [Tests] First batch of cornercase tests for unordered atomics.
    rL353966: [Tests] RMW folding tests w/unordered atomic operations.
    rL353972: [Tests] More unordered atomic lowering tests.
    rL353989: [SelectionDAG] Inline a single use helper function, and remove last non-MMO interface
    rL354740: [Hexagon, SystemZ] Be super conservative about atomics
    rL354800: [Lanai] Be super conservative about atomics
    rL354845: [ARM] Be super conservative about atomics

Attention Out of Tree Backend Owners: This patch may break you. If it does, you can use the TLI getMMOFlags hook to restore the MOVolatile to any instruction you need to. (See llvm-dev thread titled "PSA: Changes to how atomics are handled in backends" started Feb 27, 2019.)

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

llvm-svn: 355025

5 years ago[clang-tidy] Add the abseil-time-subtraction check
Hyrum Wright [Wed, 27 Feb 2019 20:08:50 +0000 (20:08 +0000)]
[clang-tidy] Add the abseil-time-subtraction check

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

llvm-svn: 355024

5 years agoFixed ubsan failures in r355005.
Rong Xu [Wed, 27 Feb 2019 20:01:14 +0000 (20:01 +0000)]
Fixed ubsan failures in r355005.

llvm-svn: 355023

5 years ago[NFC][Sanitizer] Hard-code fast/slow unwinder at call site
Julian Lettner [Wed, 27 Feb 2019 20:01:04 +0000 (20:01 +0000)]
[NFC][Sanitizer] Hard-code fast/slow unwinder at call site

Also assert that the caller always gets what it requested.

This purely mechanical change simplifies future refactorings and
eventual removal of BufferedStackTrace::Unwind.

Reviewers: vitalybuka

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

llvm-svn: 355022

5 years agoRevert "[llvm-cxxfilt] Split and demangle stdin input on certain non-alphanumerics."
Matt Davis [Wed, 27 Feb 2019 19:52:02 +0000 (19:52 +0000)]
Revert "[llvm-cxxfilt] Split and demangle stdin input on certain non-alphanumerics."

This reverts commit 5cd5f8f2563395f8767f94604eb4c4bea8dcbea0.
The test passes on linux, but fails on the windows build-bots.

This test failure seems to be a quoting issue between my test and
FileCheck on Windows.  I'm reverting this patch until I can replicate
and fix in my Windows environment.

llvm-svn: 355021

5 years ago[InstCombine] add tests for add+ext+add; NFC
Sanjay Patel [Wed, 27 Feb 2019 19:27:45 +0000 (19:27 +0000)]
[InstCombine] add tests for add+ext+add; NFC

llvm-svn: 355020

5 years ago[libFuzzer][Windows] Port fork mode to Windows
Jonathan Metzman [Wed, 27 Feb 2019 19:27:16 +0000 (19:27 +0000)]
[libFuzzer][Windows] Port fork mode to Windows

Summary:
Port libFuzzer's fork mode to Windows.
Implement Windows versions of MkDir, RmDir, and IterateDirRecursive to do this.
Don't print error messages under new normal uses of FileSize (on a non-existent file).
Implement portable way of piping output to /dev/null.
Fix test for Windows and comment fork-sigusr.test on why it won't be ported to Win.

Reviewers: zturner

Reviewed By: zturner

Subscribers: kcc, zturner, jdoerfert, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 355019

5 years ago[Darwin][NFC] Refactor throttling of 64bit sanitizer tests on Darwin
Julian Lettner [Wed, 27 Feb 2019 19:06:20 +0000 (19:06 +0000)]
[Darwin][NFC] Refactor throttling of 64bit sanitizer tests on Darwin

Underlying condition for throttling is "has large mmap'd regions" (i.e.,
shadow memory) and not sanitizers in general (e.g., UBSan does not need
to be throttled).

Rename parallelism group `darwin-64bit-sanitizer` to `shadow-memory` and
apply it unconditionally to all tests which require it. We can then have
all the Darwin throttling logic in one place in the commen lit config.

Throttle sanitizer_common unit tests. Configuration was previously
missing from sanitizer_common/Unit/lit.site.cfg.

Reviewed by: kubamracek

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

llvm-svn: 355018

5 years agoAdd triples to the test I committed in r355012 to fix windows bots.
Akira Hatanaka [Wed, 27 Feb 2019 18:59:52 +0000 (18:59 +0000)]
Add triples to the test I committed in r355012 to fix windows bots.

llvm-svn: 355017

5 years ago[X86][AVX] Pull out some INSERT_SUBVECTOR combines into a combineConcatVectorOps...
Simon Pilgrim [Wed, 27 Feb 2019 18:46:32 +0000 (18:46 +0000)]
[X86][AVX] Pull out some INSERT_SUBVECTOR combines into a combineConcatVectorOps helper. NFCI

A lot of the INSERT_SUBVECTOR combines can be more generally handled as if they have come from a CONCAT_VECTORS node.

I've been investigating adding a CONCAT_VECTORS combine to X86, but this is a much easier first step that avoids the issue of handling a number of pre-legalization issues that I've encountered.

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

llvm-svn: 355015

5 years ago[llvm-readobj] Print section type values for unknown sections.
Matt Davis [Wed, 27 Feb 2019 18:39:17 +0000 (18:39 +0000)]
[llvm-readobj] Print section type values for unknown sections.

Summary:
This patch displays a hexadecimal section value (Elf_Shdr::sh_type) or section-relative offset when printing unknown sections.

Here is a subset of the output (ignoring the fields following "Type" when dumping an ELF's GNU `--section-headers` table).
Section Headers:
```
  [Nr] Name              Type
  [16] android_rel       LOOS+0x1
  [17] android_rela      LOOS+0x2
  [27] unknown           0x1000: <unknown>
  [28] loos              LOOS+0
  [30] hios              VERSYM
  [31] loproc            LOPROC+0
  [33] hiproc            LOPROC+0xFFFFFFF
  [34] louser            LOUSER+0
  [36] hiuser            LOUSER+0x7FFFFFFF
```

As a comparison, the previous output looked something like the above, but with a blank "Type" field:
```
  [Nr] Name              Type
  [27] unknown
  [28] loos
  [30] hios              VERSYM
  [31] loproc
  [33] hiproc
  [34] louser
  [36] hiuser
```

This fixes PR40773

Reviewers: jhenderson, rupprecht, Bigcheese

Reviewed By: jhenderson, rupprecht, Bigcheese

Subscribers: MaskRay, Bigcheese, srhines, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 355014

5 years ago Attempt to fix buildbot after r354972 [#1]. NFCI.
Alexey Lapshin [Wed, 27 Feb 2019 18:36:46 +0000 (18:36 +0000)]
Attempt to fix buildbot after r354972 [#1]. NFCI.

llvm-svn: 355013

5 years agoAvoid needlessly copying a block to the heap when a block literal
Akira Hatanaka [Wed, 27 Feb 2019 18:17:16 +0000 (18:17 +0000)]
Avoid needlessly copying a block to the heap when a block literal
initializes a local auto variable or is assigned to a local auto
variable that is declared in the scope that introduced the block
literal.

rdar://problem/13289333

https://reviews.llvm.org/D58514

llvm-svn: 355012

5 years ago[llvm-cxxfilt] Re-enable the delimiters test on Windows.
Matt Davis [Wed, 27 Feb 2019 18:04:21 +0000 (18:04 +0000)]
[llvm-cxxfilt] Re-enable the delimiters test on Windows.

The original intent was to enable this test for Windows; however, that
initial patch broke one of the build-bots.  I temporarily disabled this
test on Windows until that issue was resolved.  It was resolved in my
previous patch (cfd1d9742ee2d1b8dd6b7), and now I am re-enabling this
test.

llvm-svn: 355011

5 years ago[libc++] Add is_nothrow_convertible from P0758R1
Louis Dionne [Wed, 27 Feb 2019 17:57:38 +0000 (17:57 +0000)]
[libc++] Add is_nothrow_convertible from P0758R1

Reviewed as https://reviews.llvm.org/D58019.
Thanks to Zoe Carver for the patch.

llvm-svn: 355010

5 years ago[Reproducer] Make 'reproducer generate' a NOOP during replay.
Jonas Devlieghere [Wed, 27 Feb 2019 17:47:06 +0000 (17:47 +0000)]
[Reproducer] Make 'reproducer generate' a NOOP during replay.

Instead of filtering out the 'reproducer generate' command during
replay, just make the operation a NOOP.

llvm-svn: 355009

5 years agoSupport framework import/include auto-completion
David Goldman [Wed, 27 Feb 2019 17:40:33 +0000 (17:40 +0000)]
Support framework import/include auto-completion

Frameworks filesystem representations:
  UIKit.framework/Headers/%header%

Framework import format:
  #import <UIKit/%header%>

Thus the completion code must map the input format of <UIKit/> to
the path of UIKit.framework/Headers as well as strip the
".framework" suffix when auto-completing the framework name.

llvm-svn: 355008

5 years agoClean up the delimiters test.
Matt Davis [Wed, 27 Feb 2019 17:39:36 +0000 (17:39 +0000)]
Clean up the delimiters test.

Ideally this is a NFCI, used single quotes in most cases.  Hopefully
this will make the Windows bot happy.

I've marked this unsupported on windows, until I get my windows box
setup with this patch to test.  I'll remove that constraint after I'm
confident this will pass on windows.  I just want to silence the
buildbots for now.

llvm-svn: 355007

5 years ago[libc++] Remove visibility-related warnings with Clang 8
Louis Dionne [Wed, 27 Feb 2019 17:33:25 +0000 (17:33 +0000)]
[libc++] Remove visibility-related warnings with Clang 8

The attributes were placed incorrectly -- they need to be after the
"struct" keyword, not before.

llvm-svn: 355006

5 years agoRecommit r354930 "[PGO] Context sensitive PGO (part 1)"
Rong Xu [Wed, 27 Feb 2019 17:24:33 +0000 (17:24 +0000)]
Recommit r354930 "[PGO] Context sensitive PGO (part 1)"

Fixed UBSan failures.

llvm-svn: 355005

5 years ago[llvm-readobj]Add additional testing for various ELF features
James Henderson [Wed, 27 Feb 2019 16:41:59 +0000 (16:41 +0000)]
[llvm-readobj]Add additional testing for various ELF features

This patch adds testing of areas of the code that are not fully tested,
in particular dynamic table printing, ELF type printing, handling of
edge cases where things are missing/empty (relocations/program header
tables/section header table), and the --string-dump switch.

Reviewed by: grimar, higuoxing, rupprecht

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

llvm-svn: 355003

5 years ago[Reproducers] Add more logging to reproducer instrumentation
Jonas Devlieghere [Wed, 27 Feb 2019 16:40:08 +0000 (16:40 +0000)]
[Reproducers] Add more logging to reproducer instrumentation

Debugging issues with instrumentation capture and replay can be
particularly tricky, especially because part of the process takes places
even before the debugger is initialized. This patch adds more logging
capabilities to these classes, hidden behind a macro define.

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

llvm-svn: 355002

5 years ago[llvm-objdump] Should print strings when dumping DT_RPATH, DT_RUNPATH, DT_SONAME...
Xing GUO [Wed, 27 Feb 2019 16:37:15 +0000 (16:37 +0000)]
[llvm-objdump] Should print strings when dumping DT_RPATH, DT_RUNPATH, DT_SONAME, DT_AUXILIARY and DT_FILTER tags in dynamic section.

Summary:
Before:
```
Dynamic Section:
  NEEDED               libpthread.so.0
  ...
  NEEDED               ld-linux-x86-64.so.2
  RPATH                0x00000000001c2e61
```

After:
```
Dynamic Section:
  NEEDED               libpthread.so.0
  ...
  NEEDED               ld-linux-x86-64.so.2
  RPATH                $ORIGIN/../lib
```

Only a small problem here, I have no idea on choosing test case. I see there's a test
file(test/tools/llvm-objdump/private-headers-dynamic-section.test). But it has no DT_RPATH and DT_RUNPATH tags. Shall I replace the ELF file in the
Inputs dir by a new one?

Reviewers: jhenderson, grimar

Reviewed By: jhenderson

Subscribers: srhines, rupprecht, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 355001

5 years ago[ASTImporter] Improve import of FileID.
Balazs Keri [Wed, 27 Feb 2019 16:31:48 +0000 (16:31 +0000)]
[ASTImporter] Improve import of FileID.

Summary:
Even if the content cache has a directory and filename, it may be a virtual file.
The old code returned with error in this case, but it is worth to try to handle
the file as it were a memory buffer.

Reviewers: a.sidorin, shafik, martong, a_sidorin

Reviewed By: shafik

Subscribers: efriedma, rnkovacs, cfe-commits, dkrupp, martong, Szelethus, gamesh411

Tags: #clang

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

llvm-svn: 355000

5 years ago[scudo][standalone] Add a standalone vector class
Kostya Kortchinsky [Wed, 27 Feb 2019 16:30:05 +0000 (16:30 +0000)]
[scudo][standalone] Add a standalone vector class

Summary:
This CL adds a standalone vector class that will be used by the scoped
strings when they land. We reimplement our own vector class because we
can't use the std library one.

It's mostly borrowed from the current sanitizer_common one, with LLVM
code style changes.

Additionnally a casing change in a function name that slipped through
the previous review (the function isn't used yet).

Reviewers: vitalybuka, eugenis, flowerhack, dmmoore415, mcgrathr, morehouse

Reviewed By: vitalybuka

Subscribers: mgorny, delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 354999

5 years ago[llvm-cxxfilt] Split and demangle stdin input on certain non-alphanumerics.
Matt Davis [Wed, 27 Feb 2019 16:29:50 +0000 (16:29 +0000)]
[llvm-cxxfilt] Split and demangle stdin input on certain non-alphanumerics.

Summary:
This patch attempts to replicate GNU c++-filt behavior when splitting stdin input for demangling.

Previously, cxx-filt would split input only on spaces.  Each delimited item is then demangled.
From what I have tested, GNU c++filt also splits input on any character that does not make
up the mangled name (notably commas, but also a large set of non-alphanumeric characters).

This patch splits stdin input on any character that does not belong to the Itanium mangling
format (since Itanium is currently the only supported format in llvm-cxxfilt).

This is an update to PR39990

Reviewers: jhenderson, tejohnson, compnerd

Reviewed By: compnerd

Subscribers: erik.pilkington, llvm-commits

Tags: #llvm

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

llvm-svn: 354998

5 years ago[InstCombine] Add additional add.sat overflow tests; NFC
Nikita Popov [Wed, 27 Feb 2019 16:18:29 +0000 (16:18 +0000)]
[InstCombine] Add additional add.sat overflow tests; NFC

Baseline for D58593.

llvm-svn: 354996

5 years agoI changed a 'enable_if<...>::type to' 'enable_if_t<...>' but forgot to remove the...
Marshall Clow [Wed, 27 Feb 2019 16:09:35 +0000 (16:09 +0000)]
I changed a 'enable_if<...>::type to' 'enable_if_t<...>' but forgot to remove the preceding 'typename'

llvm-svn: 354995

5 years agoAdded documentation for clangd v9+ features
Dmitri Gribenko [Wed, 27 Feb 2019 16:08:04 +0000 (16:08 +0000)]
Added documentation for clangd v9+ features

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 354994

5 years ago[InstCombine] regenerate complete checks; NFC
Sanjay Patel [Wed, 27 Feb 2019 15:59:30 +0000 (15:59 +0000)]
[InstCombine] regenerate complete checks; NFC

llvm-svn: 354993

5 years agoAdded more detailed documentation for clangd
Dmitri Gribenko [Wed, 27 Feb 2019 15:53:05 +0000 (15:53 +0000)]
Added more detailed documentation for clangd

Summary:
The text was written mostly by Sam McCall, screenshots are mostly made
by me.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 354992

5 years agogn build: Merge r354989
Nico Weber [Wed, 27 Feb 2019 15:46:51 +0000 (15:46 +0000)]
gn build: Merge r354989

llvm-svn: 354991

5 years ago[NFC] minor revision of r354929 [CUDA][HIP] Check calling convention based on functio...
Yaxun Liu [Wed, 27 Feb 2019 15:46:29 +0000 (15:46 +0000)]
[NFC] minor revision of r354929 [CUDA][HIP] Check calling convention based on function target

Add comments and move a variable to if block.

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

llvm-svn: 354990

5 years agohwasan: Rename source files from cc to cpp
Nico Weber [Wed, 27 Feb 2019 15:44:03 +0000 (15:44 +0000)]
hwasan: Rename source files from cc to cpp

As discussed elsewhere: LLVM uses cpp as its C++ source extension; the
sanitizers should too. This updates files in hwasan.

Patch generated by

    for f in lib/hwasan/*.cc ; do svn mv $f ${f%.cc}.cpp; done

followed by

    for f in lib/hwasan/*.cpp ; do sed -i '' -e '1s/\.cc -/.cpp /' $f; done

CMakeLists.txt updated manually.

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

llvm-svn: 354989

5 years agoImplment the last part of P1024: tuple-like interface to span. Reviewed as https...
Marshall Clow [Wed, 27 Feb 2019 15:41:37 +0000 (15:41 +0000)]
Implment the last part of P1024: tuple-like interface to span. Reviewed as https://reviews.llvm.org/D58706.

llvm-svn: 354988

5 years agogn build: Merge r354692
Nico Weber [Wed, 27 Feb 2019 15:29:14 +0000 (15:29 +0000)]
gn build: Merge r354692

llvm-svn: 354987

5 years ago[DebugInfo] Apply subprogram attributes on behalf of owner CU
Eugene Leviant [Wed, 27 Feb 2019 14:46:59 +0000 (14:46 +0000)]
[DebugInfo] Apply subprogram attributes on behalf of owner CU

When using full LTO it is possible that template function definition DIE
is bound to one compilation unit and it's declaration to another. We should
add function declaration attributes on behalf of its owner CU otherwise
we may end up with malformed file identifier in function declaration
DW_AT_decl_file attribute.

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

llvm-svn: 354978

5 years agoRemove XFAIL-Linux from two asan tests
Pavel Labath [Wed, 27 Feb 2019 14:26:48 +0000 (14:26 +0000)]
Remove XFAIL-Linux from two asan tests

It turns out these tests actually succeed, if one has a clang with
address sanitizer support enabled (i.e., has enabled the compiler-rt
project). I guess none of the linux lldb devs have done that until now.

llvm-svn: 354976

5 years agoInsert blocks of python code with swig instead of modify-python-lldb.py
Pavel Labath [Wed, 27 Feb 2019 14:16:48 +0000 (14:16 +0000)]
Insert blocks of python code with swig instead of modify-python-lldb.py

Summary:
Swig is perfectly capable of inserting blocks of python code into its
output (and we use those fascilities already), so there's no need for
this to be done in a post-process step.

lldb_iter is a general-purpose utility used from many classes, so I add
it to the main swig file. The other two blocks are tied to a specific
class, so I add it to the interface file of that class.

Reviewers: zturner, jingham, serge-sans-paille

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 354975

5 years ago[AMDGPU][MC] Added register size check for VOP3/SDWA/DPP operands
Dmitry Preobrazhensky [Wed, 27 Feb 2019 13:58:48 +0000 (13:58 +0000)]
[AMDGPU][MC] Added register size check for VOP3/SDWA/DPP operands

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

Reviewers: artem.tamazov, arsenm, rampitec

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

llvm-svn: 354974

5 years ago[DebugInfo] add SectionedAddress to DebugInfo interfaces.
Alexey Lapshin [Wed, 27 Feb 2019 13:17:36 +0000 (13:17 +0000)]
[DebugInfo] add SectionedAddress to DebugInfo interfaces.

      That patch is the fix for https://bugs.llvm.org/show_bug.cgi?id=40703
   "wrong line number info for obj file compiled with -ffunction-sections"
   bug. The problem happened with only .o files. If object file contains
   several .text sections then line number information showed incorrectly.
   The reason for this is that DwarfLineTable could not detect section which
   corresponds to specified address(because address is the local to the
   section). And as the result it could not select proper sequence in the
   line table. The fix is to pass SectionIndex with the address. So that it
   would be possible to differentiate addresses from various sections. With
   this fix llvm-objdump shows correct line numbers for disassembled code.

   Differential review: https://reviews.llvm.org/D58194

llvm-svn: 354972

5 years ago[AMDGPU][MC][GFX8+] Added syntactic sugar for 'vgpr index' operand of instructions...
Dmitry Preobrazhensky [Wed, 27 Feb 2019 13:12:12 +0000 (13:12 +0000)]
[AMDGPU][MC][GFX8+] Added syntactic sugar for 'vgpr index' operand of instructions s_set_gpr_idx_on and s_set_gpr_idx_mode

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

Reviewers: artem.tamazov, arsenm

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

llvm-svn: 354969

5 years agoAttrDocs.td: fix broken bullet-point indentation
Hans Wennborg [Wed, 27 Feb 2019 13:11:37 +0000 (13:11 +0000)]
AttrDocs.td: fix broken bullet-point indentation

llvm-svn: 354968

5 years ago[clangd] Improve global code completion when scope specifier is unresolved.
Eric Liu [Wed, 27 Feb 2019 11:42:37 +0000 (11:42 +0000)]
[clangd] Improve global code completion when scope specifier is unresolved.

Summary:
Suppose `clangd::` is unresolved in the following example. Currently,
we simply use "clangd::" as the query scope. We can do better by combining with
accessible scopes in the context. The query scopes can be `{clangd::, clang::clangd::}`.
```
namespace clang { clangd::^ }

```

Reviewers: ilya-biryukov, sammccall, hokein, kadircet

Reviewed By: kadircet

Subscribers: MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 354963

5 years ago[llvm-objcopy] - Check for invalidated relocations when removing a section.
George Rimar [Wed, 27 Feb 2019 11:18:27 +0000 (11:18 +0000)]
[llvm-objcopy] - Check for invalidated relocations when removing a section.

This is https://bugs.llvm.org/show_bug.cgi?id=40818

Removing a section that is used by relocation is an error
we did not report. The patch fixes that.

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

llvm-svn: 354962

5 years ago[X86][AVX] Only combine loads to broadcasts for legal types
Simon Pilgrim [Wed, 27 Feb 2019 11:17:25 +0000 (11:17 +0000)]
[X86][AVX] Only combine loads to broadcasts for legal types

Thanks to @echristo for spotting this.

llvm-svn: 354961

5 years ago[llvm-readobj]Fix error messages for bad archive members and add testing for archive...
James Henderson [Wed, 27 Feb 2019 11:07:08 +0000 (11:07 +0000)]
[llvm-readobj]Fix error messages for bad archive members and add testing for archive handling

llvm-readobj's error messages were broken for bad archive members. This
patch fixes them, and also adds testing for archive and thin archive
handling within llvm-readobj.

Reviewed by: rupprecht, grimar, higuoxing

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

llvm-svn: 354960

5 years ago[LLD][ELF] - Improve "sh_addralign is not a power of 2" diagnostics.
George Rimar [Wed, 27 Feb 2019 10:28:23 +0000 (10:28 +0000)]
[LLD][ELF] - Improve "sh_addralign is not a power of 2" diagnostics.

This patch removes the precompiled binary from inputs,
replacing it with a YAML. And teaches LLD to report a
section name in case of such error.

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

llvm-svn: 354959

5 years agoFix Wenum-compare gcc7 warning. NFCI.
Simon Pilgrim [Wed, 27 Feb 2019 10:19:53 +0000 (10:19 +0000)]
Fix Wenum-compare gcc7 warning. NFCI.

llvm-svn: 354958

5 years ago[clangd] Set thread priority on Windows
Ilya Biryukov [Wed, 27 Feb 2019 10:16:03 +0000 (10:16 +0000)]
[clangd] Set thread priority on Windows

Reviewers: kadircet, gribozavr

Reviewed By: kadircet, gribozavr

Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 354957

5 years ago[llvm-readobj] Print DF_1_DISPRELPND
Fangrui Song [Wed, 27 Feb 2019 05:37:11 +0000 (05:37 +0000)]
[llvm-readobj] Print DF_1_DISPRELPND

The test will be added by D58677.

llvm-svn: 354955

5 years ago[BPF] Don't fail for static variables
Yonghong Song [Wed, 27 Feb 2019 05:36:15 +0000 (05:36 +0000)]
[BPF] Don't fail for static variables

Currently, the LLVM will print an error like
  Unsupported relocation: try to compile with -O2 or above,
  or check your static variable usage
if user defines more than one static variables in a single
ELF section (e.g., .bss or .data).

There is ongoing effort to support static and global
variables in libbpf and kernel. This patch removed the
assertion so user programs with static variables won't
fail compilation.

The static variable in-section offset is written to
the "imm" field of the corresponding to-be-relocated
bpf instruction. Below is an example to show how the
application (e.g., libbpf) can relate variable to relocations.

  -bash-4.4$ cat g1.c
  static volatile long a = 2;
  static volatile int b = 3;
  int test() { return a + b; }
  -bash-4.4$ clang -target bpf -O2 -c g1.c
  -bash-4.4$ llvm-readelf -r g1.o

  Relocation section '.rel.text' at offset 0x158 contains 2 entries:
      Offset             Info             Type               Symbol's Value  Symbol's Name
  0000000000000000  0000000400000001 R_BPF_64_64            0000000000000000 .data
  0000000000000018  0000000400000001 R_BPF_64_64            0000000000000000 .data
  -bash-4.4$ llvm-readelf -s g1.o

  Symbol table '.symtab' contains 6 entries:
     Num:    Value          Size Type    Bind   Vis      Ndx Name
       0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
       1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS g1.c
       2: 0000000000000000     8 OBJECT  LOCAL  DEFAULT    4 a
       3: 0000000000000008     4 OBJECT  LOCAL  DEFAULT    4 b
       4: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
       5: 0000000000000000    64 FUNC    GLOBAL DEFAULT    2 test
  -bash-4.4$ llvm-objdump -d g1.o

  g1.o:   file format ELF64-BPF

  Disassembly of section .text:
  0000000000000000 test:
       0:       18 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00         r1 = 0 ll
       2:       79 11 00 00 00 00 00 00         r1 = *(u64 *)(r1 + 0)
       3:       18 02 00 00 08 00 00 00 00 00 00 00 00 00 00 00         r2 = 8 ll
       5:       61 20 00 00 00 00 00 00         r0 = *(u32 *)(r2 + 0)
       6:       0f 10 00 00 00 00 00 00         r0 += r1
       7:       95 00 00 00 00 00 00 00         exit
  -bash-4.4$

  . from symbol table, static variable "a" is in section #4, offset 0.
  . from symbol table, static variable "b" is in section #4, offset 8.
  . the first relocation is against symbol #4:
    4: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
    and in-section offset 0 (see llvm-objdump result)
  . the second relocation is against symbol #4:
    4: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
    and in-section offset 8 (see llvm-objdump result)
  . therefore, the first relocation is for variable "a", and
    the second relocation is for variable "b".

Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 354954

5 years agoRevert "[PGO] Context sensitive PGO (part 1)"
Vlad Tsyrklevich [Wed, 27 Feb 2019 03:45:28 +0000 (03:45 +0000)]
Revert "[PGO] Context sensitive PGO (part 1)"

This reverts commit r354930, it was causing UBSan failures.

llvm-svn: 354953

5 years agoIn the review of D58642, Louis asked: 'Is there a reason for making this inline?...
Marshall Clow [Wed, 27 Feb 2019 03:25:43 +0000 (03:25 +0000)]
In the review of D58642, Louis asked: 'Is there a reason for making this inline? Templates are already inline by default'.  I told him that I didn't want to change the one call (ssize) that I was adding, but would come back later and clean them all (data/empty/begin/end/cbegin/cend/rbegin/rend/crbegin/crend/size/ssize) up later. Now it is later. Remove the unnecessary 'inline' modifiers from all these calls.

llvm-svn: 354952

5 years agoSupport: enable backtraces on Windows
Saleem Abdulrasool [Wed, 27 Feb 2019 03:21:50 +0000 (03:21 +0000)]
Support: enable backtraces on Windows

Some platforms, e.g. Windows, support backtraces but don't have
BACKTRACE. Checking for BACKTRACE prevents Windows from having
backtraces.

Patch by Jason Mittertreiner!

llvm-svn: 354951

5 years agoImplement the second part of P1227R2 - Signed ssize() functions. Reviewed as https...
Marshall Clow [Wed, 27 Feb 2019 02:58:56 +0000 (02:58 +0000)]
Implement the second part of P1227R2 - Signed ssize() functions. Reviewed as https://reviews.llvm.org/D58642

llvm-svn: 354950

5 years ago[clangd] Library dependencies in XPC
Jan Korous [Wed, 27 Feb 2019 02:37:44 +0000 (02:37 +0000)]
[clangd] Library dependencies in XPC

Patch by Nicholas Allegra

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

llvm-svn: 354949

5 years ago[HIP] change kernel stub name
Yaxun Liu [Wed, 27 Feb 2019 02:02:52 +0000 (02:02 +0000)]
[HIP] change kernel stub name

Add .stub to kernel stub function name so that it is different from kernel
name in device code. This is necessary to let debugger find correct symbol
for kernel.

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

llvm-svn: 354948

5 years ago[NFC][Sanitizer] Add TODO comments
Julian Lettner [Wed, 27 Feb 2019 01:38:54 +0000 (01:38 +0000)]
[NFC][Sanitizer] Add TODO comments

llvm-svn: 354947

5 years ago[index] Fixup for r354942. Specify target in test to achieve stable mangling.
Volodymyr Sapsai [Wed, 27 Feb 2019 01:37:43 +0000 (01:37 +0000)]
[index] Fixup for r354942. Specify target in test to achieve stable mangling.

llvm-svn: 354946

5 years ago[WebAssembly] Fix ScopeTops info in CFGStackify for EH pads
Heejin Ahn [Wed, 27 Feb 2019 01:35:14 +0000 (01:35 +0000)]
[WebAssembly] Fix ScopeTops info in CFGStackify for EH pads

Summary:
When creating `ScopeTops` info for `try` ~ `catch` ~ `end_try`, we
should create not only `end_try` -> `try` mapping but also `catch` ->
`try` mapping as well. If this is not created, `block` and `end_block`
markers later added may span across an existing `catch`, resulting in
the incorrect code like:
```
try
  block     --|  (X)
catch         |
  end_block --|
end_try
```

Reviewers: dschuff

Subscribers: sunfish, sbc100, jgravelle-google, llvm-commits

Tags: #llvm

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

llvm-svn: 354945

5 years agoFix an ambiguity in the tests that gcc-tot complained about.
Marshall Clow [Wed, 27 Feb 2019 01:29:52 +0000 (01:29 +0000)]
Fix an ambiguity in the tests that gcc-tot complained about.

llvm-svn: 354944

5 years ago[libc++] Add a test for PR14074
Louis Dionne [Wed, 27 Feb 2019 01:29:09 +0000 (01:29 +0000)]
[libc++] Add a test for PR14074

PR14074 was fixed in r165884, but no tests were added.

llvm-svn: 354943

5 years ago[index] Improve indexing support for MSPropertyDecl.
Volodymyr Sapsai [Wed, 27 Feb 2019 01:04:53 +0000 (01:04 +0000)]
[index] Improve indexing support for MSPropertyDecl.

Currently the symbol for MSPropertyDecl has kind `SymbolKind::Unknown`
which can trip up various indexing tools.

rdar://problem/46764224

Reviewers: akyrtzi, benlangmuir, jkorous

Reviewed By: jkorous

Subscribers: dexonsmith, cfe-commits, jkorous, jdoerfert, arphaman

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

llvm-svn: 354942

5 years ago[DWARFFormValue] Cleanup DWARFFormValue interface. (NFC)
Jonas Devlieghere [Wed, 27 Feb 2019 00:58:09 +0000 (00:58 +0000)]
[DWARFFormValue] Cleanup DWARFFormValue interface. (NFC)

DWARFFormValues can be created from a data extractor or by passing its
value directly. Until now this was done by member functions that
modified an existing object's internal state. This patch replaces a
subset of these methods with static method that return a new
DWARFFormValue.

llvm-svn: 354941

5 years ago[libc++] Mark several tests as XFAIL on macosx10.7
Louis Dionne [Wed, 27 Feb 2019 00:57:57 +0000 (00:57 +0000)]
[libc++] Mark several tests as XFAIL on macosx10.7

Those tests fail when linking against a new dylib but running against
macosx10.7. I believe this is caused by a duplicate definition of the
RTTI for exception classes in libc++.dylib and libc++abi.dylib, but
this matter still needs some investigation.

This issue was not caught previously because all the tests always linked
against the same dylib used for running (because LIT made it impossible
to do otherwise before r349171).

rdar://problem/46809586

llvm-svn: 354940

5 years ago[WebAssembly] Remove unnecessary instructions after TRY marker placement
Heejin Ahn [Wed, 27 Feb 2019 00:50:53 +0000 (00:50 +0000)]
[WebAssembly] Remove unnecessary instructions after TRY marker placement

Summary:
This removes unnecessary instructions after TRY marker placement. There
are two cases:
- `end`/`end_block` can be removed if they overlap with `try`/`end_try`
  and they have the same return types.
- `br` right before `catch` that branches to after `end_try` can be
  deleted.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

Tags: #llvm

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

llvm-svn: 354939

5 years ago[Utility] Fix ArchSpec.MergeFrom to correctly merge environments
Alex Langford [Wed, 27 Feb 2019 00:47:39 +0000 (00:47 +0000)]
[Utility] Fix ArchSpec.MergeFrom to correctly merge environments

Summary:
This behavior was originally added in rL252264 (git commit 76a7f365da)
in order to be extra careful with handling platforms like watchos and tvos.
However, as far as triples go, those two (and others) are treated as OSes and
not environments, so that should not really apply here.

Additionally, this behavior is incorrect and can lead to incorrect ArchSpecs.
Because android is specified as an environment and not an OS, not propogating
the environment can lead to modules and targets being misidentified.

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

llvm-svn: 354938

5 years agoFix inline assembler constraint validation
Joerg Sonnenberger [Wed, 27 Feb 2019 00:40:59 +0000 (00:40 +0000)]
Fix inline assembler constraint validation

The current constraint logic is both too lax and too strict. It fails
for input outside the [INT_MIN..INT_MAX] range, but it also implicitly
accepts 0 as value when it should not. Adjust logic to handle both
correctly.

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

llvm-svn: 354937

5 years agoFirst part of P1227R2 - change span over to use 'size_t' instead of 'ptrdiff_t'....
Marshall Clow [Wed, 27 Feb 2019 00:32:16 +0000 (00:32 +0000)]
First part of P1227R2 - change span over to use 'size_t' instead of 'ptrdiff_t'. Reviewed as https://reviews.llvm.org/D58639.

llvm-svn: 354936

5 years ago[SystemZ] Pass regalloc hints to help Load-and-Test transformations.
Jonas Paulsson [Wed, 27 Feb 2019 00:18:28 +0000 (00:18 +0000)]
[SystemZ]  Pass regalloc hints to help Load-and-Test transformations.

Since there is no "Load-and-Test-High" instruction, the 32 bit load of a
register to be compared with 0 can only be implemented with LT if the virtual
GRX32 register ends up in a low part (GR32 register).

This patch detects these cases and passes the GR32 registers (low parts) as
(soft) hints in getRegAllocationHints().

Review: Ulrich Weigand.
llvm-svn: 354935

5 years agovim: `swiftself` is an attribute
Saleem Abdulrasool [Wed, 27 Feb 2019 00:12:11 +0000 (00:12 +0000)]
vim: `swiftself` is an attribute

Highlight the `swiftself` attribute on parameters.

llvm-svn: 354934

5 years ago[Utility] Remove Triple{Environment,OS,Vendor}IsUnspecifiedUnknown from ArchSpec
Alex Langford [Tue, 26 Feb 2019 23:50:19 +0000 (23:50 +0000)]
[Utility] Remove Triple{Environment,OS,Vendor}IsUnspecifiedUnknown from ArchSpec

Summary:
These functions should always return the opposite of the
`Triple{Environment,OS,Vendor}WasSpecified` functions. Unspecified unknown is
the same as unspecified, which is why one set of functions should give us what
we want. It's possible to have specified unknown, which is why we can't just
rely on checking the enum values of vendor/os/environment. We must also ensure
that the names of these are empty and not "unknown".

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

llvm-svn: 354933

5 years ago[libc++] Add <filesystem> to the min-mac macro header test
Louis Dionne [Tue, 26 Feb 2019 23:14:58 +0000 (23:14 +0000)]
[libc++] Add <filesystem> to the min-mac macro header test

llvm-svn: 354932

5 years ago[HotColdSplit] Disable splitting for sanitized functions
Vedant Kumar [Tue, 26 Feb 2019 22:55:46 +0000 (22:55 +0000)]
[HotColdSplit] Disable splitting for sanitized functions

Splitting can make sanitizer errors harder to understand, as the
trapping instruction may not be in the function where the bug was
detected.

rdar://48142697

llvm-svn: 354931

5 years ago[PGO] Context sensitive PGO (part 1)
Rong Xu [Tue, 26 Feb 2019 22:37:46 +0000 (22:37 +0000)]
[PGO] Context sensitive PGO (part 1)

Current PGO profile counts are not context sensitive. The branch probabilities
for the inlined functions are kept the same for all call-sites, and they might
be very different from the actual branch probabilities. These suboptimal
profiles can greatly affect some downstream optimizations, in particular for
the machine basic block placement optimization.

In this patch, we propose to have a post-inline PGO instrumentation/use pass,
which we called Context Sensitive PGO (CSPGO). For the users who want the best
possible performance, they can perform a second round of PGO instrument/use on
the top of the regular PGO. They will have two sets of profile counts. The
first pass profile will be manly for inline, indirect-call promotion, and
CGSCC simplification pass optimizations. The second pass profile is for
post-inline optimizations and code-gen optimizations.

A typical usage:
// Regular PGO instrumentation and generate pass1 profile.
> clang -O2 -fprofile-generate source.c -o gen
> ./gen
> llvm-profdata merge default.*profraw -o pass1.profdata
// CSPGO instrumentation.
> clang -O2 -fprofile-use=pass1.profdata -fcs-profile-generate -o gen2
> ./gen2
// Merge two sets of profiles
> llvm-profdata merge default.*profraw pass1.profdata -o profile.profdata
// Use the combined profile. Pass manager will invoke two PGO use passes.
> clang -O2 -fprofile-use=profile.profdata -o use

This change touches many components in the compiler. The reviewed patch
(D54175) will committed in phrases.

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

llvm-svn: 354930