Commit Graph

256299 Commits

Author SHA1 Message Date
Krzysztof Parzyszek 8f23dd6d68 [Hexagon] Fix lowering of formal arguments of type i1
On Hexagon, values of type i1 are passed in registers of type i32,
even though i1 is not a legal value for these registers. This is a
special case and needs special handling to maintain consistency of
the lowering information.

This fixes PR32089.

llvm-svn: 296645
2017-03-01 17:30:10 +00:00
Zachary Turner 081b1bceae [PDB] Re-add BinaryStreamTest.
This re-adds all the binary stream tests.  This was reverted due
to some misaligned reads.  For now the offending test is
disabled while I investigate.

llvm-svn: 296643
2017-03-01 17:22:36 +00:00
Hans Wennborg 19c0be90f9 [GVNHoist] Don't hoist unsafe scalars at -Oz (PR31729)
Based on Aditya Kumar's patch:

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

llvm-svn: 296642
2017-03-01 17:15:08 +00:00
Vedant Kumar b0baffc9a6 Remove unittests/DebugInfo/PDB/BinaryStreamTest.cpp (from r296555)
It breaks the ToT UBSan bots:

/Users/vk/Desktop/llvm/include/llvm/DebugInfo/MSF/BinaryStreamArray.h:246:12: runtime error: reference binding to misaligned address 0x7f925540939a for type 'const int', which requires 4 byte alignment
0x7f925540939a: note: pointer points here
 05 00  00 00 01 00 00 00 02 00  00 00 03 00 00 00 00 00  00 00 00 00 00 00 00 00  70 98 50 06 01 00
              ^
0  DebugInfoPDBTests                   0x0000000106263cbd llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 45
1  DebugInfoPDBTests                   0x00000001062628ff llvm::sys::RunSignalHandlers() + 159
2  DebugInfoPDBTests                   0x0000000106264593 SignalHandler(int) + 179
3  libsystem_platform.dylib            0x0000000107bb3fba _sigtramp + 26
4  libsystem_pthread.dylib             0x0000000107bd82c8 _pthread_keys + 9720
5  libsystem_c.dylib                   0x0000000107947f83 abort + 127
6  libclang_rt.ubsan_osx_dynamic.dylib 0x0000000106bb5fc2 __sanitizer::Abort() + 66
7  DebugInfoPDBTests                   0x000000010613f880 llvm::FixedStreamArrayIterator<int>::operator+=(long) + 0
8  DebugInfoPDBTests                   0x000000010613f615 llvm::FixedStreamArrayIterator<int>::operator*() const + 37
9  DebugInfoPDBTests                   0x000000010613f3cb std::__1::enable_if<__is_forward_iterator<llvm::FixedStreamArrayIterator<int> >::value, void>::type std::__1::vector<int, std::__1::allocator<int> >::__construct_at_end<llvm::FixedStreamArrayIterator<int> >(llvm::FixedStreamArrayIterator<int>, llvm::FixedStreamArrayIterator<int>, unsigned long) + 251
10 DebugInfoPDBTests                   0x000000010613f292 std::__1::vector<int, std::__1::allocator<int> >::vector<llvm::FixedStreamArrayIterator<int> >(llvm::FixedStreamArrayIterator<int>, std::__1::enable_if<(__is_forward_iterator<llvm::FixedStreamArrayIterator<int> >::value) && (is_constructible<int, std::__1::iterator_traits<llvm::FixedStreamArrayIterator<int> >::reference>::value), llvm::FixedStreamArrayIterator<int> >::type) + 226
11 DebugInfoPDBTests                   0x000000010613ddb7 std::__1::vector<int, std::__1::allocator<int> >::vector<llvm::FixedStreamArrayIterator<int> >(llvm::FixedStreamArrayIterator<int>, std::__1::enable_if<(__is_forward_iterator<llvm::FixedStreamArrayIterator<int> >::value) && (is_constructible<int, std::__1::iterator_traits<llvm::FixedStreamArrayIterator<int> >::reference>::value), llvm::FixedStreamArrayIterator<int> >::type) + 87
12 DebugInfoPDBTests                   0x000000010613d4af (anonymous namespace)::BinaryStreamTest_StreamReaderIntegerArray_Test::TestBody() + 1279
13 DebugInfoPDBTests                   0x00000001062780f3 testing::Test::Run() + 179
14 DebugInfoPDBTests                   0x0000000106279594 testing::TestInfo::Run() + 308
15 DebugInfoPDBTests                   0x000000010627a6a3 testing::TestCase::Run() + 307
16 DebugInfoPDBTests                   0x00000001062849d4 testing::internal::UnitTestImpl::RunAllTests() + 756
17 DebugInfoPDBTests                   0x0000000106284558 testing::UnitTest::Run() + 152
18 DebugInfoPDBTests                   0x0000000106266fa5 main + 117
19 libdyld.dylib                       0x00000001078506a5 start + 1
zsh: abort      ./unittests/DebugInfo/PDB/DebugInfoPDBTests

llvm-svn: 296641
2017-03-01 17:10:03 +00:00
Zachary Turner 1fa70d71f2 [PDB] Remove use of std error codes.
I already created a BinaryStreamError class for this purpose,
so update the code to use that on the remaining occurrences
of errc values.

This should also address the issue which led to r296583.

llvm-svn: 296640
2017-03-01 17:02:41 +00:00
Krasimir Georgiev 85c3704c0d [clang-format] Don't add namespace end comments for unbalanced right braces after namespace end
llvm-svn: 296638
2017-03-01 16:38:08 +00:00
Benjamin Kramer 570c230357 [clangd] Unbreak the shared build.
llvm-svn: 296637
2017-03-01 16:23:40 +00:00
Benjamin Kramer f0af3e6b01 [clangd] Add support for FixIts.
Summary:
This uses CodeActions to show 'apply fix' actions when code actions are
requested for a location. The actions themselves make use of a
clangd.applyFix command which has to be implemented on the editor side. I
included an implementation for vscode.

This also adds a -run-synchronously flag which runs everything on the main
thread. This is useful for testing.

Reviewers: krasimir

Subscribers: cfe-commits

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

llvm-svn: 296636
2017-03-01 16:16:29 +00:00
Tobias Grosser 24222c7357 Fix namespaces after clang-format update
llvm-svn: 296635
2017-03-01 15:54:27 +00:00
Diana Picus 3841522259 clang-format r296631
Apparently I forgot to run it after fixing up some things...

llvm-svn: 296634
2017-03-01 15:54:21 +00:00
Krasimir Georgiev 32eaa864e3 [clang-format] Add a new flag FixNamespaceComments to FormatStyle
Summary:
This patch enables namespace end comments under a new flag FixNamespaceComments,
which is enabled for the LLVM and Google styles.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 296632
2017-03-01 15:35:39 +00:00
Diana Picus 9c52309b37 [ARM] GlobalISel: Lower call params that need extensions
Lower i1, i8 and i16 call parameters by extending them before storing them on
the stack. Also make sure we encode the correct, extended size in the
corresponding memory operand, and that we compute the correct stack size in the
end.

The latter is a bit more complicated because we used to compute the stack size
in the getStackAddress method, based on the Size and Offset of the parameters.
However, if the last parameter is sign extended, we'd be using the wrong,
non-extended size, and we'd end up with a smaller stack than we need to hold the
extended value. Instead of hacking this up based on the value of Size in
getStackAddress, we move our stack size handling logic to assignArg, where we
have access to the CCState which knows everything we could possibly want to know
about the stack. This way we don't need to duplicate any knowledge or resort to
any ugly hacks.

On this same occasion, update the IRTranslator test to check the sizes of the
stores everywhere, not just for sign extended paramteres.

llvm-svn: 296631
2017-03-01 15:35:14 +00:00
Sanjay Patel 88a1b8b466 [x86] auto-generate checks; NFC
llvm-svn: 296629
2017-03-01 14:46:59 +00:00
Sanjay Patel f0496a6a5c [x86] regenerate checks; NFC
llvm-svn: 296628
2017-03-01 14:41:57 +00:00
Alexander Kornienko 36267277d7 [clang-tidy] Attempt to fix the test where exceptions are disabled by default.
llvm-svn: 296627
2017-03-01 14:41:11 +00:00
Igor Laevsky b40152d5d1 [DeadStoreElimination] Check function modref behavior before considering memory clobbered
Differential Revision: https://reviews.llvm.org/D29996

llvm-svn: 296625
2017-03-01 14:38:29 +00:00
Simon Dardis fc261240b2 [mips] Drop unneeded REQUIRES line in test. NFCI
rL296111 provides the proper fix.

llvm-svn: 296622
2017-03-01 14:31:09 +00:00
Sanjay Patel ffc6943011 [PPC] add tests for select-of-constants with binop; NFC
llvm-svn: 296621
2017-03-01 14:26:49 +00:00
Rafael Espindola bedccb5e78 Simplify. NFC.
llvm-svn: 296620
2017-03-01 14:21:31 +00:00
Rafael Espindola bd12e2a0ce Simplify. NFC.
llvm-svn: 296619
2017-03-01 14:12:21 +00:00
Krasimir Georgiev 90573e49c9 [clangd] Add a toy VS Code integration for development purposes
Summary: This patch adds bare-bone VS Code integration for development purposes of clangd.

Reviewers: klimek, bkramer, mprobst

Reviewed By: bkramer

Subscribers: mprobst

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

llvm-svn: 296618
2017-03-01 13:53:12 +00:00
Igor Laevsky 37cba43604 [BasicAA] Take attributes into account when requesting modref info for a call site
Differential Revision: https://reviews.llvm.org/D29989

llvm-svn: 296617
2017-03-01 13:19:51 +00:00
Eric Liu 9e745b7292 Introducing clang::tooling::AtomicChange for refactoring tools.
Summary:
An AtomicChange is used to create and group a set of source edits, e.g.
replacements or header insertions. Edits in an AtomicChange should be related,
e.g. replacements for the same type reference and the corresponding header
insertion/deletion.

An AtomicChange is uniquely identified by a key position and will either be
fully applied or not applied at all. The key position should be the location
of the key syntactical element that is being changed, e.g. the call to a
refactored method.

Next step: add a tool that applies AtomicChange.

Reviewers: klimek, djasper

Reviewed By: klimek

Subscribers: alexshap, cfe-commits, djasper, mgorny

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

llvm-svn: 296616
2017-03-01 13:14:01 +00:00
Alexey Bataev 4a45efa431 [SLP] Preserve IR flags when vectorizing horizontal reductions.
Summary:
The SLP vectorizer should propagate IR-level optimization hints/flags
(nsw, nuw, exact, fast-math) when converting scalar horizontal
reductions instructions into vectors, just like for other vectorized
instructions.
It doe not include IR propagation for extra arguments, we need to handle
original scalar operations for extra args to propagate correct flags.

Reviewers: mkuper, mzolotukhin, hfinkel

Subscribers: llvm-commits

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

llvm-svn: 296614
2017-03-01 12:43:39 +00:00
Alexey Bataev 74e5a36856 [SLP] Preserve IR flags for extra args.
Summary:
We should preserve IR flags for extra args. These IR flags should be
taken from original scalar operations, not from the reduction
operations.

Reviewers: mkuper, mzolotukhin, hfinkel

Subscribers: llvm-commits

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

llvm-svn: 296613
2017-03-01 12:22:33 +00:00
Ranjeet Singh ef6e672d04 [libcxxabi] Clean up macro usage.
Convention in libcxxabi is to use !defined(FOO) not !FOO.

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

llvm-svn: 296612
2017-03-01 11:42:01 +00:00
Pavel Labath a53823effd Mark TestYMMRegister as no_debug_info_test
We don't need to run this test multiple times to check whether we can
read a register.

llvm-svn: 296611
2017-03-01 11:18:59 +00:00
Oliver Stannard 9c199aaf47 [ARM] Fix bash-ism in test
llvm-svn: 296610
2017-03-01 11:11:06 +00:00
George Rimar efc31dd9bb [ELF] - Reset output section size when assigning offsets.
In many places we reset Size to 0 before calling assignOffsets()
manually. Sometimes we don't do that. 
It looks we can just always do that inside.

Previous code had:
template <class ELFT> void OutputSection::assignOffsets() {
  uint64_t Off = Size;

And tests feels fine with Off = 0. 
I think Off = Size make no sence.

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

llvm-svn: 296609
2017-03-01 11:10:53 +00:00
Daniel Jasper 62703eb8a7 Fix r296605 so that stuff in #ifndef SWIG blocks is still formatted.
llvm-svn: 296608
2017-03-01 11:10:11 +00:00
Oliver Stannard 5d35b9e56c [ARM] Fix parsing of special register masks
This parsing code was incorrectly checking for invalid characters, so an
invalid instruction like:
  msr spsr_w, r0
would be emitted as:
  msr spsr_cxsf, r0

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

llvm-svn: 296607
2017-03-01 10:51:04 +00:00
Alexey Bataev dfec81107f [SLP] Fix for PR32038: extra add of PHI node when it is not required.
Summary:
If horizontal reduction tree starts from the binary operation that is
used in PHI node, but this PHI is not used in horizontal reduction, we
may end up with extra addition of this PHI node after vectorization.
Here is an example:
```
%phi = phi i32 [ %tmp, %end], ...
...
%tmp = add i32 %tmp1, %tmp2
end:
```
after vectorization we always have something like:

```
%phi = phi i32 [ %tmp, %end], ...
...
%red = extractelement <8 x 32> %vec.red, 0
%tmp = add i32 %red, %phi
end:
```
even if `%phi` is not used in reduction tree. Patch considers these PHI
nodes as extra arguments and considers them in the final result iff they
really used in reduction.

Reviewers: mkuper, hfinkel, mzolotukhin

Subscribers: llvm-commits

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

llvm-svn: 296606
2017-03-01 10:50:44 +00:00
Daniel Jasper eab6cd474c clang-format: Ignore contents of #ifdef SWIG .. #endif blocks.
Those blocks are used if C++ code is SWIG-wrapped (see swig.org) and
usually do not contain C++ code. Also cleanup the implementation of for #if 0
and #if false a bit.

llvm-svn: 296605
2017-03-01 10:47:52 +00:00
Eric Liu 413671507f [change-namespace] get insertion points of forward declarations correct.
Summary:
Previously, the insertion points would conflict with the old namespace
deletion.

Reviewers: hokein

Reviewed By: hokein

Subscribers: cfe-commits

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

llvm-svn: 296604
2017-03-01 10:29:39 +00:00
Malcolm Parsons ded2306208 [Sema] Improve side effect checking for unused-lambda-capture warning
Summary:
Don't warn about unused lambda captures that involve copying a
value of a type that cannot be trivially copied and destroyed.

Fixes PR31977

Reviewers: rsmith, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 296602
2017-03-01 10:23:38 +00:00
Ayman Musa 9b802e4650 [X86] Fix creating vreg def after use.
llvm-svn: 296601
2017-03-01 10:20:48 +00:00
Alexander Kornienko 9108644dbf [clang-tidy] Add parametercount for readibility-function-size
Summary:
Add an option to function-size to warn about high parameter counts.

This might be relevant for cppcoreguidelines and the safety module as well. Since the safety module is not landed in master already, i did not create an alias, but that can be done later as well.

Reviewers: sbenza, alexfh, hokein

Reviewed By: alexfh, hokein

Subscribers: JDevlieghere

Patch by Jonas Toth!

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

llvm-svn: 296599
2017-03-01 10:17:32 +00:00
Alexander Kornienko eedf7ec07f [clang-tidy] Fix handling of methods with try-statement as a body in modernize-use-override
Summary:
Fix generated by modernize-use-override caused syntax error when method
used try-statement as a body. `override` keyword was inserted after last
declaration token which happened to be a `try` keyword.

This fixes PR27119.

Reviewers: ehsan, djasper, alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, cfe-commits

Tags: #clang-tools-extra

Patch by Paweł Żukowski!

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

llvm-svn: 296598
2017-03-01 10:16:36 +00:00
George Rimar c84ca256d3 [ELF] - Fixed crash in GnuHashTableSection.
r296570 intorduced crash revealed by 
gnu-hash-table.s which crashed for me.

Reason was use of uninitialized NBuckets variable.

llvm-svn: 296597
2017-03-01 10:12:49 +00:00
Pavel Labath e2b2c70bc1 Fix gcc compilation of LogTest.cpp
llvm-svn: 296595
2017-03-01 10:08:51 +00:00
Pavel Labath c5789434ff Switch SBBreakpointLocation to use a weak_ptr
llvm-svn: 296594
2017-03-01 10:08:48 +00:00
Pavel Labath 197b65c7b8 test: pass correct objcopy and ar paths to the test runner
Summary:
The test runner has code to autodetect this, but it's not very smart --
in particular, it fails in the case where we build the test executables
with the just-built clang. Since cmake already has the knowledge about
the right toolchain, we can just have it pass the appropriate flags to
the test runner.

This also removes the "temporary" cache-scrubbing hack added a couple
months ago.

Reviewers: zturner, beanz

Subscribers: mgorny, lldb-commits

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

llvm-svn: 296593
2017-03-01 10:08:44 +00:00
Pavel Labath 5e336903be Modernize Enable/DisableLogChannel interface a bit
Summary:
Use StringRef and ArrayRef where possible. This adds an accessor to the
Args class to get a view of the arguments as ArrayRef<const char *>.

Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 296592
2017-03-01 10:08:40 +00:00
Serge Pavlov 9c761a36b9 Process tilde in llvm::sys::path::native
Windows does not treat `~` as a reference to home directory, so the call
to `llvm::sys::path::native` on, say, `~/somedir` produces `~\somedir`,
which has different meaning than the original path. With this change
tilde is expanded on Windows to user profile directory. Such behavior
keeps original meaning of the path and is consistent with the algorithm
of `llvm::sys::path::home_directory`.

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

llvm-svn: 296590
2017-03-01 09:38:15 +00:00
Rui Ueyama 6e50fd53d4 Instead of passing an empty ArrayRef as contents, pass actual contents. NFC.
llvm-svn: 296586
2017-03-01 07:39:06 +00:00
Mikael Holmen 760dc9aba7 Remove sometimes faulty rewrite of memcpy in instcombine.
Summary:
Solves PR 31990.

The bad rewrite could replace a memcpy of one word with
 store i4 -1
while it should actually be
 store i8 -1

Hopefully opt and llc has improved enough so the original optimization
done by the code isn't needed anymore.

One already existing testcase is affected. It originally tested that
the memcpy was replaced with
 load double
but since we now remove that rewrite it will be
 load i64
instead.

Patch suggestion by Eli Friedman.

Reviewers: eli.friedman, majnemer, efriedma

Reviewed By: efriedma

Subscribers: efriedma, llvm-commits

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

llvm-svn: 296585
2017-03-01 06:45:20 +00:00
Akira Hatanaka 7cbbb88f23 [Sema] Add variable captured by a block to the enclosing lambda's
potential capture list.

Fix Sema::getCurLambda() to return the innermost lambda scope when there
is a block enclosed in the lambda. Previously, the method would return a
nullptr in such cases, which would prevent a variable captured by the
enclosed block to be added to the lambda scope's potential capture list.

rdar://problem/28412462

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

llvm-svn: 296584
2017-03-01 06:11:25 +00:00
NAKAMURA Takumi 1a1d959423 (Rewroking r296581) PDB/BinaryStreamTest.cpp: Appease mingw to avoid std::errc::no_buffer_space.
Unfortunately, mingw's libstdc++ doesn't provide winsock2 errors.
That said, we should avoid raising OS-oriented error code in our code.

For now, I suggest to define custom error from std::error_category.
See also; https://reviews.llvm.org/D20592

llvm-svn: 296583
2017-03-01 05:11:41 +00:00
NAKAMURA Takumi 4913a7921e Revert r296581, "PDB/BinaryStreamTest.cpp: Appease mingw to avoid std::errc::no_buffer_space."
Wrong commit -- I have unstaged changes.

llvm-svn: 296582
2017-03-01 05:11:37 +00:00
NAKAMURA Takumi 623ab91b53 PDB/BinaryStreamTest.cpp: Appease mingw to avoid std::errc::no_buffer_space.
Unfortunately, mingw's libstdc++ doesn't provide winsock2 errors.
That said, we should avoid raising OS-oriented error code in our code.

For now, I suggest to define custom error from std::error_category.
See also; https://reviews.llvm.org/D20592

llvm-svn: 296581
2017-03-01 05:06:31 +00:00