Sam Kolton [Fri, 26 May 2017 15:52:00 +0000 (15:52 +0000)]
[AMDGPU] SDWA: add disassembler support for GFX9
Summary: Added decoder methods and tests
Reviewers: vpykhtin, artem.tamazov, dp
Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye
Differential Revision: https://reviews.llvm.org/D33545
llvm-svn: 303999
Kostya Kortchinsky [Fri, 26 May 2017 15:39:22 +0000 (15:39 +0000)]
[scudo] Check the return values of the pthread_* functions
Summary:
Currently we are not enforcing the success of `pthread_once`, and
`pthread_setspecific`. Errors could lead to harder to debug issues later in
the thread's life. This adds checks for a 0 return value for both.
If `pthread_setspecific` fails in the teardown path, opt for an immediate
teardown as opposed to a fatal failure.
Reviewers: alekseyshl, kcc
Reviewed By: alekseyshl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D33555
llvm-svn: 303998
Sanjay Patel [Fri, 26 May 2017 15:33:18 +0000 (15:33 +0000)]
[DAGCombiner] use narrow vector ops to eliminate concat/extract (PR32790)
In the best case:
extract (binop (concat X1, X2), (concat Y1, Y2)), N --> binop XN, YN
...we kill all of the extract/concat and just have narrow binops remaining.
If only one of the binop operands is amenable, this transform is still
worthwhile because we kill some of the extract/concat.
Optional bitcasting makes the code more complicated, but there doesn't
seem to be a way to avoid that.
The TODO about extending to more than bitwise logic is there because we really
will regress several x86 tests including madd, psad, and even a plain
integer-multiply-by-2 or shift-left-by-1. I don't think there's anything
fundamentally wrong with this patch that would cause those regressions; those
folds are just missing or brittle.
If we extend to more binops, I found that this patch will fire on at least one
non-x86 regression test. There's an ARM NEON test in
test/CodeGen/ARM/coalesce-subregs.ll with a pattern like:
t5: v2f32 = vector_shuffle<0,3> t2, t4
t6: v1i64 = bitcast t5
t8: v1i64 = BUILD_VECTOR Constant:i64<0>
t9: v2i64 = concat_vectors t6, t8
t10: v4f32 = bitcast t9
t12: v4f32 = fmul t11, t10
t13: v2i64 = bitcast t12
t16: v1i64 = extract_subvector t13, Constant:i32<0>
There was no functional change in the codegen from this transform from what I
could see though.
For the x86 test changes:
1. PR32790() is the closest call. We don't reduce the AVX1 instruction count in that case,
but we improve throughput. Also, on a core like Jaguar that double-pumps 256-bit ops,
there's an unseen win because two 128-bit ops have the same cost as the wider 256-bit op.
SSE/AVX2/AXV512 are not affected which is expected because only AVX1 has the extract/concat
ops to match the pattern.
2. do_not_use_256bit_op() is the best case. Everyone wins by avoiding the concat/extract.
Related bug for IR filed as: https://bugs.llvm.org/show_bug.cgi?id=33026
3. The SSE diffs in vector-trunc-math.ll are just scheduling/RA, so nothing real AFAICT.
4. The AVX1 diffs in vector-tzcnt-256.ll are all the same pattern: we reduced the instruction
count by one in each case by eliminating two insert/extract while adding one narrower logic op.
https://bugs.llvm.org/show_bug.cgi?id=32790
Differential Revision: https://reviews.llvm.org/D33137
llvm-svn: 303997
Renato Golin [Fri, 26 May 2017 15:32:45 +0000 (15:32 +0000)]
Revert "[OpenCL] An error shall occur if any scalar operand has greater rank than the type of the vector element"
This reverts commit r303986 as it broke all ARM and AArch64 buildbots...
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-39vma/builds/7007
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/6705
http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/7509
etc.
llvm-svn: 303996
Alex Shlyapnikov [Fri, 26 May 2017 14:49:42 +0000 (14:49 +0000)]
[asan] Enable back some ASan tests disabled on PowerPC.
Summary:
D33521 addressed a memory ordering issue in BlockingMutex, which seems
to be the cause of a flakiness of a few ASan tests on PowerPC.
Reviewers: eugenis
Subscribers: kubamracek, nemanjai, llvm-commits
Differential Revision: https://reviews.llvm.org/D33569
llvm-svn: 303995
Nirav Dave [Fri, 26 May 2017 14:37:27 +0000 (14:37 +0000)]
[DAG] Move legal type checks in store merge to be checked only
on non-legal cases. NFC.
llvm-svn: 303994
Ilya Biryukov [Fri, 26 May 2017 14:34:34 +0000 (14:34 +0000)]
[clangd] Attempt to fix tests failing on Windows
llvm-svn: 303993
Ravitheja Addepally [Fri, 26 May 2017 14:26:14 +0000 (14:26 +0000)]
Fixing Memory Leak
llvm-svn: 303991
John Brawn [Fri, 26 May 2017 13:59:12 +0000 (13:59 +0000)]
[ARM] Fix lowering of misaligned memcpy/memset
Currently getOptimalMemOpType returns i32 for large enough sizes without
checking for alignment, leading to poor code generation when misaligned accesses
aren't permitted as we generate a word store then later split it up into byte
stores. This means we inadvertantly go over the MaxStoresPerMemcpy limit and for
memset we splat the memset value into a word then immediately split it up
again.
Fix this by leaving it up to FindOptimalMemOpLowering to figure out which type
to use, but also fix a bug there where it wasn't correctly checking if
misaligned memory accesses are allowed.
Differential Revision: https://reviews.llvm.org/D33442
llvm-svn: 303990
Amaury Sechet [Fri, 26 May 2017 13:56:54 +0000 (13:56 +0000)]
nits in wide-integer-cmp.ll . NFC
llvm-svn: 303989
Pavel Labath [Fri, 26 May 2017 13:53:39 +0000 (13:53 +0000)]
Fix 32-bit builds
r303972 used GetValueForKeyAsInteger with mismatched types (e.g.
instantiating with uint64_t, but passing a size_t argument), which
manifested itself on 32-bit architectures.
The intended usage of these functions was to not specify the type
explicitly, and let the compiler figure that out, so switch to that kind
of usage instead.
llvm-svn: 303988
John Brawn [Fri, 26 May 2017 13:52:36 +0000 (13:52 +0000)]
[ARM] Add tests for 6-M memcpy/memset code generation
Differential Revision: https://reviews.llvm.org/D33495
llvm-svn: 303987
Egor Churaev [Fri, 26 May 2017 13:30:26 +0000 (13:30 +0000)]
[OpenCL] An error shall occur if any scalar operand has greater rank than the type of the vector element
Reviewers: Anastasia
Reviewed By: Anastasia
Subscribers: cfe-commits, bader, yaxunl
Differential Revision: https://reviews.llvm.org/D33353
llvm-svn: 303986
Andrew V. Tischenko [Fri, 26 May 2017 13:23:34 +0000 (13:23 +0000)]
The fix for PR22004: X86AsmParser.cpp asserts: OperandStack.size() > 1 && "Too few operands."
llvm-svn: 303985
George Rimar [Fri, 26 May 2017 13:20:09 +0000 (13:20 +0000)]
Revert "[DWARF] - Make collectAddressRanges() return section index in addition to Low/High PC"
Broked BB again:
TEST 'LLVM :: DebugInfo/X86/dbg-value-regmask-clobber.ll' FAILED
...
LLVM ERROR: Section was outside of section table.
llvm-svn: 303984
George Rimar [Fri, 26 May 2017 13:13:50 +0000 (13:13 +0000)]
Recommit r303978 "[DWARF] - Make collectAddressRanges() return section index in addition to Low/High PC"
With fix of test compilation.
Initial commit message:
This change is intended to use for LLD in D33183.
Problem we have in LLD when building .gdb_index is that we need to know section
which address range belongs to.
Previously it was solved on LLD side by providing fake section addresses
with use of llvm::LoadedObjectInfo interface. We assigned file offsets as addressed.
Then after obtaining ranges lists, for each range we had to find section ID's.
That not only was slow, but also complicated implementation and was the reason
of incorrect behavior when
sections share the same offsets, like D33176 shows.
This patch makes DWARF parsers to return section index as well.
That solves problem mentioned above.
Differential revision: https://reviews.llvm.org/D33184
llvm-svn: 303983
Siddharth Bhat [Fri, 26 May 2017 12:56:35 +0000 (12:56 +0000)]
[Docs] Fix exception name being caught in case ReadTheDocs does not exist.
The exception is `ImportError`, not `ModuleNotFoundError`.
llvm-svn: 303982
George Rimar [Fri, 26 May 2017 12:53:41 +0000 (12:53 +0000)]
Revert r303978 "[DWARF] - Make collectAddressRanges() return section index in addition to Low/High PC"
It failed BB.
llvm-svn: 303981
Nirav Dave [Fri, 26 May 2017 12:53:10 +0000 (12:53 +0000)]
Fix signedness of constant. NFC.
llvm-svn: 303980
Roger Ferrer Ibanez [Fri, 26 May 2017 12:51:12 +0000 (12:51 +0000)]
Export the required symbol from DynamicLibraryTests
Running unittests/Support/DynamicLibrary/DynamicLibraryTests fails when LLVM is
configured with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON, because the test's version
script only contains symbols extracted from the static libraries, that the test
links with, but not those from the main object/executable itself. The patch
explicitly exports the one symbol needed by the test.
This change fixes https://bugs.llvm.org/show_bug.cgi?id=32893
Patch authored by Momchil Velikov.
Differential Revision: https://reviews.llvm.org/D33490
llvm-svn: 303979
George Rimar [Fri, 26 May 2017 12:46:41 +0000 (12:46 +0000)]
[DWARF] - Make collectAddressRanges() return section index in addition to Low/High PC
This change is intended to use for LLD in D33183.
Problem we have in LLD when building .gdb_index is that we need to know section
which address range belongs to.
Previously it was solved on LLD side by providing fake section addresses
with use of llvm::LoadedObjectInfo interface. We assigned file offsets as addressed.
Then after obtaining ranges lists, for each range we had to find section ID's.
That not only was slow, but also complicated implementation and was the reason
of incorrect behavior when
sections share the same offsets, like D33176 shows.
This patch makes DWARF parsers to return section index as well.
That solves problem mentioned above.
Differential revision: https://reviews.llvm.org/D33184
llvm-svn: 303978
Ilya Biryukov [Fri, 26 May 2017 12:26:51 +0000 (12:26 +0000)]
[clangd] Allow to use vfs::FileSystem for file accesses.
Summary:
Custom vfs::FileSystem is currently used for unit tests.
This revision depends on https://reviews.llvm.org/D33397.
Reviewers: bkramer, krasimir
Reviewed By: bkramer, krasimir
Subscribers: klimek, cfe-commits, mgorny
Differential Revision: https://reviews.llvm.org/D33416
llvm-svn: 303977
George Rimar [Fri, 26 May 2017 12:16:39 +0000 (12:16 +0000)]
[ELF] - Follow up for r303975. NFCi.
Restore bitwise-or order and fix warning
(was changed by mistake during resolve of conflicts).
llvm-svn: 303976
George Rimar [Fri, 26 May 2017 12:09:26 +0000 (12:09 +0000)]
[ELF] - Do not produce duplicate values in .gdb_index's constant pool area.
I found this when builded llc binary using gcc 5.4.1 + LLD.
gcc produces duplicate entries in .debug_gnu_pubtypes section, ex:
UnifyFunctionExitNodes.cpp.o has:
0x0000ac07 EXTERNAL TYPE "std::success_type<void*>"
0x0000ac07 EXTERNAL TYPE "std::success_type<void*>"
clang produces single entry here:
0x0000d291 EXTERNAL TYPE "std::__success_type<void *>"
If we link output from gcc with LLD, that would produce excessive duplicate
entries in .gdb_index constant pool area. That does not seem affect gdb work,
but makes .gdb_index larger than it can be.
I also checked that gold filters out such duplicates too. Patch fixes it.
Differential revision: https://reviews.llvm.org/D32647
llvm-svn: 303975
Daniel Jasper [Fri, 26 May 2017 12:07:12 +0000 (12:07 +0000)]
Remove unnecessary double-assignment triggering -Wsequence-point.
llvm-svn: 303974
George Rimar [Fri, 26 May 2017 12:01:40 +0000 (12:01 +0000)]
[ELF] - Simplify implementation of constant pool when building .gdb_index
https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html says:
"A CU vector in the constant pool is a sequence of offset_type values.
The first value is the number of CU indices in the vector.
Each subsequent value is the index and symbol attributes of a CU in the CU list."
Previously we keeped 2 values until the end, what was useless.
Initially was a part of D32647, though it is possible to split out.
Patch do that.
Differential revision: https://reviews.llvm.org/D33551
llvm-svn: 303973
Ravitheja Addepally [Fri, 26 May 2017 11:46:27 +0000 (11:46 +0000)]
Implementation of remote packets for Trace data.
Summary:
The changes consist of new packets for trace manipulation and
trace collection. The new packets are also documented. The packets
are capable of providing custom trace specific parameters to start
tracing and also retrieve such configuration from the server.
Reviewers: clayborg, lldb-commits, tberghammer, labath, zturner
Reviewed By: clayborg, labath
Subscribers: krytarowski, lldb-commits
Differential Revision: https://reviews.llvm.org/D32585
llvm-svn: 303972
Max Kazantsev [Fri, 26 May 2017 06:47:04 +0000 (06:47 +0000)]
Re-enable "[SCEV] Do not fold dominated SCEVUnknown into AddRecExpr start"
The patch rL303730 was reverted because test lsr-expand-quadratic.ll failed on
many non-X86 configs with this patch. The reason of this is that the patch
makes a correctless fix that changes optimizer's behavior for this test.
Without the change, LSR was making an overconfident simplification basing on a
wrong SCEV. Apparently it did not need the IV analysis to do this. With the
change, it chose a different way to simplify (that wasn't so confident), and
this way required the IV analysis. Now, following the right execution path,
LSR tries to make a transformation relying on IV Users analysis. This analysis
is target-dependent due to this code:
// LSR is not APInt clean, do not touch integers bigger than 64-bits.
// Also avoid creating IVs of non-native types. For example, we don't want a
// 64-bit IV in 32-bit code just because the loop has one 64-bit cast.
uint64_t Width = SE->getTypeSizeInBits(I->getType());
if (Width > 64 || !DL.isLegalInteger(Width))
return false;
To make a proper transformation in this test case, the type i32 needs to be
legal for the specified data layout. When the test runs on some non-X86
configuration (e.g. pure ARM 64), opt gets confused by the specified target
and does not use it, rejecting the specified data layout as well. Instead,
it uses some default layout that does not treat i32 as a legal type
(currently the layout that is used when it is not specified does not have
legal types at all). As result, the transformation we expect to happen does
not happen for this test.
This re-enabling patch does not have any source code changes compared to the
original patch rL303730. The only difference is that the failing test is
moved to X86 directory and now has requirement of running on x86 only to comply
with the specified target triple and data layout.
Differential Revision: https://reviews.llvm.org/D33543
llvm-svn: 303971
Matthias Braun [Fri, 26 May 2017 06:32:31 +0000 (06:32 +0000)]
LivePhysRegs: Skip reserved regs in computeLiveIns; NFCI
Re-commit r303937 + r303949 as they were not the cause for the build
failures.
We do not track liveness of reserved registers so adding them to the
liveins list in computeLiveIns() was completely unnecessary.
llvm-svn: 303970
Wei Mi [Fri, 26 May 2017 05:42:50 +0000 (05:42 +0000)]
Revert rL303923 since it broke the sanitizer bootstrap build bot.
llvm-svn: 303969
Craig Topper [Fri, 26 May 2017 05:16:22 +0000 (05:16 +0000)]
[InstSimplify] Use APInt::isMask isntead of manually implementing it. NFC
llvm-svn: 303968
Craig Topper [Fri, 26 May 2017 05:16:20 +0000 (05:16 +0000)]
[InstSimplify] Use m_ConstantInt matchers to short some code. NFC
llvm-svn: 303967
Eric Fiselier [Fri, 26 May 2017 04:09:38 +0000 (04:09 +0000)]
Workaround debug info bug in Clangs coroutine implementation
llvm-svn: 303966
Ed Maste [Fri, 26 May 2017 03:15:46 +0000 (03:15 +0000)]
FreeBSD ProcessMonitor: map TRAP_CAP to a trace trap
In the absense of a more specific handler for TRAP_CAP (generated by
ENOTCAPABLE or ECAPMODE while in capability mode) treat it as a trace
trap. Obtained from FreeBSD r318884.
We should later add an option to have LLDB control the trapcap procctl
(as with ASLR), as well as report a specific stop reason. For now this
change eliminates an assertion failure from LLDB.
llvm-svn: 303965
Chandler Carruth [Fri, 26 May 2017 03:10:00 +0000 (03:10 +0000)]
[IR] Add an iterator and range accessor for the PHI nodes of a basic
block.
This allows writing much more natural and readable range based for loops
directly over the PHI nodes. It also takes advantage of the same tricks
for terminating the sequence as the hand coded versions.
I've replaced one example of this mostly to showcase the difference and
I've added a unit test to make sure the facilities really work the way
they're intended. I want to use this inside of SimpleLoopUnswitch but it
seems generally nice.
Differential Revision: https://reviews.llvm.org/D33533
llvm-svn: 303964
Eric Fiselier [Fri, 26 May 2017 03:02:54 +0000 (03:02 +0000)]
Get <experimental/coroutine> working in C++03.
Clang supports coroutines in all dialects; Therefore libc++ should too,
otherwise the Clang extension is unusable.
I'm not convinced extending support to C++03 is a feasible long term
plan, since as the library grows to offer things like generators it
will be come increasingly difficult to limit the implementation to C++03.
However for the time being supporting C++03 isn't a big deal.
llvm-svn: 303963
George Burgess IV [Fri, 26 May 2017 02:56:51 +0000 (02:56 +0000)]
[docs] Point coroutine link to an actual document
Unsure if there's a better document, but what we had before led to a
404. :)
llvm-svn: 303962
Rui Ueyama [Fri, 26 May 2017 02:27:19 +0000 (02:27 +0000)]
Rearrange code for the sake of readability. NFC.
llvm-svn: 303961
Matthias Braun [Fri, 26 May 2017 02:25:20 +0000 (02:25 +0000)]
Revert "LivePhysRegs: Fix addLiveOutsNoPristines() for return blocks past PEI"
Tentatively revert this to see if it fixes the buildbot stage2
breakages.
This reverts commit r303938.
This reverts commit r303954.
llvm-svn: 303960
Rui Ueyama [Fri, 26 May 2017 02:17:30 +0000 (02:17 +0000)]
Simplify. NFC.
llvm-svn: 303959
Rui Ueyama [Fri, 26 May 2017 02:17:13 +0000 (02:17 +0000)]
Inline a trivial constructor.
llvm-svn: 303958
Tim Northover [Fri, 26 May 2017 02:16:00 +0000 (02:16 +0000)]
Create valid LValue to represent null pointers in constant exprs
We were leaving the SubobjectDesignator in a surprising situation, where
it was allegedly valid but didn't actually refer to a type. This caused
a crash later on.
This patch fills out the SubobjectDesignator with the pointee type (as
happens in other evaluations of constant pointers) so that we don't
crash later.
llvm-svn: 303957
Eric Fiselier [Fri, 26 May 2017 01:52:59 +0000 (01:52 +0000)]
Guard <experimental/coroutine> against older Clang versions.
Clang started providing -fcoroutines and defining __cpp_coroutines
way before it implemented the __builtin_coro_foo functions. This
means that simply checking if __cpp_coroutines is not a sufficient
way of detecting the actual feature.
This patch implements _LIBCPP_HAS_NO_COROUTINES which implements
a slightly more complex feature check. Specifically it requires
__cpp_coroutines >= 201703L, which only holds for Clang 5.0 built
after 2017/05/24.
llvm-svn: 303956
Matthias Braun [Fri, 26 May 2017 01:29:32 +0000 (01:29 +0000)]
Revert "LivePhysRegs: Skip reserved regs in computeLiveIns; NFCI"
Tentatively revert, suspecting that it caused breakage in stage2
buildbots.
This reverts commit r303949.
This reverts commit r303937.
llvm-svn: 303955
Matthias Braun [Fri, 26 May 2017 01:29:25 +0000 (01:29 +0000)]
Test for r303938
llvm-svn: 303954
Eric Fiselier [Fri, 26 May 2017 01:27:08 +0000 (01:27 +0000)]
Remove incorrect #ifdef guards around variant tests.
The tests were previously guarded by #if defined(_LIBCPP_VER) || defined(_MSVC_STL_VER),
which is both incorrect (e.g. _LIBCPP_VERSION) and unneeded. Although the tests are
technically non-standard (yet) they are supported by both libc++ and MSVC's STL.
libstdc++ doesn't regularly use the test suite so I'm not concerned about guarding these
tests for them.
llvm-svn: 303953
Chandler Carruth [Fri, 26 May 2017 01:24:11 +0000 (01:24 +0000)]
[PM] Enable the new simple loop unswitch pass in the new pass manager
(where it is the only realistic option).
This passes the LLVM test suite for me, but I'm clearly still hammering
on this.
llvm-svn: 303952
Casey Carter [Fri, 26 May 2017 01:00:56 +0000 (01:00 +0000)]
[test] Fix breakage from r303947 =(
llvm-svn: 303951
Rui Ueyama [Fri, 26 May 2017 00:58:21 +0000 (00:58 +0000)]
Tidy up RelocVisitor.h.
Summary:
RelocVisitor had too many, too small functions. This patch group them
by architecture rather than each relocation type.
Reviewers: grimar, dblaikie
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D33580
llvm-svn: 303950
Matthias Braun [Fri, 26 May 2017 00:54:24 +0000 (00:54 +0000)]
LivePhysRegs: Follow-up to r303937
We may have situations in which a superregister is reserved and not
added to liveins, so we have to add the subregisters.
llvm-svn: 303949
Rafael Espindola [Fri, 26 May 2017 00:37:39 +0000 (00:37 +0000)]
Remove dummy cast. NFC.
llvm-svn: 303948
Casey Carter [Fri, 26 May 2017 00:37:33 +0000 (00:37 +0000)]
[test] make_shared<T()>(...) is, uh, libc++-specific
llvm-svn: 303947
Zachary Turner [Fri, 26 May 2017 00:15:15 +0000 (00:15 +0000)]
[llvm-pdbdump] Don't crash when displaying padding.
We have a lot of complicated logic to determine where padding
is in a record, and the debug info doesn't always provide enough
information to figure it out with laser precision. In this case
we were putting the padding in the wrong place causing an
out of bounds access on a BitVector.
Right now we decide that any trailing padding of a child type
will be truncated during record layout, but this is only true
insofar as the class still is sized properly to end on an
alignment boundary, which the algorithm doesn't yet know about.
For now, just don't crash, even though we display padding twice
in this case.
llvm-svn: 303946
Richard Smith [Fri, 26 May 2017 00:01:53 +0000 (00:01 +0000)]
Factor resolving of header directives -> files out of module map parser.
llvm-svn: 303945
Eugene Zelenko [Fri, 26 May 2017 00:00:14 +0000 (00:00 +0000)]
[Examples] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 303944
Dimitry Andric [Thu, 25 May 2017 23:56:44 +0000 (23:56 +0000)]
Return a lit.Test.Result object from TestRunner's executeShTest()
Summary:
For various clang analyzer tests, which were unsupported, I got lit
exceptions, similar to the following:
Exception during script execution:
Traceback (most recent call last):
File "utils/lit/lit/run.py", line 190, in execute_test
result = test.config.test_format.execute(test, lit_config)
File "tools/clang/test/Analysis/analyzer_test.py", line 11, in execute
if result.code == lit.Test.FAIL:
AttributeError: 'tuple' object has no attribute 'code'
This is because executeShTest() in utils/lit/lit/TestRunner.py is
supposed to return a lit.Test.Result object, but in case of unsupported
tests, it returns a plain tuple.
Fix this by returning a properly initialized lit.Test.Result object
instead.
Reviewers: rnk, rafael, modocache
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D33579
llvm-svn: 303943
Zachary Turner [Thu, 25 May 2017 23:47:56 +0000 (23:47 +0000)]
Remove unused member.
llvm-svn: 303942
Vitaly Buka [Thu, 25 May 2017 23:42:33 +0000 (23:42 +0000)]
[compiler-rt] Replace allow_user_segv_handler=0 with kHandleSignalExclusive
Summary:
allow_user_segv_handler had confusing name did not allow to control behavior for
signals separately.
Reviewers: eugenis, alekseyshl, kcc
Subscribers: llvm-commits, dberris, kubamracek
Differential Revision: https://reviews.llvm.org/D33371
llvm-svn: 303941
Tim Shen [Thu, 25 May 2017 23:40:46 +0000 (23:40 +0000)]
[PPC] Add text for assert.
llvm-svn: 303940
Peter Collingbourne [Thu, 25 May 2017 23:40:11 +0000 (23:40 +0000)]
LTO: Do summary-based prevailing symbol resolution at --lto-O0.
Prevailing symbol resolution is necessary for correctness. Without
this we can end up dropping a referenced linkonce symbol from the link.
Differential Revision: https://reviews.llvm.org/D33570
llvm-svn: 303939
Matthias Braun [Thu, 25 May 2017 23:39:40 +0000 (23:39 +0000)]
LivePhysRegs: Fix addLiveOutsNoPristines() for return blocks past PEI
- addLiveOutsNoPristines() needs to add callee saved registers that are
actually saved and restored somewhere to the set (they are not
pristine).
- Cleanup/rewrite the code for addLiveOuts()/addLiveOutsNoPristines().
This fixes the problem from D32156.
Differential Revision: https://reviews.llvm.org/D32464
llvm-svn: 303938
Matthias Braun [Thu, 25 May 2017 23:39:33 +0000 (23:39 +0000)]
LivePhysRegs: Skip reserved regs in computeLiveIns; NFCI
We do not track liveness of reserved registers so adding them to the
liveins list in computeLiveIns() was completely unnecessary.
llvm-svn: 303937
Eric Fiselier [Thu, 25 May 2017 23:39:29 +0000 (23:39 +0000)]
Re-add <experimental/coroutine> to the module map.
The original issues were caused because <experimental/coroutine>
didn't correctly #ifdef out enough of the header, which caused incomplete
types to be used.
This patch fixes the `#if defined(__cpp_coroutines)` guard and re-adds
the headers to the module map.
It also uglifies some incorrectly non-reserved names.
llvm-svn: 303936
Zachary Turner [Thu, 25 May 2017 23:36:16 +0000 (23:36 +0000)]
[CV Type Merging] Find nested type indices faster.
Merging two type streams is one of the most time consuming
parts of generating a PDB, and as such it needs to be as
fast as possible. The visitor abstractions used for interoperating
nicely with many different types of inputs and outputs have
been used widely and help greatly for testability and implementing
tools, but the abstractions build up and get in the way of
performance.
This patch removes all of the visitation stuff from the type
stream merger, essentially re-inventing the leaf / member switch
and loop, but at a very low level. This allows us many other
optimizations, such as not actually deserializing *any* records
(even member records which don't describe their own length), as
the operation of "figure out how long this record is" is somewhat
faster than "figure out how long this record *and* get all its
fields out". Furthermore, whereas before we had to deserialize,
re-write type indices, then re-serialize, now we don't have to
do any of those 3 steps. We just find out where the type indices
are and pull them directly out of the byte stream and re-write
them.
This is worth a 50-60% performance increase. On top of all other
optimizations that have been applied this week, I now get the
following numbers when linking lld.exe and lld.pdb
MSVC: 25.67s
Before This Patch: 18.59s
After This Patch: 8.92s
So this is a huge performance win.
Differential Revision: https://reviews.llvm.org/D33564
llvm-svn: 303935
Richard Trieu [Thu, 25 May 2017 23:25:36 +0000 (23:25 +0000)]
"*" => "+" to avoid matching on empty string.
llvm-svn: 303934
David Blaikie [Thu, 25 May 2017 23:11:28 +0000 (23:11 +0000)]
DebugInfo: Simplify scopes+subprogram handling since the subprogram<>cu link inversion
Previously this code was defensive to the situation in which the debug
info scopes would lead to a different subprogram from the subprogram in
the CU's subprogram list (this could've happened with linkonce
functions, etc as per the comment being removed). Since the CU<>SP link
reversal this is no longer possible.
llvm-svn: 303933
Richard Trieu [Thu, 25 May 2017 23:03:08 +0000 (23:03 +0000)]
Make test/Driver/baremetal.cpp work when output directory isn't named 'bin'.
llvm-svn: 303932
Tim Shen [Thu, 25 May 2017 22:58:35 +0000 (22:58 +0000)]
[PPC] Fix atomics lowering in DAG lowering.
I forgot to forward the chain, causing some missing instruction
dependencies. The test crashes the compiler without this patch.
Inspired by the test case, D33519 also tries to remove the extra sync.
Differential Revision: https://reviews.llvm.org/D33573
llvm-svn: 303931
Richard Smith [Thu, 25 May 2017 22:47:05 +0000 (22:47 +0000)]
Switch from using a DiagnosticTrap and a note for "while defining a special
member function" context notes to registering an entry on the context stack.
Also reorder the steps within defining special members to be consistent.
This has a few benefits: if multiple diagnostics are produced while checking
such a member, the note is now attached to the first such diagnostic rather
than the last, this prepares us for persisting these diagnostics between the
point at which we require the implicit instantiation of a template and the
point at which that instantiation is actually performed, and this fixes some
cases where we would fail to produce a full note stack leading back to user
code in the case of such a diagnostic.
The reordering exposed a case where we could recursively attempt to define a
defaulted destructor while we're already defining one (and other such cases
also appear to be possible, with or without this change), so this change also
reuses the "willHaveBody" flag on function declarations to track that we're in
the middle of synthesizing a body for the function and bails out if we try to
define a function that we're already defining.
llvm-svn: 303930
Eric Fiselier [Thu, 25 May 2017 22:43:42 +0000 (22:43 +0000)]
Correct typo: LIBCXXABI_BUILTINS_LIBRARY -> LIBCXX_BUILTINS_LIBRARY
llvm-svn: 303929
Martell Malone [Thu, 25 May 2017 22:37:15 +0000 (22:37 +0000)]
libcxx: fix bootstrapping for mingw-w64
Differential Revision: https://reviews.llvm.org/D33388
llvm-svn: 303928
David Blaikie [Thu, 25 May 2017 22:10:51 +0000 (22:10 +0000)]
Fix test to handle running on platforms which don't enable pubnames at all
Check that there are no entries in the pub sections, but that they may
either be not present or present-but-empty.
llvm-svn: 303927
Rui Ueyama [Thu, 25 May 2017 22:00:36 +0000 (22:00 +0000)]
When uncompressing sections, remove SHF_COMPRESSED bits. NFC.
In this way, the content and the flag is always consistent, which I
think better than removing the bit when input sections reaches the Writer.
llvm-svn: 303926
Rafael Espindola [Thu, 25 May 2017 21:53:02 +0000 (21:53 +0000)]
Revert "Simplify a variable type by using StringRef instead of CachedHashStringRef."
This reverts commit r303787.
It caused a slowdown in fast links. That is, links with no debug info
or optimizations.
llvm-svn: 303925
Craig Topper [Thu, 25 May 2017 21:51:12 +0000 (21:51 +0000)]
[InstCombine] Add an InstCombine specific wrapper around isKnownToBeAPowerOfTwo to shorten code. NFC
We have wrappers for several other ValueTracking methods that take care of passing all of the analysis and assumption cache parameters. This extends it to isKnownToBeAPowerOfTwo.
llvm-svn: 303924
Wei Mi [Thu, 25 May 2017 21:49:02 +0000 (21:49 +0000)]
[GVN] Add phi-translate support in scalarpre.
Right now scalarpre doesn't have phi-translate support, so it will miss some
simple pre opportunities. Like the following testcase, current scalarpre cannot
recognize the last "a * b" is fully redundent because a and b used by the last
"a * b" expr are both defined by phis.
long a[100], b[100], g1, g2, g3;
__attribute__((pure)) long goo();
void foo(long a, long b, long c, long d) {
g1 = a * b;
if (__builtin_expect(g2 > 3, 0)) {
a = c;
b = d;
g2 = a * b;
}
g3 = a * b; // fully redundant.
}
The patch adds phi-translate support in scalarpre. This is only a temporary
solution before the newpre based on newgvn is available.
Differential Revision: https://reviews.llvm.org/D32252
llvm-svn: 303923
Andrew Kaylor [Thu, 25 May 2017 21:31:00 +0000 (21:31 +0000)]
Add constrained intrinsics for some libm-equivalent operations
Differential revision: https://reviews.llvm.org/D32319
llvm-svn: 303922
Matthias Braun [Thu, 25 May 2017 21:26:32 +0000 (21:26 +0000)]
CodeGen: Rename DEBUG_TYPE to match passnames
Rename the DEBUG_TYPE to match the names of corresponding passes where
it makes sense. Also establish the pattern of simply referencing
DEBUG_TYPE instead of repeating the passname where possible.
llvm-svn: 303921
Zachary Turner [Thu, 25 May 2017 21:16:03 +0000 (21:16 +0000)]
[lld] Fix a bug where we continually re-follow type servers.
Originally this was intended to be set up so that when linking
a PDB which refers to a type server, it would only visit the
PDB once, and on subsequent visitations it would just skip it
since all the records had already been added.
Due to some C++ scoping issues, this was not occurring and it
was revisiting the type server every time, which caused every
record to end up being thrown away on all subsequent visitations.
This doesn't affect the performance of linking clang-cl generated
object files because we don't use type servers, but when linking
object files and libraries generated with /Zi via MSVC, this means
only 1 object file has to be linked instead of N object files, so
the speedup is quite large.
llvm-svn: 303920
Zachary Turner [Thu, 25 May 2017 21:15:37 +0000 (21:15 +0000)]
[CodeView Type Merging] Don't keep re-allocating temp serializer.
Previously, every time we wanted to serialize a field list record, we
would create a new copy of FieldListRecordBuilder, which would in turn
create a temporary instance of TypeSerializer, which itself had a
std::vector<> that was about 128K in size. So this 128K allocation was
happening every time. We can re-use the same instance over and over, we
just have to clear its internal hash table and seen records list between
each run. This saves us from the constant re-allocations.
This is worth an ~18.5% speed increase (3.75s -> 3.05s) in my tests.
Differential Revision: https://reviews.llvm.org/D33506
llvm-svn: 303919
Zachary Turner [Thu, 25 May 2017 21:12:27 +0000 (21:12 +0000)]
Make BinaryStreamReader::readCString a bit faster.
Previously it would do a character by character search for a null
terminator, to account for the fact that an arbitrary stream need not
store its data contiguously so you couldn't just do a memchr. However, the
stream API has a function which will return the longest contiguous chunk
without doing a copy, and by using this function we can do a memchr on the
individual chunks. For certain types of streams like data from object
files etc, this is guaranteed to find the null terminator with only a
single memchr, but even with discontiguous streams such as
MappedBlockStream, it's rare that any given string will cross a block
boundary, so even those will almost always be satisfied with a single
memchr.
This optimization is worth a 10-12% reduction in link time (4.2 seconds ->
3.75 seconds)
Differential Revision: https://reviews.llvm.org/D33503
llvm-svn: 303918
Bob Haarman [Thu, 25 May 2017 21:12:15 +0000 (21:12 +0000)]
[pdb] pad source file name buffer at the end instead of the beginning
Summary:
DbiStreamBuilder calculated the offset of the source file names inside
the file info substream as the size of the file info substream minus
the size of the file names. Since the file info substream is padded to
a multiple of 4 bytes, this caused the first file name to be aligned
on a 4-byte boundary. By contrast, DbiModuleList would read the file
names immediately after the file name offset table, without skipping
to the next 4-byte boundary. This change makes it so that the file
names are written to the location where DbiModuleList expects them,
and puts any necessary padding for the file info substream after the
file names instead of before it.
Reviewers: amccarth, rnk, zturner
Reviewed By: amccarth, zturner
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D33475
llvm-svn: 303917
Zachary Turner [Thu, 25 May 2017 21:12:00 +0000 (21:12 +0000)]
Fix a bug in MappedBlockStream.
It was using the number of blocks of the entire PDB file as the number
of blocks of each stream that was created. This was only an issue in
the readLongestContiguousChunk function, which was never called prior.
This bug surfaced when I updated an algorithm to use this function and
the algorithm broke.
llvm-svn: 303916
Sam Clegg [Thu, 25 May 2017 21:08:07 +0000 (21:08 +0000)]
[WebAssembly] MC: Include unnamed data when writing wasm files
Also, include global entries for all data symbols, not
just external ones, since these are referenced by the
relocation records.
Add a test case that includes unnamed data.
Differential Revision: https://reviews.llvm.org/D33079
llvm-svn: 303915
Zachary Turner [Thu, 25 May 2017 21:06:28 +0000 (21:06 +0000)]
[CodeView Type Merging] Avoid record deserialization when possible.
A profile shows the majority of time doing type merging is spent
deserializing records from sequences of bytes into friendly C++ structures
that we can easily access members of in order to find the type indices to
re-write.
Records are prefixed with their length, however, and most records have
type indices that appear at fixed offsets in the record. For these
records, we can save some cycles by just looking at the right place in the
byte sequence and re-writing the value, then skipping the record in the
type stream. This saves us from the costly deserialization of examining
every field, including potentially null terminated strings which are the
slowest, even though it was unnecessary to begin with.
In addition, we apply another optimization. Previously, after
deserializing a record and re-writing its type indices, we would
unconditionally re-serialize it in order to compute the hash of the
re-written record. This would result in an alloc and memcpy for every
record. If no type indices were re-written, however, this was an
unnecessary allocation. In this patch re-writing is made two phase. The
first phase discovers the indices that need to be rewritten and their new
values. This information is passed through to the de-duplication code,
which only copies and re-writes type indices in the serialized byte
sequence if at least one type index is different.
Some records have type indices which only appear after variable length
strings, or which have lists of type indices, or various other situations
that can make it tricky to make this optimization. While I'm not giving up
on optimizing these cases as well, for now we can get the easy cases out
of the way and lay the groundwork for more complicated cases later.
This patch yields another 50% speedup on top of the already large speedups
submitted over the past 2 days. In two tests I have run, I went from 9
seconds to 3 seconds, and from 16 seconds to 8 seconds.
Differential Revision: https://reviews.llvm.org/D33480
llvm-svn: 303914
Aaron Ballman [Thu, 25 May 2017 21:02:49 +0000 (21:02 +0000)]
Update the getting started documentation to match the corresponding LLVM commit in r303912.
llvm-svn: 303913
Aaron Ballman [Thu, 25 May 2017 21:01:30 +0000 (21:01 +0000)]
Update the documentation and CMake file for Visual Studio generators.
By default, CMake uses a 32-bit toolchain, even when on a 64-bit platform targeting a 64-bit build. However, due to the size of the binaries involved, this can cause linker instabilities (such as the linker running out of memory). Guide people to the correct solution to get CMake to use the native toolchain.
llvm-svn: 303912
Kostya Serebryany [Thu, 25 May 2017 20:50:36 +0000 (20:50 +0000)]
[asan] relax sanbox_read_proc_self_maps_test to pass even if unshare() fails.
llvm-svn: 303911
Hans Wennborg [Thu, 25 May 2017 20:39:52 +0000 (20:39 +0000)]
Make test/Driver/baremetal.cpp pass on Windows
llvm-svn: 303910
Erich Keane [Thu, 25 May 2017 20:29:17 +0000 (20:29 +0000)]
Earlier revert introduced an extra space, remove it.
llvm-svn: 303909
Reid Kleckner [Thu, 25 May 2017 20:28:26 +0000 (20:28 +0000)]
Revert "[AMDGPU] add __builtin_amdgcn_s_getpc"
This reverts commit r303861, the LLVM intrinsic was reverted.
llvm-svn: 303908
Kamil Rytarowski [Thu, 25 May 2017 20:12:30 +0000 (20:12 +0000)]
Fix bug #28898
lldb: libedit produces garbled, unusable input on Linux
Apply patch from Christos Zoulas, upstream libedit developer.
It has been tested on NetBSD/amd64.
New code supports combination of wide libedit and disabled
LLDB_EDITLINE_USE_WCHAR, which was the popular case on Linux
systems.
llvm-svn: 303907
Francis Ricci [Thu, 25 May 2017 19:55:44 +0000 (19:55 +0000)]
Fix typo in tls patch
llvm-svn: 303906
Rui Ueyama [Thu, 25 May 2017 19:49:54 +0000 (19:49 +0000)]
Accept not only --reproduce <foo> but also --reproduce=<foo>.
llvm-svn: 303905
Kyle Butt [Thu, 25 May 2017 19:37:41 +0000 (19:37 +0000)]
PPC: Correct Size for GETtlsADDR
PPC::GETtlsADDR is lowered to a branch and a nop, by the assembly
printer. Its size was incorrectly marked as 4, correct it to 8. The
incorrect size can cause incorrect branch relaxation in
PPCBranchSelector under the right conditions.
llvm-svn: 303904
Adrian Prantl [Thu, 25 May 2017 19:33:16 +0000 (19:33 +0000)]
Add a test for PR33166.
This tests optimized code where a variable is allocated on the
stack for some part of the function.
llvm-svn: 303903
Nico Weber [Thu, 25 May 2017 19:19:29 +0000 (19:19 +0000)]
Revert r303859, CodeGen/AMDGPU/llvm.amdgcn.s.getpc.ll fails on bots.
llvm-svn: 303902
Manoj Gupta [Thu, 25 May 2017 19:07:57 +0000 (19:07 +0000)]
[AArch64]: add 'a' inline asm operand modifier.
Summary:
This is used in the Linux kernel, and effectively just means "print an
address". This brings back r193593.
Reviewed by: Renato Golin
Reviewers: t.p.northover, rengolin, richard.barton.arm, kristof.beyls
Subscribers: aemerson, javed.absar, llvm-commits, eraman
Differential Revision: https://reviews.llvm.org/D33558
llvm-svn: 303901
Eric Fiselier [Thu, 25 May 2017 19:04:55 +0000 (19:04 +0000)]
Update more coroutine_handle signatures to reflect N4663.
Thanks to Casey Carter for pointing out the out-of-date tests and
implementation.
llvm-svn: 303900
Billy Robert O'Neal III [Thu, 25 May 2017 19:01:14 +0000 (19:01 +0000)]
Add asserts that the nullptr is maintained in string erase operations.
llvm-svn: 303899