platform/upstream/llvm.git
6 years ago[InstCombine] add min/max tests with not ops; NFC
Sanjay Patel [Thu, 8 Mar 2018 18:34:23 +0000 (18:34 +0000)]
[InstCombine] add min/max tests with not ops; NFC

These are based on:
https://bugs.llvm.org/show_bug.cgi?id=35875
It's not clear if/how instcombine can reduce these,
but we should have the tests here either way to
document current behavior.

llvm-svn: 327039

6 years agoMore revert of r327031
Kuba Mracek [Thu, 8 Mar 2018 18:20:03 +0000 (18:20 +0000)]
More revert of r327031

llvm-svn: 327038

6 years ago[Hexagon] Ignore indexed loads when handling unaligned loads
Krzysztof Parzyszek [Thu, 8 Mar 2018 18:15:13 +0000 (18:15 +0000)]
[Hexagon] Ignore indexed loads when handling unaligned loads

llvm-svn: 327037

6 years ago[Tests] Remove empty test file that causes the test suite to fail
David Zarzycki [Thu, 8 Mar 2018 18:03:15 +0000 (18:03 +0000)]
[Tests] Remove empty test file that causes the test suite to fail

This empty file was "created" by r327033, which attempted to revert
r327029, which introduced the file.

llvm-svn: 327036

6 years agoExpose must/may alias info in MemorySSA.
Alina Sbirlea [Thu, 8 Mar 2018 18:03:14 +0000 (18:03 +0000)]
Expose must/may alias info in MemorySSA.

Summary:
Building MemorySSA gathers alias information for Defs/Uses.
Store and expose this information when optimizing uses (when building MemorySSA),
and when optimizing defs or updating uses (getClobberingMemoryAccess).
Current patch does not propagate alias information through MemoryPhis.

Reviewers: gbiv, dberlin

Subscribers: Prazek, sanjoy, llvm-commits

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

llvm-svn: 327035

6 years ago[AMDGPU] fix test to survive the most basic undef constant folding
Sanjay Patel [Thu, 8 Mar 2018 17:34:25 +0000 (17:34 +0000)]
[AMDGPU] fix test to survive the most basic undef constant folding

This will likely need to be changed again for anything more than:
fmul undef, undef -> undef

llvm-svn: 327034

6 years agoRevert r327029
Kuba Mracek [Thu, 8 Mar 2018 17:32:00 +0000 (17:32 +0000)]
Revert r327029

llvm-svn: 327033

6 years agoRevert r327031
Kuba Mracek [Thu, 8 Mar 2018 17:31:31 +0000 (17:31 +0000)]
Revert r327031

llvm-svn: 327032

6 years ago[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler...
Kuba Mracek [Thu, 8 Mar 2018 17:24:47 +0000 (17:24 +0000)]
[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler-rt part]

This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection.

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

llvm-svn: 327031

6 years ago[x86] fix test to be independent of FP undef
Sanjay Patel [Thu, 8 Mar 2018 17:24:30 +0000 (17:24 +0000)]
[x86] fix test to be independent of FP undef

llvm-svn: 327030

6 years ago[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [llvm part]
Kuba Mracek [Thu, 8 Mar 2018 17:24:06 +0000 (17:24 +0000)]
[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [llvm part]

This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection.

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

llvm-svn: 327029

6 years ago[StructurizeCFG] fix test to be independent of FP undef
Sanjay Patel [Thu, 8 Mar 2018 17:13:57 +0000 (17:13 +0000)]
[StructurizeCFG] fix test to be independent of FP undef

llvm-svn: 327028

6 years ago[llvm-mca] add override keyword to method ResourcePressureView::printView().
Andrea Di Biagio [Thu, 8 Mar 2018 17:02:28 +0000 (17:02 +0000)]
[llvm-mca] add override keyword to method ResourcePressureView::printView().
NFC.

llvm-svn: 327027

6 years ago[x86] regenerate checks; NFC
Sanjay Patel [Thu, 8 Mar 2018 16:56:49 +0000 (16:56 +0000)]
[x86] regenerate checks; NFC

This test will fail if we fix FP undef constant folding.

llvm-svn: 327026

6 years ago[llvm-mca] HWEventListener is a class, not struct.
Andrea Di Biagio [Thu, 8 Mar 2018 16:34:19 +0000 (16:34 +0000)]
[llvm-mca] HWEventListener is a class, not struct.

This should appease the buildbots.

llvm-svn: 327025

6 years agomerge-request.sh: Update 6.0 metabug for 6.0.1
Tom Stellard [Thu, 8 Mar 2018 16:29:08 +0000 (16:29 +0000)]
merge-request.sh: Update 6.0 metabug for 6.0.1

llvm-svn: 327024

6 years ago[clangd] Early return for #include goto definition.
Haojian Wu [Thu, 8 Mar 2018 16:28:12 +0000 (16:28 +0000)]
[clangd] Early return for #include goto definition.

Summary: This would save cost of walking over the AST, NFC.

Reviewers: ilya-biryukov

Subscribers: klimek, jkorous-apple, cfe-commits, ioeric

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

llvm-svn: 327023

6 years ago[StructurizeCFG] auto-generate full checks; NFC
Sanjay Patel [Thu, 8 Mar 2018 16:25:37 +0000 (16:25 +0000)]
[StructurizeCFG] auto-generate full checks; NFC

Not sure what the intent of this test is, but this will change when we fix FP undef constant folding.

llvm-svn: 327022

6 years ago[Power9] Add more missing instructions to the Power 9 scheduler
Stefan Pintilie [Thu, 8 Mar 2018 16:24:33 +0000 (16:24 +0000)]
[Power9] Add more missing instructions to the Power 9 scheduler

With this patch we should be able to mark the Power 9 model as complete.

llvm-svn: 327021

6 years agoAMDGPU/GlobalISel: Pass subtarget + TM to LegalizerInfo
Matt Arsenault [Thu, 8 Mar 2018 16:24:16 +0000 (16:24 +0000)]
AMDGPU/GlobalISel: Pass subtarget + TM to LegalizerInfo

These are the parameters x86 already uses.

llvm-svn: 327020

6 years ago[clangd] Bump vscode extension version to 0.0.5
Eric Liu [Thu, 8 Mar 2018 16:14:11 +0000 (16:14 +0000)]
[clangd] Bump vscode extension version to 0.0.5

llvm-svn: 327019

6 years ago[llvm-mca] Unify the API for the various views. NFCI
Andrea Di Biagio [Thu, 8 Mar 2018 16:08:43 +0000 (16:08 +0000)]
[llvm-mca] Unify the API for the various views. NFCI

This allows the customization of the performance report.

Users can specify their own custom sequence of views.
Each view contributes a portion of the performance report generated by the
BackendPrinter.

Internally, class BackendPrinter keeps a sequence of views; views are printed
out in sequence when method 'printReport()' is called.

This patch addresses one of the two review comments from Clement in D43951.

llvm-svn: 327018

6 years agoFix std unique pointer pretty-printer for new stl versions
Pavel Labath [Thu, 8 Mar 2018 16:03:09 +0000 (16:03 +0000)]
Fix std unique pointer pretty-printer for new stl versions

Summary: The unique pointer layout was changed in libstdc++ 6.0.23.

Reviewers: labath, clayborg

Reviewed By: labath, clayborg

Subscribers: luporl, lbianc, lldb-commits

Differential Revision: https://reviews.llvm.org/D44015
Patch by Alexandre Yukio Yamashita <alexandre.yamashita@eldorado.org.br>.

llvm-svn: 327017

6 years agoInstall lldb's SB headers (pr36630)
Pavel Labath [Thu, 8 Mar 2018 15:52:46 +0000 (15:52 +0000)]
Install lldb's SB headers (pr36630)

These were removed in r309021 in what looks like an accidentally
committed change. This brings them back.

I also rename the header component to lldb-headers (instead of
lldb_headers) to match the llvm style and add a special
install-lldb-headers target, which installs just the headers.

llvm-svn: 327016

6 years agoFix unused function warning in StatisticTest.cpp
Daniel Sanders [Thu, 8 Mar 2018 15:52:45 +0000 (15:52 +0000)]
Fix unused function warning in StatisticTest.cpp

llvm-svn: 327015

6 years ago[InstCombine] regenerate checks; NFC
Sanjay Patel [Thu, 8 Mar 2018 15:46:38 +0000 (15:46 +0000)]
[InstCombine] regenerate checks; NFC

We may not need any of these tests after rL327012, but leaving
them here for now until that's confirmed.

llvm-svn: 327014

6 years ago[LLDB][PPC64] Fix single step and LldbGdbServer tests
Pavel Labath [Thu, 8 Mar 2018 15:41:13 +0000 (15:41 +0000)]
[LLDB][PPC64] Fix single step and LldbGdbServer tests

Summary:
On PPC64, the tested functions were being entered through their local entry point, while the tests expected the program to stop at the function start address, that, for PPC64, corresponds to the global entry point.

To fix the issue, the test program was modified to call the functions to be tested through function pointers, which, on PPC64, force the calls through the global entry point, while not affecting the test on other platforms.

Reviewers: clayborg, labath

Reviewed By: labath

Subscribers: alexandreyy, lbianc

Differential Revision: https://reviews.llvm.org/D43768
Patch by Leandro Lupori <leandro.lupori@gmail.com>.

llvm-svn: 327013

6 years ago[InstSimplify] add more tests for FP undef; NFC
Sanjay Patel [Thu, 8 Mar 2018 15:39:39 +0000 (15:39 +0000)]
[InstSimplify] add more tests for FP undef; NFC

llvm-svn: 327012

6 years agoDWARFVerifier: Basic verification of .debug_names
Pavel Labath [Thu, 8 Mar 2018 15:34:42 +0000 (15:34 +0000)]
DWARFVerifier: Basic verification of .debug_names

Summary:
This patch adds basic .debug_names verification capabilities to the
DWARF verifier. Right now, it checks that the headers and abbreviation
tables of the individual name indexes can be parsed correctly, it
verifies the buckets table and the cross-checks the CU lists for
consistency. I intend to add further checks in follow-up patches.

Reviewers: JDevlieghere, aprantl, probinson, dblaikie

Subscribers: vleschuk, echristo, clayborg, llvm-commits

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

llvm-svn: 327011

6 years ago[llvm-mca] Emit the 'Instruction Info' table before the resource pressure view.
Andrea Di Biagio [Thu, 8 Mar 2018 15:34:38 +0000 (15:34 +0000)]
[llvm-mca] Emit the 'Instruction Info' table before the resource pressure view.

In future, both the summary information and the 'instruction info' table should
be moved into a separate "Summary" view.

llvm-svn: 327010

6 years ago[clangd:vscode] Resolve symlinks for file paths from clangd.
Eric Liu [Thu, 8 Mar 2018 15:28:42 +0000 (15:28 +0000)]
[clangd:vscode] Resolve symlinks for file paths from clangd.

Summary:
For features like go-to-definition, clangd can point clients to symlink paths
(e.g. in bazel execroot) which might not be desired if the symlink points to a
file in the workspace. Clangd might not be able to build the file, and users
might prefer to edit the file on the real path.

This change converts file paths from clangd to real path (e.g. resolving symlinks).
Long term, we might want to the symlink handling logic to clangd where clangd
can better decide whether symlinks should be resolved according to e.g. compile
commands.

Reviewers: sammccall

Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits

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

llvm-svn: 327009

6 years ago[OPENMP] Emit sizes/init ptrs etc. data for task reductions before
Alexey Bataev [Thu, 8 Mar 2018 15:24:08 +0000 (15:24 +0000)]
[OPENMP] Emit sizes/init ptrs etc. data for task reductions before
using.

We may emit the code in wrong order because of incorrect implementation
of the runtime functions for task reductions. Threadprivate storages may
be initialized after real initialization of the reduction items. Patch
fixes this problem.

llvm-svn: 327008

6 years ago[cmake] Append -Wl,-rpath-link conditionally to GNULD
Michal Gorny [Thu, 8 Mar 2018 15:09:38 +0000 (15:09 +0000)]
[cmake] Append -Wl,-rpath-link conditionally to GNULD

Append -Wl,-rpath-link conditionally to whether GNU ld.bfd is used
rather than the Linux+!gold conditionals. Also move it out of 'else'
branch of *BSD handling. This fixes build failures with ld.bfd
on Gentoo/FreeBSD, and should cause no harm on other systems using
ld.bfd.

This patch improves the original logic by reusing results of linker
detection introduced in r307852.

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

llvm-svn: 327007

6 years ago[ELF] - Fix crash relative to SHF_LINK_ORDER sections.
George Rimar [Thu, 8 Mar 2018 15:06:58 +0000 (15:06 +0000)]
[ELF] - Fix crash relative to SHF_LINK_ORDER sections.

Our code assumes all input sections in an output SHF_LINK_ORDER
section has SHF_LINK_ORDER flag. We do not check that and that can cause a crash.

That happens because we call
std::stable_sort(Sections.begin(), Sections.end(), compareByFilePosition);,
where compareByFilePosition predicate does not expect to see
null when calls getLinkOrderDep.

The same might happen when sections refer to non-regular sections.
Test cases demonstrate the issues, patch fixes them.

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

llvm-svn: 327006

6 years agoImplement LWG#2518 - Non-member swap for propagate_const should call member swap
Marshall Clow [Thu, 8 Mar 2018 15:01:50 +0000 (15:01 +0000)]
Implement LWG#2518 - Non-member swap for propagate_const should call member swap

llvm-svn: 327005

6 years ago[InstCombine, NewGVN] remove FP undef from tests
Sanjay Patel [Thu, 8 Mar 2018 14:57:08 +0000 (14:57 +0000)]
[InstCombine, NewGVN] remove FP undef from tests

I'm trying to preserve the intent of these tests by using
non-undef operands; if we fix FP undef folding these tests
will not pass.

llvm-svn: 327004

6 years ago[ELF] - Support "INSERT AFTER" statement.
George Rimar [Thu, 8 Mar 2018 14:54:38 +0000 (14:54 +0000)]
[ELF] - Support "INSERT AFTER" statement.

This implements INSERT AFTER in a following way:

During reading scripts it collects all insert statements.
After we done and read all files it inserts statements into script commands list.

With that:
* Rest of code does know nothing about INSERT.
* Approach is straightforward and have no visible limitations.
* It is also easy to support INSERT BEFORE (was seen in clang code once).
* Should work for PR35877 and similar cases.

Cons:
* It assumes we have "main" scripts that describes sections.

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

llvm-svn: 327003

6 years ago[CMake] Add missing test dependency
David Zarzycki [Thu, 8 Mar 2018 14:43:24 +0000 (14:43 +0000)]
[CMake] Add missing test dependency

This makes 'ninja clean ; ninja check-all' work again.

llvm-svn: 327002

6 years ago[COFF] Make the DOS stub a real DOS program
Hans Wennborg [Thu, 8 Mar 2018 14:27:28 +0000 (14:27 +0000)]
[COFF] Make the DOS stub a real DOS program

It only adds a few bytes and is nice for backward compatibility.

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

llvm-svn: 327001

6 years agoUse ellipsis ... to indicate omitted commands
Ed Maste [Thu, 8 Mar 2018 13:52:04 +0000 (13:52 +0000)]
Use ellipsis ... to indicate omitted commands

In an example like "clang -fxray-instrument .." the .. could be confused
with a literal .. (parent directory), which is used in commands like
"cmake -GNinja .."

llvm-svn: 327000

6 years agoAdd llvm-mca.rst to the table of contents in docs/CommandGuide.
Andrea Di Biagio [Thu, 8 Mar 2018 13:43:11 +0000 (13:43 +0000)]
Add llvm-mca.rst to the table of contents in docs/CommandGuide.

This should fix the documentation error reported by builder llvm-sphinx-docs
(build #16407) after r326998.

llvm-svn: 326999

6 years ago[llvm-mca] LLVM Machine Code Analyzer.
Andrea Di Biagio [Thu, 8 Mar 2018 13:05:02 +0000 (13:05 +0000)]
[llvm-mca] LLVM Machine Code Analyzer.

llvm-mca is an LLVM based performance analysis tool that can be used to
statically measure the performance of code, and to help triage potential
problems with target scheduling models.

llvm-mca uses information which is already available in LLVM (e.g. scheduling
models) to statically measure the performance of machine code in a specific cpu.
Performance is measured in terms of throughput as well as processor resource
consumption. The tool currently works for processors with an out-of-order
backend, for which there is a scheduling model available in LLVM.

The main goal of this tool is not just to predict the performance of the code
when run on the target, but also help with diagnosing potential performance
issues.

Given an assembly code sequence, llvm-mca estimates the IPC (instructions per
cycle), as well as hardware resources pressure. The analysis and reporting style
were mostly inspired by the IACA tool from Intel.

This patch is related to the RFC on llvm-dev visible at this link:
http://lists.llvm.org/pipermail/llvm-dev/2018-March/121490.html

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

llvm-svn: 326998

6 years ago[clang-format] Use NestedBlockIndent as a 0 column in formatted raw strings
Krasimir Georgiev [Thu, 8 Mar 2018 11:29:27 +0000 (11:29 +0000)]
[clang-format] Use NestedBlockIndent as a 0 column in formatted raw strings

Summary:
This makes the formatter of raw string literals use NestedBlockIndent for
determining the 0 column of the content inside. This makes the formatting use
less horizonal space and fixes a case where two newlines before and after the
raw string prefix were selected instead of a single newline after it:

Before:
```
aaaa = ffff(
    R"pb(
      key: value)pb");
```

After:
```
aaaa = ffff(R"pb(
    key: value)pb");
```

Reviewers: djasper, sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

llvm-svn: 326996

6 years ago[DWARF] Don't attempt to parse line tables at invalid offsets
James Henderson [Thu, 8 Mar 2018 10:53:34 +0000 (10:53 +0000)]
[DWARF] Don't attempt to parse line tables at invalid offsets

Whilst working on improvements to the error handling of the debug line
parsing code, I noticed that if an invalid offset were to be specified
in a call to getOrParseLineTable(), an entry in the LineTableMap would
still be created, even if the offset was not within the section range.
The immediate parsing attempt afterwards would fail (it would end up
getting a version of 0), and thereafter, any subsequent calls to
getOrParseLineTable or getLineTable would return the default-
constructed, invalid line table. In reality, we shouldn't even attempt
to parse this table, and we should always return a nullptr from these
two functions for this situation.

I have tested this via a unit test, which required some new framework
for unit testing debug line. My plan is to add quite a few more unit
tests for the new error reporting mechanism that will follow shortly,
hence the reason why the supporting code for the tests are written the
way they are - I intend to extend the DwarfGenerator class to support
generating debug line. At that point, I'll make sure that there are a
few positive test cases for this and the parsing code too.

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

Reviewers: JDevlieghere, aprantl
llvm-svn: 326995

6 years ago[dsymutil] Embed toolchain in dSYM bundle
Jonas Devlieghere [Thu, 8 Mar 2018 10:39:12 +0000 (10:39 +0000)]
[dsymutil] Embed toolchain in dSYM bundle

Allow us to embed the (Xcode) toolchain in the dSYM bundle's property
list.

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

llvm-svn: 326994

6 years ago[MCSchedule] Always generate processor resource names.
Andrea Di Biagio [Thu, 8 Mar 2018 10:38:45 +0000 (10:38 +0000)]
[MCSchedule] Always generate processor resource names.

With this patch, the tablegen 'SubtargetEmitter' always generates processor
resource names.
The impact of this patch on the code size of other llvm tools is small.  I have
observed an average increase of 0.03% in code size when doing a release build of
LLVM (on windows, using MSVC) with all the default backends.

This change is done in preparation for the upcoming llvm-mca patch.

llvm-svn: 326993

6 years ago[X86] Change X86::PMULDQ/PMULUDQ opcodes to take vXi64 type as input instead of vXi32.
Craig Topper [Thu, 8 Mar 2018 08:02:52 +0000 (08:02 +0000)]
[X86] Change X86::PMULDQ/PMULUDQ opcodes to take vXi64 type as input instead of vXi32.

This instruction can be thought of as reading either the even elements of a vXi32 input or the lower half of each element of a vXi64 input. We currently use the vXi32 interpretation, but vXi64 matches better with its broadcast behavior in EVEX.

I'm looking at moving MULDQ/MULUDQ creation to a DAG combine so we can do it when AVX512DQ is enabled without having to go through Custom lowering. But in some of the test cases we failed to use a broadcast load due to the size difference. This should help with that.

I'm also wondering if we can model these instructions in native IR and remove the intrinsics and I think using a vXi64 type will work better with that.

llvm-svn: 326991

6 years agoPropagate DLLAttr to friend re-declarations of member functions
Stephan Bergmann [Thu, 8 Mar 2018 07:34:40 +0000 (07:34 +0000)]
Propagate DLLAttr to friend re-declarations of member functions

...that have already been constructed (e.g., in inner classes) while parsing the
class definition.  They would otherwise lack any DLLAttr inherited from the
class, which are only set here (called from Sema::CheckCompletedClass) after the
class definition has been parsed completely.

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

llvm-svn: 326990

6 years ago[AMDGPU] Update AMDGOUUsage.rst descriptions
Tony Tye [Thu, 8 Mar 2018 05:46:01 +0000 (05:46 +0000)]
[AMDGPU] Update AMDGOUUsage.rst descriptions

- Improve description of XNACK ELF flag.
- Rename all uses of wave to wavefront to be consistent.

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

llvm-svn: 326989

6 years ago[CodeGen] Emit lifetime.ends in both EH and non-EH blocks
George Burgess IV [Thu, 8 Mar 2018 05:32:30 +0000 (05:32 +0000)]
[CodeGen] Emit lifetime.ends in both EH and non-EH blocks

Before this, we'd only emit lifetime.ends for these temps in
non-exceptional paths. This potentially made our stack larger than it
needed to be for any code that follows an EH cleanup. e.g. in

```
struct Foo { char cs[32]; };

void escape(void *);

struct Bar { ~Bar() { char cs[64]; escape(cs); } };

Foo getFoo();

void baz() {
  Bar b;
  getFoo();
}
```

baz() would require 96 bytes of stack, since the temporary from getFoo()
only had a lifetime.end on the non-exceptional path.

This also makes us keep hold of the Value* returned by
EmitLifetimeStart, so we don't have to remake it later.

llvm-svn: 326988

6 years agoBuild LLVMDemangle from build_symbolizer.sh
Eugene Zemtsov [Thu, 8 Mar 2018 04:34:22 +0000 (04:34 +0000)]
Build LLVMDemangle from build_symbolizer.sh

Symbolizer now depends on internal implementation of itaniumDemangle.

llvm-svn: 326987

6 years ago[WebAssembly] Add except_ref as a first-class type
Heejin Ahn [Thu, 8 Mar 2018 04:06:57 +0000 (04:06 +0000)]
[WebAssembly] Add except_ref as a first-class type

Summary:
Add except_ref as a first-class type, according to the [[https://github.com/WebAssembly/exception-handling/blob/master/proposals/Level-1.md | Level 1 exception handling proposal ]].
Companion to D43706.

Reviewers: sbc100

Subscribers: jfb, dschuff, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 326986

6 years ago[WebAssembly] Add except_ref as a first-class type
Heejin Ahn [Thu, 8 Mar 2018 04:05:37 +0000 (04:05 +0000)]
[WebAssembly] Add except_ref as a first-class type

Summary: Add except_ref as a first-class type, according to the [[https://github.com/WebAssembly/exception-handling/blob/master/proposals/Level-1.md | Level 1 exception handling proposal ]].

Reviewers: dschuff

Subscribers: jfb, sbc100, llvm-commits

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

llvm-svn: 326985

6 years ago[WebAssembly] Add IntrNoReturn property to throw/rethrow intrinsics
Heejin Ahn [Thu, 8 Mar 2018 03:47:52 +0000 (03:47 +0000)]
[WebAssembly] Add IntrNoReturn property to throw/rethrow intrinsics

Reviewers: dschuff

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

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

llvm-svn: 326984

6 years agoAdd Demangle lib into internalization list
Eugene Zemtsov [Thu, 8 Mar 2018 02:57:54 +0000 (02:57 +0000)]
Add Demangle lib into internalization list

Symbolizer now depends on internal implementation of itaniumDemangle.

llvm-svn: 326983

6 years ago[analyzer] Correctly model iteration through "nil" objects
George Karpenkov [Thu, 8 Mar 2018 02:53:39 +0000 (02:53 +0000)]
[analyzer] Correctly model iteration through "nil" objects

Previously, iteration through nil objects which resulted from
objc-messages being set to nil were modeled incorrectly.

There are a couple of notes about this patch:

In principle, ExprEngineObjC might be left untouched IFF osx.loops
checker is enabled.
I however think that we should not do something
completely incorrect depending on what checkers are left on.
We should evaluate and potentially remove altogether the isConsumedExpr
performance heuristic, as it seems very fragile.

rdar://22205149

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

llvm-svn: 326982

6 years agoSupport resetting STATISTIC() values using llvm::ResetStatistics()
Daniel Sanders [Thu, 8 Mar 2018 02:36:25 +0000 (02:36 +0000)]
Support resetting STATISTIC() values using llvm::ResetStatistics()

Summary:
Most of the time, compiler statistics can be obtained using a process that
performs a single compilation and terminates such as llc. However, this isn't
always the case. JITs for example, perform multiple compilations over their
lifetime and STATISTIC() will record cumulative values across all of them.

Provide tools like this with the facilities needed to measure individual
compilations by allowing them to reset the STATISTIC() values back to zero using
llvm::ResetStatistics(). It's still the tools responsibility to ensure that they
perform compilations in such a way that the results are meaningful to their
intended use.

Reviewers: qcolombet, rtereshin, bogner, aditya_nandakumar

Reviewed By: bogner

Subscribers: llvm-commits

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

llvm-svn: 326981

6 years agoFix an unused variable warning; NFC
George Burgess IV [Thu, 8 Mar 2018 02:15:12 +0000 (02:15 +0000)]
Fix an unused variable warning; NFC

llvm-svn: 326980

6 years ago[Documentation] Fix Release notes problems introduced in r326889. Add highlighting.
Eugene Zelenko [Thu, 8 Mar 2018 01:37:39 +0000 (01:37 +0000)]
[Documentation] Fix Release notes problems introduced in r326889. Add highlighting.

llvm-svn: 326979

6 years agoAdd attributes and fix some keywords in llvm-mode.el
Fangrui Song [Thu, 8 Mar 2018 01:28:45 +0000 (01:28 +0000)]
Add attributes and fix some keywords in llvm-mode.el

Reviewers: rafael, echristo

Reviewed By: echristo

Subscribers: llvm-commits

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

llvm-svn: 326978

6 years agoReturn early. NFC.
Rui Ueyama [Thu, 8 Mar 2018 01:22:30 +0000 (01:22 +0000)]
Return early. NFC.

We don't need to handle an object file having more than one symbol table,
so as soon as we find the first one, we can process it and then return
from the function.

llvm-svn: 326977

6 years ago[WebAssembly] Honor --allow-undefined even for explicit exports
Sam Clegg [Thu, 8 Mar 2018 01:16:05 +0000 (01:16 +0000)]
[WebAssembly] Honor --allow-undefined even for explicit exports

When a symbol is exported via --export=foo but --allow-undefined
is also specified, the symbol is now allowed to be undefined.
Previously we were special casing such symbols.

This combinations of behavior is exactly what emescripten
requires. Although we are trying hard not to allow emscripten
specific features in lld, this one makes sense.

Enforce this behavior by added this case to test/wasm/undefined.ll.

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

llvm-svn: 326976

6 years agoRevert "[LTO] Support filtering by hotness threshold"
Bob Haarman [Thu, 8 Mar 2018 01:13:10 +0000 (01:13 +0000)]
Revert "[LTO] Support filtering by hotness threshold"

This reverts commit 1f3bd185c53beb6aa68446974b7e80837abd6ef0 (r326107)
because it fails
ThinLTO/X86/diagnostic-handler-remarks-with-hotness.ll.

llvm-svn: 326975

6 years agoRevert "[Sema] Make getCurFunction() return null outside function parsing"
Reid Kleckner [Thu, 8 Mar 2018 01:12:22 +0000 (01:12 +0000)]
Revert "[Sema] Make getCurFunction() return null outside function parsing"

This reverts r326965. It seems to have caused repeating test failures in
clang/test/Sema/diagnose_if.c on some buildbots.

I cannot reproduce the problem, and it's not immediately obvious what
the problem is, so let's revert to green.

llvm-svn: 326974

6 years agoWhen substituting previously-checked template arguments into a template
Richard Smith [Thu, 8 Mar 2018 01:07:33 +0000 (01:07 +0000)]
When substituting previously-checked template arguments into a template
template parameter that is an expanded parameter pack, only substitute into the
current slice, not the entire pack.

This reduces the checking of N template template arguments for an expanded
parameter pack containing N parameters from quadratic time to linear time in
the length of the pack. This is important because one (and possibly the only?)
general technique for splitting a template parameter pack in linear time
depends on doing this.

llvm-svn: 326973

6 years agoSimplify LazyobjFile and readElfSymbols.
Rui Ueyama [Thu, 8 Mar 2018 01:05:58 +0000 (01:05 +0000)]
Simplify LazyobjFile and readElfSymbols.

addElfSymbols and readJustSymbolsFile still has duplicate code, but
I didn't come up with a good idea to eliminate them. Since this patch
is an improvement, I'm sending this for review.

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

llvm-svn: 326972

6 years ago[MS] Pass CVRU qualifiers properly in Itanium mangler
Reid Kleckner [Thu, 8 Mar 2018 00:55:09 +0000 (00:55 +0000)]
[MS] Pass CVRU qualifiers properly in Itanium mangler

We already have a mangling for the __unaligned qualifier, we just have
to call Qualifiers::getFromCVRUMask instead of getFromCVRMask.

PR36638

llvm-svn: 326971

6 years agoReland "[DebugInfo] Support DWARF expressions in eh_frame"
Rafael Auler [Thu, 8 Mar 2018 00:46:53 +0000 (00:46 +0000)]
Reland "[DebugInfo] Support DWARF expressions in eh_frame"

Summary:
Original change was D43313 (r326932) and reverted by r326953 because it
broke an LLD test and a windows build. The LLD test was already fixed in
lld commit r326944 (thanks maskray). This is the original change with
the windows build fixed.

llvm-svn: 326970

6 years ago[AArch64] Fix UB about shift amount exceeds data bit-width
Weiming Zhao [Thu, 8 Mar 2018 00:28:25 +0000 (00:28 +0000)]
[AArch64] Fix UB about shift amount exceeds data bit-width

Summary:
Fixes an UB caught by sanitizer. The shift amount might be larger than 32 so the operand should be 1ULL.
In this patch,  we replace the original expression with  existing API with uint64_t type.

Reviewers: eli.friedman, rengolin

Reviewed By: rengolin

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

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

llvm-svn: 326969

6 years agoFix a doc typo; NFC
George Burgess IV [Thu, 8 Mar 2018 00:22:04 +0000 (00:22 +0000)]
Fix a doc typo; NFC

llvm-svn: 326968

6 years ago[X86] Fix some isel patterns that used aligned vector load instructions with unaligne...
Craig Topper [Thu, 8 Mar 2018 00:21:17 +0000 (00:21 +0000)]
[X86] Fix some isel patterns that used aligned vector load instructions with unaligned predicates.

These patterns weren't checking the alignment of the load, but were using the aligned instructions. This will cause a GP fault if the data isn't aligned.

I believe these were introduced in r312450.

llvm-svn: 326967

6 years agoDelete code that is probably dead since r249303.
Rafael Espindola [Thu, 8 Mar 2018 00:17:13 +0000 (00:17 +0000)]
Delete code that is probably dead since r249303.

With r249303 the expression evaluation should expand variables that
are not in sections (and so don't have an atom).

llvm-svn: 326966

6 years ago[Sema] Make getCurFunction() return null outside function parsing
Reid Kleckner [Thu, 8 Mar 2018 00:14:34 +0000 (00:14 +0000)]
[Sema] Make getCurFunction() return null outside function parsing

Summary:
Before this patch, Sema pre-allocated a FunctionScopeInfo and kept it in
the first, always present element of the FunctionScopes stack. This
meant that Sema::getCurFunction would return a pointer to this
pre-allocated object when parsing code outside a function body. This is
pretty much always a bug, so this patch moves the pre-allocated object
into a separate unique_ptr. This should make bugs like PR36536 a lot
more obvious.

As you can see from this patch, there were a number of places that
unconditionally assumed they were always called inside a function.
However, there are also many places that null checked the result of
getCurFunction(), so I think this is a reasonable direction.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 326965

6 years agoFix build broken by r326959
Eugene Zemtsov [Thu, 8 Mar 2018 00:07:26 +0000 (00:07 +0000)]
Fix build broken by r326959

Adding Demangle to link time dependencies of Symbolize

llvm-svn: 326964

6 years ago[X86][SSE] LowerBUILD_VECTORAsVariablePermute - reorder permute types. NFCI.
Simon Pilgrim [Wed, 7 Mar 2018 23:56:42 +0000 (23:56 +0000)]
[X86][SSE] LowerBUILD_VECTORAsVariablePermute - reorder permute types. NFCI.

Reorder into 128/256/512 bit vector size groupings.

NFCI commit before some new features.

llvm-svn: 326963

6 years ago[MS] Accept __unaligned as a qualifier on member function pointers
Reid Kleckner [Wed, 7 Mar 2018 23:26:02 +0000 (23:26 +0000)]
[MS] Accept __unaligned as a qualifier on member function pointers

We need to treat __unaligned like the other 'cvr' qualifiers when it
appears at the end of a function prototype. We weren't doing that in
some tentative parsing.

Fixes PR36638.

llvm-svn: 326962

6 years agoSet dso_local on tls init functions.
Rafael Espindola [Wed, 7 Mar 2018 23:18:06 +0000 (23:18 +0000)]
Set dso_local on tls init functions.

We copy the visibility, so copying the dso_local flag seems the
natural thing to do.

llvm-svn: 326961

6 years ago[ms] Emit vtordisp initializers in a deterministic order.
Nico Weber [Wed, 7 Mar 2018 23:15:20 +0000 (23:15 +0000)]
[ms] Emit vtordisp initializers in a deterministic order.

No effective behavior change, just for cleanliness.
Analysis and typing by me, actual patch mostly by Reid.

Fixes PR36159.
https://reviews.llvm.org/D44223

llvm-svn: 326960

6 years agoUse itaniumDemangle in llvm-symbolizer
Eugene Zemtsov [Wed, 7 Mar 2018 23:07:34 +0000 (23:07 +0000)]
Use itaniumDemangle in llvm-symbolizer

Currently on Windows (_MSC_VER) LLVMSymbolizer supports only Microsoft mangling.
This fix just explicitly uses itaniumDemangle when mangled name starts with _Z.

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

llvm-svn: 326959

6 years agoInclude <system_error> since we use it. Thanks to Andrey Maksimov for the catch.
Marshall Clow [Wed, 7 Mar 2018 22:51:16 +0000 (22:51 +0000)]
Include <system_error> since we use it. Thanks to Andrey Maksimov for the catch.

llvm-svn: 326958

6 years agoAvoid including ScopeInfo.h from Sema.h
Reid Kleckner [Wed, 7 Mar 2018 22:48:35 +0000 (22:48 +0000)]
Avoid including ScopeInfo.h from Sema.h

Summary:
This provides no measurable build speedup, but it reinstates an
optimization from r112038 that was lost in r179618.  It requires moving
CapturedScopeInfo::Capture out to clang::sema, which might be too
general since we have plenty of other Capture records in BlockDecl and
other AST nodes.

Reviewers: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 326957

6 years ago[TTI] add explanatory comments for getArithmeticInstrCost; NFC
Sanjay Patel [Wed, 7 Mar 2018 22:43:08 +0000 (22:43 +0000)]
[TTI] add explanatory comments for getArithmeticInstrCost; NFC

llvm-svn: 326956

6 years ago[AArch64] Adjust the cost of integer vector division
Evandro Menezes [Wed, 7 Mar 2018 22:35:32 +0000 (22:35 +0000)]
[AArch64] Adjust the cost of integer vector division

Since there is no instruction for integer vector division, factor in the
cost of singling out each element to be used with the scalar division
instruction.

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

llvm-svn: 326955

6 years ago[Documentation] Fix Clang-tidy checks list broken in r326909.
Eugene Zelenko [Wed, 7 Mar 2018 22:30:50 +0000 (22:30 +0000)]
[Documentation] Fix Clang-tidy checks list broken in r326909.

llvm-svn: 326954

6 years agoRevert r326932: [DebugInfo] Support DWARF expressions in eh_frame
Rui Ueyama [Wed, 7 Mar 2018 22:29:48 +0000 (22:29 +0000)]
Revert r326932: [DebugInfo] Support DWARF expressions in eh_frame

This reverts commit rr326932 because it broke lld/test/ELF/eh-frame-hdr-augmentation.s.

llvm-svn: 326953

6 years ago[analyzer] [PointerArithChecker] do not warn on indexes into vector types
George Karpenkov [Wed, 7 Mar 2018 22:20:39 +0000 (22:20 +0000)]
[analyzer] [PointerArithChecker] do not warn on indexes into vector types

rdar://35041502

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

llvm-svn: 326952

6 years ago[analyzer] Don't crash with assertion failure on structured bindings
George Karpenkov [Wed, 7 Mar 2018 22:20:35 +0000 (22:20 +0000)]
[analyzer] Don't crash with assertion failure on structured bindings

Proper modeling still remains to be done.
Note that BindingDecl#getHoldingVar() is almost always null, and this
should probably be handled by dealing with DecompositionDecl beforehand.

rdar://36852163

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

llvm-svn: 326951

6 years ago[OpenMP] Remove implicit data sharing using device shared memory from libomptarget
Gheorghe-Teodor Bercea [Wed, 7 Mar 2018 22:10:10 +0000 (22:10 +0000)]
[OpenMP] Remove implicit data sharing using device shared memory from libomptarget

Summary:
This patch reverts the changes to libomptarget that were coupled with the changes to Clang code gen for data sharing using shared memory. A similar patch exists for Clang: D43625

Shared memory is meant to be used as an optimization on top of a more general scheme. So far we didn't have a global memory implementation ready so shared memory was a solution which applied to the current level of OpenMP complexity supported by trunk on GPU devices (due to the missing NVPTX backend patch this functionality has never been exercised). Now that we have a global memory solution this patch is "in the way" and needs to be removed (for now). This patch (or an equivalent version of it) will be put out for review once the global memory scheme is in place.

Reviewers: ABataev, grokos, carlo.bertolli, caomhin

Reviewed By: grokos

Subscribers: Hahnfeld, guansong, openmp-commits

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

llvm-svn: 326950

6 years ago[AArch64] add missing pattern for insert_subvector undef
Sebastian Pop [Wed, 7 Mar 2018 22:07:13 +0000 (22:07 +0000)]
[AArch64] add missing pattern for insert_subvector undef

The attached testcase started failing after the patch to define
isExtractSubvectorCheap with the following pattern mismatch:

ISEL: Starting pattern match
  Initial Opcode index to 85068
    Match failed at index 85076
    LLVM ERROR: Cannot select: t47: v8i16 = insert_subvector undef:v8i16, t43, Constant:i64<0>

The code generated from llvm/lib/Target/AArch64/AArch64InstrInfo.td

def : Pat<(insert_subvector undef, (v4i16 FPR64:$src), (i32 0)),
          (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)), FPR64:$src, dsub)>;

is in ninja/lib/Target/AArch64/AArch64GenDAGISel.inc
At the location of the error it is:
/* 85076*/    OPC_CheckChild2Type, MVT::i32,

And it failed to match the type of operand 2.
Adding another def-pat for i64 fixes the failed def-pat error:

def : Pat<(insert_subvector undef, (v4i16 FPR64:$src), (i64 0)),
          (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)), FPR64:$src, dsub)>;

llvm-svn: 326949

6 years ago[OpenMP] Remove implicit data sharing code gen that aims to use device shared memory
Gheorghe-Teodor Bercea [Wed, 7 Mar 2018 21:59:50 +0000 (21:59 +0000)]
[OpenMP] Remove implicit data sharing code gen that aims to use device shared memory

Summary: Remove this scheme for now since it will be covered by another more generic scheme using global memory. This code will be worked into an optimization for the generic data sharing scheme. Removing this completely and then adding it via future patches will make all future data sharing patches cleaner.

Reviewers: ABataev, carlo.bertolli, caomhin

Reviewed By: ABataev

Subscribers: jholewinski, guansong, cfe-commits

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

llvm-svn: 326948

6 years ago[clangd] Remove unused field in HandlerRegisterer
Simon Marchi [Wed, 7 Mar 2018 21:47:25 +0000 (21:47 +0000)]
[clangd] Remove unused field in HandlerRegisterer

Summary: Tested by rebuilding.

Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 326947

6 years agoCodeGen: Fix address space of indirect function argument
Yaxun Liu [Wed, 7 Mar 2018 21:45:40 +0000 (21:45 +0000)]
CodeGen: Fix address space of indirect function argument

The indirect function argument is in alloca address space in LLVM IR. However,
during Clang codegen for C++, the address space of indirect function argument
should match its address space in the source code, i.e., default addr space, even
for indirect argument. This is because destructor of the indirect argument may
be called in the caller function, and address of the indirect argument may be
taken, in either case the indirect function argument is expected to be in default
addr space, not the alloca address space.

Therefore, the indirect function argument should be mapped to the temp var
casted to default address space. The caller will cast it to alloca addr space
when passing it to the callee. In the callee, the argument is also casted to the
default address space and used.

CallArg is refactored to facilitate this fix.

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

llvm-svn: 326946

6 years ago[clang-format] Break consecutive string literals in text protos
Krasimir Georgiev [Wed, 7 Mar 2018 21:30:38 +0000 (21:30 +0000)]
[clang-format] Break consecutive string literals in text protos

Summary:
This patch fixes a bug where consecutive string literals in text protos were
put on the same line.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: klimek, cfe-commits

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

llvm-svn: 326945

6 years ago[ELF] Update test/ELF/eh-frame-hdr-augmentation.s
Fangrui Song [Wed, 7 Mar 2018 21:25:58 +0000 (21:25 +0000)]
[ELF] Update test/ELF/eh-frame-hdr-augmentation.s

llvm-svn: 326944

6 years agoRevert "Write a hash of the executable into the PE timestamp fields."
Zachary Turner [Wed, 7 Mar 2018 21:22:10 +0000 (21:22 +0000)]
Revert "Write a hash of the executable into the PE timestamp fields."

This is breaking a couple of tests, so I'm reverting temporarily
until I can get everything resolved properly.

llvm-svn: 326943

6 years agoCorrect the alignment for the PS4 target
Matthew Voss [Wed, 7 Mar 2018 20:48:16 +0000 (20:48 +0000)]
Correct the alignment for the PS4 target

https://reviews.llvm.org/D44218

llvm-svn: 326942

6 years agoRevert "[llvm-objcopy] Add support for large indexes"
Jake Ehrlich [Wed, 7 Mar 2018 20:33:02 +0000 (20:33 +0000)]
Revert "[llvm-objcopy] Add support for large indexes"

Not all build bots have unzip which I used in a test.

This reverts commit 0b1f26d39ea42dd3716b525fbc8c78d8c7bb4479.

llvm-svn: 326941

6 years ago[llvm-objcopy] Add support for large indexes
Jake Ehrlich [Wed, 7 Mar 2018 19:59:15 +0000 (19:59 +0000)]
[llvm-objcopy] Add support for large indexes

Because of -ffunction-sections (and maybe other use cases I'm not aware of?) it
can occur that we need more than 0xfeff sections but ELF dosn't support that
many sections. To solve this problem SHN_XINDEX exists and with it come a whole
host of changes for section indexes everywhere. This change adds support for
those cases which should allow llvm-objcopy to copy binaries that have an
arbitrary number of sections.

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

llvm-svn: 326940

6 years ago[X86] Remove unused function argument. NFC
Craig Topper [Wed, 7 Mar 2018 19:45:45 +0000 (19:45 +0000)]
[X86] Remove unused function argument. NFC

llvm-svn: 326939

6 years ago[sanitizer] Fix SANITIZER_INTERCEPT_MMAP and SANITIZER_INTERCEPT_MMAP64 values
Vitaly Buka [Wed, 7 Mar 2018 19:43:50 +0000 (19:43 +0000)]
[sanitizer] Fix SANITIZER_INTERCEPT_MMAP and SANITIZER_INTERCEPT_MMAP64 values

llvm-svn: 326938