platform/upstream/llvm.git
7 years ago[AArch64][Falkor] Fix sched details for FMOV of WZR/XZR.
Geoff Berry [Tue, 23 May 2017 19:54:28 +0000 (19:54 +0000)]
[AArch64][Falkor] Fix sched details for FMOV of WZR/XZR.

llvm-svn: 303680

7 years ago[ARM] Temporarily disable globals promotion to constant pools to prevent miscompilation
Oleg Ranevskyy [Tue, 23 May 2017 19:38:37 +0000 (19:38 +0000)]
[ARM] Temporarily disable globals promotion to constant pools to prevent miscompilation

Summary:
A temporary workaround for PR32780 - rematerialized instructions accessing the same promoted global through different constant pool entries.

The patch turns off the globals promotion optimization leaving all its code in place, so that it can be easily turned on once PR32780 is fixed.

Since this is a miscompilation issue causing generation of misbehaving code, and the problem is very subtle, the patch might be valuable enough to get into 4.0.1.

Reviewers: efriedma, jmolloy

Reviewed By: efriedma

Subscribers: aemerson, javed.absar, llvm-commits, rengolin, asl, tstellar

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

llvm-svn: 303679

7 years ago[globalisel][tablegen] Add support for (set $dst, 1) and test X86's OptForSize predicate.
Daniel Sanders [Tue, 23 May 2017 19:33:16 +0000 (19:33 +0000)]
[globalisel][tablegen] Add support for (set $dst, 1) and test X86's OptForSize predicate.

Summary:
It's rare but a small number of patterns use IntInit's at the root of the match.
On X86, one such rule is enabled by the OptForSize predicate and causes the
compiler to use the smaller:
%0 = MOV32r1
instead of the usual:
%0 = MOV32ri 1

This patch adds support for matching IntInit's at the root and uses this as a
test case for the optsize attribute that was implemented in r301750

Reviewers: qcolombet, ab, t.p.northover, rovka, kristof.beyls, aditya_nandakumar

Reviewed By: qcolombet

Subscribers: igorb, llvm-commits

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

llvm-svn: 303678

7 years agoFix bad change in RenderScriptx86ABIFixups.cpp, forgot to change everything necessary
Stephane Sezer [Tue, 23 May 2017 19:22:31 +0000 (19:22 +0000)]
Fix bad change in RenderScriptx86ABIFixups.cpp, forgot to change everything necessary

Summary: I didn't change all instances of i to I in this loop. I am a bad person and should feel bad. :(

Reviewers: sas

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

Change by Alex Langford <apl@fb.com>

llvm-svn: 303677

7 years ago[CodeView] Eliminate redundant hashes and allocations.
Zachary Turner [Tue, 23 May 2017 18:56:23 +0000 (18:56 +0000)]
[CodeView] Eliminate redundant hashes and allocations.

When writing field list records, we would construct a temporary
type serializer that shared a bump ptr allocator with the rest
of the application, so anything allocated from here would live
forever.  Furthermore, this temporary serializer had all the
properties of a full blown serializer including record hashing
and de-duplication.

These features are required when you're merging multiple type
streams into each other, because different streams may contain
identical records, but records from the same type stream will
never collide with each other.  So all of this hashing was
unnecessary.

To solve this, two fixes are made:

1) The temporary serializer keeps its own bump ptr allocator
instead of sharing a global one.  When it's finished, all of
its memory is freed.

2) Instead of using the same temporary serializer for the life
of an entire type stream, we use it only for the life of a single
field list record and delete it when the field list record is
completed.  This way the hash table will not grow as other
records from the same type stream get inserted.  Further improvements
could eliminate hashing entirely from this codepath.

This reduces the link time by 85% in my test, from 1 minute to 9
seconds.

llvm-svn: 303676

7 years agoImplement LWG#2790: Remove istreambuf_iterator::operator->. It never did anything...
Marshall Clow [Tue, 23 May 2017 18:55:32 +0000 (18:55 +0000)]
Implement LWG#2790: Remove istreambuf_iterator::operator->. It never did anything useful.

llvm-svn: 303675

7 years agohange RenderScriptx86ABIFixups.cpp to use llvm::AttributeList iterator
Stephane Sezer [Tue, 23 May 2017 18:54:03 +0000 (18:54 +0000)]
hange RenderScriptx86ABIFixups.cpp to use llvm::AttributeList iterator

LLVM::AttributeList recently had getNumSlots() removed, which broke the
build. This fixes the build using functions introduced in the
update to LLVM::AttributeList.

Change by Alex Langford <apl@fb.com>

llvm-svn: 303674

7 years ago[DAG] Add AddressSpace parameter to canMergeStoresTo. NFC.
Nirav Dave [Tue, 23 May 2017 18:53:02 +0000 (18:53 +0000)]
[DAG] Add AddressSpace parameter to canMergeStoresTo. NFC.

llvm-svn: 303673

7 years agoRemove trailing whitespace
Yuka Takahashi [Tue, 23 May 2017 18:52:27 +0000 (18:52 +0000)]
Remove trailing whitespace

llvm-svn: 303672

7 years ago[InstSimplify] Add more tests for undef inputs and multiplying by 0 for the add/sub...
Craig Topper [Tue, 23 May 2017 18:42:58 +0000 (18:42 +0000)]
[InstSimplify] Add more tests for undef inputs and multiplying by 0 for the add/sub/mul with overflow intrinsics. NFC

llvm-svn: 303671

7 years ago[GSoC] Shell autocompletion for clang
Yuka Takahashi [Tue, 23 May 2017 18:39:08 +0000 (18:39 +0000)]
[GSoC] Shell autocompletion for clang

Summary:
This is a first patch for GSoC project, bash-completion for clang.
To use this on bash, please run `source clang/utils/bash-autocomplete.sh`.
bash-autocomplete.sh is code for bash-completion.

Simple flag completion and path completion is available in this patch.

Reviewers: teemperor, v.g.vassilev, ruiu, Bigcheese, efriedma

Subscribers: llvm-commits

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

llvm-svn: 303670

7 years agoFix DIEHash refactoring that dropped the DW_AT_name from the hash
David Blaikie [Tue, 23 May 2017 18:36:07 +0000 (18:36 +0000)]
Fix DIEHash refactoring that dropped the DW_AT_name from the hash

llvm-svn: 303669

7 years ago[DAG] Add canMergeStoresTo predicate checks. NFCI.
Nirav Dave [Tue, 23 May 2017 18:33:09 +0000 (18:33 +0000)]
[DAG] Add canMergeStoresTo predicate checks. NFCI.

Propagate canMergeStoresTo checks to missing cases in StoreMerge.

llvm-svn: 303668

7 years agoSpeculative build fix for non-Windows
Reid Kleckner [Tue, 23 May 2017 18:28:13 +0000 (18:28 +0000)]
Speculative build fix for non-Windows

llvm-svn: 303667

7 years agoRefactor DWARF hashing to use a .def file to avoid repetition
David Blaikie [Tue, 23 May 2017 18:27:09 +0000 (18:27 +0000)]
Refactor DWARF hashing to use a .def file to avoid repetition

llvm-svn: 303666

7 years ago[PDB] Hash types up front when merging types instead of using StringMap
Reid Kleckner [Tue, 23 May 2017 18:23:59 +0000 (18:23 +0000)]
[PDB] Hash types up front when merging types instead of using StringMap

Summary:
First, StringMap uses llvm::HashString, which is only good for short
identifiers and really bad for large blobs of binary data like type
records. Moving to `DenseMap<StringRef, TypeIndex>` with some tricks for
memory allocation fixes that.

Unfortunately, that didn't buy very much performance. Profiling showed
that we spend a long time during DenseMap growth rehashing existing
entries. Also, in general, DenseMap is faster when the keys are small.
This change takes that to the logical conclusion by introducing a small
wrapper value type around a pointer to key data. The key data contains a
precomputed hash, the original record data (pointer and size), and the
type index, which is the "value" of our original map.

This reduces the time to produce llvm-as.exe and llvm-as.pdb from ~15s
on my machine to 3.5s, which is about a 4x improvement.

Reviewers: zturner, inglorion, ruiu

Subscribers: llvm-commits

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

llvm-svn: 303665

7 years ago[InstSimplify] auto-generate test checks. NFC
Craig Topper [Tue, 23 May 2017 17:57:36 +0000 (17:57 +0000)]
[InstSimplify] auto-generate test checks. NFC

llvm-svn: 303664

7 years ago[InstCombine] auto-generate test checks; NFC
Sanjay Patel [Tue, 23 May 2017 17:51:22 +0000 (17:51 +0000)]
[InstCombine] auto-generate test checks; NFC

llvm-svn: 303663

7 years agoDisable flaky ASan tests temporarily on darwin
Adam Nemet [Tue, 23 May 2017 17:50:48 +0000 (17:50 +0000)]
Disable flaky ASan tests temporarily on darwin

llvm-svn: 303662

7 years ago[InstCombine] allow icmp-xor folds for vectors (PR33138)
Sanjay Patel [Tue, 23 May 2017 17:29:58 +0000 (17:29 +0000)]
[InstCombine] allow icmp-xor folds for vectors (PR33138)

This fixes the first part of:
https://bugs.llvm.org/show_bug.cgi?id=33138

More work is needed for the bitcasted variant.

llvm-svn: 303660

7 years ago[InstCombine] Use update_test_checks to regenerate the ctpop test. NFC
Craig Topper [Tue, 23 May 2017 17:20:18 +0000 (17:20 +0000)]
[InstCombine] Use update_test_checks to regenerate the ctpop test. NFC

llvm-svn: 303659

7 years agoAMDGPU: Fold CI-specific complex SMRD patterns into existing complex patterns
Marek Olsak [Tue, 23 May 2017 17:14:34 +0000 (17:14 +0000)]
AMDGPU: Fold CI-specific complex SMRD patterns into existing complex patterns

This is just a cleanup. Also, it adds checking that ByteCount is aligned to 4.

Reviewers: arsenm, nhaehnle, tstellarAMD

Subscribers: kzhuravl, wdng, yaxunl, tony-tye

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

llvm-svn: 303658

7 years agoCommit AttributeList change that was supposed to be part of r303654
Reid Kleckner [Tue, 23 May 2017 17:03:28 +0000 (17:03 +0000)]
Commit AttributeList change that was supposed to be part of r303654

llvm-svn: 303656

7 years ago[RuntimeDyld, PowerPC] Fix regression from r303637
Ulrich Weigand [Tue, 23 May 2017 17:03:23 +0000 (17:03 +0000)]
[RuntimeDyld, PowerPC] Fix regression from r303637

Actually, to identify external symbols, we need to check for
*either* non-null Value.SymbolName *or* a SymType of
Symbol::ST_Unknown.

The former may happen for symbols not known to the JIT at all
(e.g. defined in a native library), while the latter happens
for symbols known to the JIT, but defined in a different module.

Fixed several regressions on big-endian ppc64.

llvm-svn: 303655

7 years ago[IR] Switch AttributeList to use an array for O(1) access
Reid Kleckner [Tue, 23 May 2017 17:01:48 +0000 (17:01 +0000)]
[IR] Switch AttributeList to use an array for O(1) access

Summary:
Before this change, AttributeLists stored a pair of index and
AttributeSet. This is memory efficient if most arguments do not have
attributes. However, it requires doing a search over the pairs to test
an argument or function attribute. Profiling shows that this loop was
0.76% of the time in 'opt -O2' of sqlite3.c, because LLVM constantly
tests values for nullability.

This was worth about 2.5% of mid-level optimization cycles on the
sqlite3 amalgamation. Here are the full perf results:
https://reviews.llvm.org/P7995

Here are just the before and after cycle counts:
```
$ perf stat -r 5 ./opt_before -O2 sqlite3.bc -o /dev/null
    13,274,181,184      cycles                    #    3.047 GHz                      ( +-  0.28% )
$ perf stat -r 5 ./opt_after -O2 sqlite3.bc -o /dev/null
    12,906,927,263      cycles                    #    3.043 GHz                      ( +-  0.51% )
```

This patch *does not* change the indices used to query attributes, as
requested by reviewers. Tracking whether an index is usable for array
indexing is a huge pain that affects many of the internal APIs, so it
would be good to come back later and do a cleanup to remove this
internal adjustment.

Reviewers: pete, chandlerc

Subscribers: javed.absar, llvm-commits

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

llvm-svn: 303654

7 years agoRemoved fallthrough annotation which does not directly precede switch label.
Galina Kistanova [Tue, 23 May 2017 16:56:10 +0000 (16:56 +0000)]
Removed fallthrough annotation which does not directly precede switch label.

llvm-svn: 303653

7 years ago[InstCombine] add icmp-xor tests to show vector neglect; NFC
Sanjay Patel [Tue, 23 May 2017 16:53:05 +0000 (16:53 +0000)]
[InstCombine] add icmp-xor tests to show vector neglect; NFC

Also, rename the tests and the file, add comments, and add more tests
because there are no existing tests for some of these folds.

These patterns are particularly important for crippled vector ISAs that
have limited compare predicates (PR33138).

llvm-svn: 303652

7 years ago[index] The references to enum constants from member enums that are
Alex Lorenz [Tue, 23 May 2017 16:47:01 +0000 (16:47 +0000)]
[index] The references to enum constants from member enums that are
from template instantiations should refer to the enum constant in the pattern
enum in the base template

rdar://32325459

llvm-svn: 303651

7 years ago[index] The references to member enums from template instantiations should
Alex Lorenz [Tue, 23 May 2017 16:35:50 +0000 (16:35 +0000)]
[index] The references to member enums from template instantiations should
refer to the pattern member enum in the base template

rdar://32325459

llvm-svn: 303650

7 years agoAdded LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
Galina Kistanova [Tue, 23 May 2017 16:33:07 +0000 (16:33 +0000)]
Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.

llvm-svn: 303649

7 years ago[index] The references to type aliases and typedefs from template
Alex Lorenz [Tue, 23 May 2017 16:27:42 +0000 (16:27 +0000)]
[index] The references to type aliases and typedefs from template
instantiations should refer to the pattern type aliases / typedefs in the base
templates

rdar://32325459

llvm-svn: 303648

7 years ago[index] The references to fields from nested records in template instantiations
Alex Lorenz [Tue, 23 May 2017 16:25:06 +0000 (16:25 +0000)]
[index] The references to fields from nested records in template instantiations
should refer to the pattern fields in the nested records in the base templates

rdar://32352429

llvm-svn: 303647

7 years ago[index] The references to records from template instantiations should refer
Alex Lorenz [Tue, 23 May 2017 16:23:28 +0000 (16:23 +0000)]
[index] The references to records from template instantiations should refer
to the pattern records in the base templates

rdar://32325459

llvm-svn: 303646

7 years ago[clang-tidy] Do not dereference a null BaseType
Chih-Hung Hsieh [Tue, 23 May 2017 16:19:04 +0000 (16:19 +0000)]
[clang-tidy] Do not dereference a null BaseType

Check BaseType before dereference.
Simplified test case is derived from Android Open Source code.

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

llvm-svn: 303645

7 years ago[AMDGPU] Do not require opencl triple environment for OpenCL
Yaxun Liu [Tue, 23 May 2017 16:15:53 +0000 (16:15 +0000)]
[AMDGPU] Do not require opencl triple environment for OpenCL

A recent change requires opencl triple environment for compiling OpenCL
program, which causes regressions in libclc.

This patch fixes that. Instead of deducing language based on triple
environment, it checks LangOptions.

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

llvm-svn: 303644

7 years agoWe shouldn't put actual tests in directories that contain
Jim Ingham [Tue, 23 May 2017 16:11:21 +0000 (16:11 +0000)]
We shouldn't put actual tests in directories that contain
other test directories.

llvm-svn: 303643

7 years agoAdd test coverage for recent behavior change in GNU line marker pre-processing
Reid Kleckner [Tue, 23 May 2017 16:09:13 +0000 (16:09 +0000)]
Add test coverage for recent behavior change in GNU line marker pre-processing

llvm-svn: 303642

7 years ago[AMDGPU] Convert shl (add) into add (shl)
Stanislav Mekhanoshin [Tue, 23 May 2017 15:59:58 +0000 (15:59 +0000)]
[AMDGPU] Convert shl (add) into add (shl)

shl (or|add x, c2), c1 => or|add (shl x, c1), (c2 << c1)
This allows to fold a constant into an address in some cases as
well as to eliminate second shift if the expression is used as
an address and second shift is a result of a GEP.

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

llvm-svn: 303641

7 years agoRevert "Make TypeSerializer's StringMap use the same allocator."
Zachary Turner [Tue, 23 May 2017 15:50:37 +0000 (15:50 +0000)]
Revert "Make TypeSerializer's StringMap use the same allocator."

This reverts commit e34ccb7b57da25cc89ded913d8638a2906d1110a.

This is causing failures on the ASAN bots.

llvm-svn: 303640

7 years ago[mips] Remove unused class field. NFC
Simon Atanasyan [Tue, 23 May 2017 15:00:30 +0000 (15:00 +0000)]
[mips] Remove unused class field. NFC

llvm-svn: 303639

7 years ago[mips] Change type of MipsSubtarget ctor arguments s/std::string/StringRef/. NFC
Simon Atanasyan [Tue, 23 May 2017 15:00:26 +0000 (15:00 +0000)]
[mips] Change type of MipsSubtarget ctor arguments s/std::string/StringRef/. NFC

llvm-svn: 303638

7 years ago[RuntimeDyld, PowerPC] Fix check for external symbols when detecting reloction overflow
Ulrich Weigand [Tue, 23 May 2017 14:51:18 +0000 (14:51 +0000)]
[RuntimeDyld, PowerPC] Fix check for external symbols when detecting reloction overflow

The PowerPC part of processRelocationRef currently assumes that external
symbols can be identified by checking for SymType == SymbolRef::ST_Unknown.
This is actually incorrect in some cases, causing relocation overflows to
be mis-detected. The correct check is to test whether Value.SymbolName
is null.

Includes test case. Note that it is a bit tricky to replicate the exact
condition that triggers the bug in a test case. The one included here
seems to fail reliably (before the fix) across different operating
system versions on Power, but it still makes a few assumptions (called
out in the test case comments).

Also add ppc64le platform name to the supported list in the lit.local.cfg
files for the MCJIT and OrcMCJIT directories, since those tests were
currently not run at all.

Fixes PR32650.

Reviewer: hfinkel

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

llvm-svn: 303637

7 years ago[clangd] Added a missing dependency on clangdAST to fix the build
Ilya Biryukov [Tue, 23 May 2017 13:59:37 +0000 (13:59 +0000)]
[clangd] Added a missing dependency on clangdAST to fix the build

llvm-svn: 303636

7 years ago[Tooling][libclang] Remove unused CompilationDatabase::MappedSources
Krasimir Georgiev [Tue, 23 May 2017 13:50:43 +0000 (13:50 +0000)]
[Tooling][libclang] Remove unused CompilationDatabase::MappedSources

Summary:
This field is never assigned to and it's only ever read from libclang.
This patch removes it and adapts libclang to return constants.

Reviewers: klimek, bkramer

Reviewed By: klimek

Subscribers: cfe-commits, klimek

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

llvm-svn: 303635

7 years ago[clangd] Replaced WorkerRequest with std::function...
Ilya Biryukov [Tue, 23 May 2017 13:42:59 +0000 (13:42 +0000)]
[clangd] Replaced WorkerRequest with std::function...

Summary:
And implemented a helper function to dump an AST of a file for
testing/debugging purposes.

Reviewers: bkramer, krasimir

Reviewed By: krasimir

Subscribers: klimek, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 303634

7 years ago[JumpThreading] Safely replace uses of condition
Anna Thomas [Tue, 23 May 2017 13:36:25 +0000 (13:36 +0000)]
[JumpThreading] Safely replace uses of condition

This patch builds over https://reviews.llvm.org/rL303349 and replaces
the use of the condition only if it is safe to do so.

We should not blindly RAUW the condition if experimental.guard or assume
is a use of that
condition. This is because LVI may have used the guard/assume to
identify the
value of the condition, and RUAWing will fold the guard/assume and uses
before the guards/assumes.

Reviewers: sanjoy, reames, trentxintong, mkazantsev

Reviewed by: sanjoy, reames

Subscribers: llvm-commits

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

llvm-svn: 303633

7 years ago[RuntimeDyld, PowerPC] Fix relocation detection overflow
Ulrich Weigand [Tue, 23 May 2017 12:43:57 +0000 (12:43 +0000)]
[RuntimeDyld, PowerPC] Fix relocation detection overflow

Code in RuntimeDyldELF currently uses 32-bit temporaries to detect
whether a PPC64 relocation target is out of range. This is incorrect,
and can mis-detect overflow where the distance between relocation site
and target is close to a multiple of 4GB. Fixed by using 64-bit
temporaries.

Noticed while debugging PR32650.

Reviewer: hfinkel

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

llvm-svn: 303632

7 years ago[NFC] [PolyhedralInfo] fix typo
Siddharth Bhat [Tue, 23 May 2017 11:41:52 +0000 (11:41 +0000)]
[NFC] [PolyhedralInfo] fix typo

"an" -> "and"

llvm-svn: 303631

7 years agoAllow to use vfs::FileSystem for file accesses inside ASTUnit.
Ilya Biryukov [Tue, 23 May 2017 11:37:52 +0000 (11:37 +0000)]
Allow to use vfs::FileSystem for file accesses inside ASTUnit.

Reviewers: bkramer, krasimir, arphaman, akyrtzi

Reviewed By: bkramer

Subscribers: klimek, cfe-commits

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

llvm-svn: 303630

7 years ago[Polly][NewPM] Reenable ScopPassManager unittest
Philip Pfaffe [Tue, 23 May 2017 11:28:50 +0000 (11:28 +0000)]
[Polly][NewPM] Reenable ScopPassManager unittest

llvm-svn: 303629

7 years agoPost-commit fix of a comment
Philip Pfaffe [Tue, 23 May 2017 11:25:05 +0000 (11:25 +0000)]
Post-commit fix of a comment

llvm-svn: 303628

7 years agoAdd support for new (3.0.11+) swigs
Pavel Labath [Tue, 23 May 2017 10:55:17 +0000 (10:55 +0000)]
Add support for new (3.0.11+) swigs

Summary:
A change in swig 3.0.9 has caused it to generate modules incompatible
with us using them as __init__.py (bug #769). Swig 3.0.11 adds a setting to help
fix this problem, so use that. Support for older versions of swig remains
unaffected.

Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 303627

7 years ago[libclang] [OpenCL] Expose more OpenCL CIndex types
Sven van Haastregt [Tue, 23 May 2017 10:36:43 +0000 (10:36 +0000)]
[libclang] [OpenCL] Expose more OpenCL CIndex types

Expose pipe, sampler_t, clk_event_t, queue_t, reserve_id_t, and all
image types.

Update the opencl-types.cl test RUN line such that we can test the
OpenCL 2.0 types.

Patch by Simon Perretta.

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

llvm-svn: 303626

7 years ago[clangd] Explicitly link against pthread.
Benjamin Kramer [Tue, 23 May 2017 10:29:54 +0000 (10:29 +0000)]
[clangd] Explicitly link against pthread.

llvm-svn: 303625

7 years ago[Polly][NewPM] Port CodeGen to the new PM
Philip Pfaffe [Tue, 23 May 2017 10:18:12 +0000 (10:18 +0000)]
[Polly][NewPM] Port CodeGen to the new PM

Summary: To move CG to the new PM I outlined the various helper that were previously members of the CG class into free static functions. The CG class itself I moved into a header, which is required because we need to include it in `RegisterPasses` eventually.

Reviewers: grosser, Meinersbur

Reviewed By: grosser

Subscribers: pollydev, llvm-commits, sanjoy

Tags: #polly

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

llvm-svn: 303624

7 years ago[clangd] Pick up deps via LLVM components, which will hopefully include pthread.
Benjamin Kramer [Tue, 23 May 2017 10:17:48 +0000 (10:17 +0000)]
[clangd] Pick up deps via LLVM components, which will hopefully include pthread.

llvm-svn: 303623

7 years ago[Polly][NewPM] Port IslAst to the new ScopPassManager
Philip Pfaffe [Tue, 23 May 2017 10:12:56 +0000 (10:12 +0000)]
[Polly][NewPM] Port IslAst to the new ScopPassManager

Summary: This patch ports IslAst to the new PM. The change is mostly straightforward. The only major modification required is making IslAst move-only, to correctly manage the isl resources it owns.

Reviewers: grosser, Meinersbur

Reviewed By: grosser

Subscribers: nemanjai, pollydev, llvm-commits

Tags: #polly

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

llvm-svn: 303622

7 years ago[Polly][NewPM] Port DependenceInfo to the new ScopPassManager.
Philip Pfaffe [Tue, 23 May 2017 10:09:06 +0000 (10:09 +0000)]
[Polly][NewPM] Port DependenceInfo to the new ScopPassManager.

Summary: This patch ports DependenceInfo to the new ScopPassManager. Printing is implemented as a seperate printer pass.

Reviewers: grosser, Meinersbur

Reviewed By: grosser

Subscribers: llvm-commits, pollydev

Tags: #polly

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

llvm-svn: 303621

7 years ago[AMDGPU] SDWA: Add assembler support for GFX9
Sam Kolton [Tue, 23 May 2017 10:08:55 +0000 (10:08 +0000)]
[AMDGPU] SDWA: Add assembler support for GFX9

Summary:
Added separate pseudo and real instruction for GFX9 SDWA instructions.
Currently supports only in assembler.
Depends D32493

Reviewers: vpykhtin, artem.tamazov

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

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

llvm-svn: 303620

7 years ago[mips] Make checks in CodeGen/mips-varargs.c less fragile
Simon Dardis [Tue, 23 May 2017 09:42:50 +0000 (09:42 +0000)]
[mips] Make checks in CodeGen/mips-varargs.c less fragile

This test was failing on our fork of clang because it was not capturing
[[ARG]] in the N32 case. Therefore it used the value from the last function
which does not always have to be the same. All other cases were already
capturing ARG so this appears to be an oversight.
The test now uses -enable-var-scope to prevent such errors in the future.

Reviewers: sdardis, atanasyan

Patch by: Alexander Richardson

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

llvm-svn: 303619

7 years ago[AArch64] Make instruction fusion more aggressive.
Florian Hahn [Tue, 23 May 2017 09:33:34 +0000 (09:33 +0000)]
[AArch64] Make instruction fusion more aggressive.

Summary:
This patch makes instruction fusion more aggressive by
* adding artificial edges between the successors of FirstSU and
  SecondSU, similar to BaseMemOpClusterMutation::clusterNeighboringMemOps.
* updating PostGenericScheduler::tryCandidate to keep clusters together,
   similar to GenericScheduler::tryCandidate.

This change increases the number of AES instruction pairs generated on
 Cortex-A57 and Cortex-A72. This doesn't change code at all in
 most benchmarks or general code, but we've seen improvement on kernels
 using AESE/AESMC and AESD/AESIMC.

Reviewers: evandro, kristof.beyls, t.p.northover, silviu.baranga, atrick, rengolin, MatzeB

Reviewed By: evandro

Subscribers: aemerson, rengolin, MatzeB, javed.absar, llvm-commits

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

llvm-svn: 303618

7 years ago[GlobalISel][X86] G_LOAD/G_STORE vec256/512 support
Igor Breger [Tue, 23 May 2017 08:23:51 +0000 (08:23 +0000)]
[GlobalISel][X86] G_LOAD/G_STORE vec256/512 support

Summary: mark G_LOAD/G_STORE vec256/512 legal for AVX/AVX512. Implement instruction selection.

Reviewers: zvi, guyblank

Reviewed By: zvi

Subscribers: rovka, llvm-commits, kristof.beyls

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

llvm-svn: 303617

7 years ago[clangd] Split clangd into library+executable (mainly for unit tests).
Ilya Biryukov [Tue, 23 May 2017 08:12:45 +0000 (08:12 +0000)]
[clangd] Split clangd into library+executable (mainly for unit tests).

Summary:
This commit itself doesn't add any unit tests, but one that does will
follow shortly.

Reviewers: krasimir, bkramer

Reviewed By: bkramer

Subscribers: mgorny, klimek, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 303616

7 years ago[ScopInfo] Translate foldAccessRelation to isl C++ [NFC]
Tobias Grosser [Tue, 23 May 2017 07:22:56 +0000 (07:22 +0000)]
[ScopInfo] Translate foldAccessRelation to isl C++ [NFC]

llvm-svn: 303615

7 years ago[KnownBits] Use !hasConflict() in asserts in place of Zero & One == 0 or similar...
Craig Topper [Tue, 23 May 2017 07:18:37 +0000 (07:18 +0000)]
[KnownBits] Use !hasConflict() in asserts in place of Zero & One == 0 or similar. NFC

llvm-svn: 303614

7 years ago[LV] Report multiple reasons for not vectorizing under allowExtraAnalysis
Ayal Zaks [Tue, 23 May 2017 07:08:02 +0000 (07:08 +0000)]
[LV] Report multiple reasons for not vectorizing under allowExtraAnalysis

The default behavior of -Rpass-analysis=loop-vectorizer is to report only the
first reason encountered for not vectorizing, if one is found, at which time the
vectorizer aborts its handling of the loop. This patch allows multiple reasons
for not vectorizing to be identified and reported, at the potential expense of
additional compile-time, under allowExtraAnalysis which can currently be turned
on by Clang's -fsave-optimization-record and opt's -pass-remarks-missed.

Removed from LoopVectorizationLegality::canVectorize() the redundant checking
and reporting if we CantComputeNumberOfIterations, as LAI::canAnalyzeLoop() also
does that. This redundancy is caught by a lit test once multiple reasons are
reported.

Patch initially developed by Dror Barak.

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

llvm-svn: 303613

7 years ago[ScopInfo] Translate buildMemIntrinsicAccessRelation to isl C++ [NFC]
Tobias Grosser [Tue, 23 May 2017 07:07:09 +0000 (07:07 +0000)]
[ScopInfo] Translate buildMemIntrinsicAccessRelation to isl C++ [NFC]

llvm-svn: 303612

7 years ago[ScopInfo] Translate assumeNoOutOfBound to isl C++ [NFC]
Tobias Grosser [Tue, 23 May 2017 07:07:07 +0000 (07:07 +0000)]
[ScopInfo] Translate assumeNoOutOfBound to isl C++ [NFC]

llvm-svn: 303611

7 years ago[ScopInfo] Translate applyAndSetFAD to isl C++
Tobias Grosser [Tue, 23 May 2017 07:07:05 +0000 (07:07 +0000)]
[ScopInfo] Translate applyAndSetFAD to isl C++

llvm-svn: 303610

7 years agolibDebugInfo: Support symbolizing using DWP files
David Blaikie [Tue, 23 May 2017 06:48:53 +0000 (06:48 +0000)]
libDebugInfo: Support symbolizing using DWP files

llvm-svn: 303609

7 years ago[ScopInfo] Translate isReadOnly to isl C++
Tobias Grosser [Tue, 23 May 2017 06:41:04 +0000 (06:41 +0000)]
[ScopInfo] Translate isReadOnly to isl C++

llvm-svn: 303608

7 years ago[AArch64] Fix PRR33100.
Akira Hatanaka [Tue, 23 May 2017 06:08:37 +0000 (06:08 +0000)]
[AArch64] Fix PRR33100.

This commit fixes a bug introduced in r301019 where optimizeLogicalImm
would replace a logical node's immediate operand that was CSE'd and
was also an operand of another node.

This commit fixes the bug by replacing the logical node instead of its
immediate operand.

rdar://problem/32295276

llvm-svn: 303607

7 years agoUpdate expected result for or-branch.ll . NFC
Amaury Sechet [Tue, 23 May 2017 05:42:54 +0000 (05:42 +0000)]
Update expected result for or-branch.ll . NFC

llvm-svn: 303606

7 years ago[coroutines] Skip over passthrough operator co_await
Gor Nishanov [Tue, 23 May 2017 05:25:31 +0000 (05:25 +0000)]
[coroutines] Skip over passthrough operator co_await

https://reviews.llvm.org/D31627

llvm-svn: 303605

7 years agoAdded LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
Galina Kistanova [Tue, 23 May 2017 05:17:49 +0000 (05:17 +0000)]
Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.

llvm-svn: 303604

7 years ago[coroutines] Add emission of initial and final suspends
Gor Nishanov [Tue, 23 May 2017 05:04:01 +0000 (05:04 +0000)]
[coroutines] Add emission of initial and final suspends

https://reviews.llvm.org/D31608

llvm-svn: 303603

7 years agoCosmetic. Added braces to address gcc warning: suggest explicit braces to avoid ambig...
Galina Kistanova [Tue, 23 May 2017 05:00:10 +0000 (05:00 +0000)]
Cosmetic. Added braces to address gcc warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else].

llvm-svn: 303602

7 years agoTypeStreamMerger.h: Fix a \param in r303577. [-Wdocumentation]
NAKAMURA Takumi [Tue, 23 May 2017 04:49:24 +0000 (04:49 +0000)]
TypeStreamMerger.h: Fix a \param in r303577. [-Wdocumentation]

llvm-svn: 303601

7 years ago[ScopInfo] Simplify domains early
Tobias Grosser [Tue, 23 May 2017 04:26:28 +0000 (04:26 +0000)]
[ScopInfo] Simplify domains early

This speeds up scop modeling for scops with many redundent existentially
quantified constraints. For the attached test case, this change reduces
scop modeling time from minutes (hours?) to 0.15 seconds.

This change resolves a compilation timeout on the AOSP build.

Thanks Eli for reporting _and_ reducing the test case!

Reported-by: Eli Friedman <efriedma@codeaurora.org>
llvm-svn: 303600

7 years ago[coroutines] Add support for deallocation elision
Gor Nishanov [Tue, 23 May 2017 04:21:27 +0000 (04:21 +0000)]
[coroutines] Add support for deallocation elision

Wrap deallocation code with:

  if (auto *mem = coro.free()) Deallocate

When backend decides to elide allocations it will replace coro.free with nullptr to suppress deallocation code.

llvm-svn: 303599

7 years ago[coroutines] Replace all coro.frame builtins with an SSA value of coro.begin
Gor Nishanov [Tue, 23 May 2017 03:46:59 +0000 (03:46 +0000)]
[coroutines] Replace all coro.frame builtins with an SSA value of coro.begin

SemaCoroutine forms expressions referring to the coroutine frame of the enclosing coroutine using coro.frame builtin.
During codegen, we emit llvm.coro.begin intrinsic that returns the address of the coroutine frame.
When coro.frame is emitted, we replace it with SSA value of coro.begin.

llvm-svn: 303598

7 years agoAdded LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
Galina Kistanova [Tue, 23 May 2017 01:20:52 +0000 (01:20 +0000)]
Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.

llvm-svn: 303597

7 years ago[coroutines] Add support for allocation elision
Gor Nishanov [Tue, 23 May 2017 01:13:17 +0000 (01:13 +0000)]
[coroutines] Add support for allocation elision

Summary:
We wrap allocation code so that backend can elide it if necessary.
llvm.coro.alloc intrinsic returns true, when allocation is needed and false otherwise.

```
  %NeedAlloc = call i1 @llvm.coro.alloc(token %2)
  br i1 %NeedAlloc, label %AllocBB, label %InitBB

AllocBB:
  %5 = call i64 @llvm.coro.size.i64()
  %call = call i8* @_Znwm(i64 %5) ; operator new
  br label %InitBB

InitBB:
  %Phi = phi i8* [ null, %0 ], [ %call, %4 ]
  call i8* @llvm.coro.begin(token %2, i8* %Phi)
```

Reviewers: majnemer, EricWF

Subscribers: cfe-commits

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

llvm-svn: 303596

7 years agoAdded LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
Galina Kistanova [Tue, 23 May 2017 01:07:19 +0000 (01:07 +0000)]
Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.

llvm-svn: 303595

7 years ago[NFC, Refactor] Modernize TemplateIdAnnotation using TrailingObjects
Faisal Vali [Tue, 23 May 2017 01:07:12 +0000 (01:07 +0000)]
[NFC, Refactor] Modernize TemplateIdAnnotation using TrailingObjects

A refactoring of TemplateIdAnnotation that uses TrailingObjects to create a variably-sized object on the heap.

https://reviews.llvm.org/D31414

Thanks to Aaron B for the review!

llvm-svn: 303594

7 years agoAdjust clang test for r303590
Teresa Johnson [Tue, 23 May 2017 00:35:09 +0000 (00:35 +0000)]
Adjust clang test for r303590

Forgot to commit this separately from the llvm change to use a new
module flag type for pic and pie levels. Should fix the bot errors

llvm-svn: 303593

7 years agoFIX: Remove debugging assert left in previous commit
David Blaikie [Tue, 23 May 2017 00:31:24 +0000 (00:31 +0000)]
FIX: Remove debugging assert left in previous commit

Sorry for the bot noise.

llvm-svn: 303592

7 years agolibDebugInfo: Avoid independently parsing the same .dwo file for two separate CUs...
David Blaikie [Tue, 23 May 2017 00:30:42 +0000 (00:30 +0000)]
libDebugInfo: Avoid independently parsing the same .dwo file for two separate CUs residing there

NFC, just an optimization. Will be building on this for DWP support
shortly.

llvm-svn: 303591

7 years agoSupport for taking the max of module flags when linking, use for PIE/PIC
Teresa Johnson [Tue, 23 May 2017 00:08:00 +0000 (00:08 +0000)]
Support for taking the max of module flags when linking, use for PIE/PIC

Summary:
Add Max ModFlagBehavior, which can be used to take the max of two
module flag values when merging modules. Use it for the PIE and PIC
levels.

This avoids an error when we try to import from a module built -fpic
into a module built -fPIC, for example. For both PIE and PIC levels,
this will be legal, since the code generation gets more conservative
as the level is increased. Therefore we can take the max instead of
somehow trying to block importing between modules compiled with
different levels.

Reviewers: tmsriram, pcc

Subscribers: llvm-commits

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

llvm-svn: 303590

7 years agoAdd option to include multiple lines in snippets.
Richard Smith [Mon, 22 May 2017 23:51:40 +0000 (23:51 +0000)]
Add option to include multiple lines in snippets.

When a diagnostic includes a highlighted range spanning multiple lines, clang
now supports printing out multiple lines of context if necessary to show the
highlighted ranges. This is not yet exposed in the driver, but can be enabled
by "-Xclang -fcaret-diagnostics-max-lines -Xclang N".

This is experimental until we can find out whether it works well in practice,
and if so, what a good default for the maximum number of lines is.

llvm-svn: 303589

7 years ago[InstSimplify] Fix the indentation throughout the interface header file.
Craig Topper [Mon, 22 May 2017 23:50:40 +0000 (23:50 +0000)]
[InstSimplify] Fix the indentation throughout the interface header file.

The forward declarations and the SimplifyQuery class at the beginning of the namespace weren't indented. But the closing brace for SimplifyQuery and everything after it were indented.

This commit makes the whole file consistent to no identation per coding standards. The signature of every function in this file changed a few weeks ago so this isn't a big disturbance to the revision history.

llvm-svn: 303588

7 years ago[NewPM] Fix an innocent but silly typo. Reported by Craig Topper.
Davide Italiano [Mon, 22 May 2017 23:47:11 +0000 (23:47 +0000)]
[NewPM] Fix an innocent but silly typo. Reported by Craig Topper.

llvm-svn: 303587

7 years ago[NewPM] Add a temporary cl::opt() to test NewGVN.
Davide Italiano [Mon, 22 May 2017 23:41:40 +0000 (23:41 +0000)]
[NewPM] Add a temporary cl::opt() to test NewGVN.

llvm-svn: 303586

7 years agoAdded LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
Galina Kistanova [Mon, 22 May 2017 22:46:31 +0000 (22:46 +0000)]
Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.

llvm-svn: 303585

7 years ago[coroutines] Fix coro-eh-cleanup.cpp test
Gor Nishanov [Mon, 22 May 2017 22:41:28 +0000 (22:41 +0000)]
[coroutines] Fix coro-eh-cleanup.cpp test

llvm-svn: 303584

7 years ago[coroutines] Wrap the body of the coroutine in try-catch
Gor Nishanov [Mon, 22 May 2017 22:33:17 +0000 (22:33 +0000)]
[coroutines] Wrap the body of the coroutine in try-catch

Summary:
If unhandled_exception member function is present in the coroutine promise,
wrap the body of the coroutine in:

```
try {
  body
} catch(...) { promise.unhandled_exception(); }
```

Reviewers: EricWF, rnk, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 303583

7 years agoGive files from #line the characteristics of the current file
Reid Kleckner [Mon, 22 May 2017 21:42:58 +0000 (21:42 +0000)]
Give files from #line the characteristics of the current file

This allows #line directives to appear in system headers that have code
that clang would normally warn on. This is compatible with GCC, which is
easy to test by running `gcc -E`.

Fixes PR30752

llvm-svn: 303582

7 years ago[CodeGen] Fix uninitialized variables exposed by r303084
Vitaly Buka [Mon, 22 May 2017 21:33:54 +0000 (21:33 +0000)]
[CodeGen] Fix uninitialized variables exposed by r303084

All other calls of analyzeBranch reset PredTBB and PredFBB, so I assume it's
expected behavior.

llvm-svn: 303581

7 years agoInstructionSimplify: don't speculate about Constants changing.
Tim Northover [Mon, 22 May 2017 21:28:08 +0000 (21:28 +0000)]
InstructionSimplify: don't speculate about Constants changing.

When presented with an icmp/select pair, we can end up asking what would happen
if we replaced one constant with another in an instruction. This is a mistake,
while non-constant Values could become a constant, constants cannot change and
trying to do so can lead to completely invalid IR (a GEP referencing a
non-existant field in the original case).

llvm-svn: 303580

7 years ago[lld] Infer relocation model from module flags in relocatable LTO link.
Evgeniy Stepanov [Mon, 22 May 2017 21:11:44 +0000 (21:11 +0000)]
[lld] Infer relocation model from module flags in relocatable LTO link.

Fix for PR33096.

llvm-svn: 303579