Roman Lebedev [Tue, 23 Oct 2018 18:27:10 +0000 (18:27 +0000)]
X86DAGToDAGISel::matchBitExtract(): lambdas can't have default arguments.
As reported by ctopper.
That is a gcc-only warning at the moment.
llvm-svn: 345065
George Karpenkov [Tue, 23 Oct 2018 18:24:53 +0000 (18:24 +0000)]
[analyzer] Rename trackNullOrUndefValue to trackExpressionValue
trackNullOrUndefValue is a long and confusing name,
and it does not actually reflect what the function is doing.
Give a function a new name, with a relatively clear semantics.
Also remove some dead code.
Differential Revision: https://reviews.llvm.org/D52758
llvm-svn: 345064
Leonard Chan [Tue, 23 Oct 2018 17:55:35 +0000 (17:55 +0000)]
[Fixed Point Arithmetic] Fixed Point to Boolean Cast
This patch is a part of https://reviews.llvm.org/D48456 in an attempt to split
the casting logic up into smaller patches. This contains the code for casting
from fixed point types to boolean types.
Differential Revision: https://reviews.llvm.org/D53308
llvm-svn: 345063
Rui Ueyama [Tue, 23 Oct 2018 17:52:44 +0000 (17:52 +0000)]
Add a comment.
llvm-svn: 345062
Jonas Devlieghere [Tue, 23 Oct 2018 17:49:51 +0000 (17:49 +0000)]
Skip test with older versions of clang
This was failing for the bots that build with older clangs:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-clang-5.0.2/
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-clang-6.0.1/
llvm-svn: 345061
Simon Pilgrim [Tue, 23 Oct 2018 17:48:30 +0000 (17:48 +0000)]
[LegalizeDAG] Share Vector/Scalar CTLZ Expansion
As suggested on D53258, this patch shares common CTLZ expansion code between VectorLegalizer and SelectionDAGLegalize by putting it in TargetLowering.
Extension to D53474
llvm-svn: 345060
Daniel Sanders [Tue, 23 Oct 2018 17:41:39 +0000 (17:41 +0000)]
Fix MSVC build by correcting placement of declspec after r345056
Going by the MSVC toolchains at godbolt.org, declspec comes after the template<...>.
llvm-svn: 345059
Rui Ueyama [Tue, 23 Oct 2018 17:39:43 +0000 (17:39 +0000)]
Remove a global variable that we can live without.
Out::DebugInfo was used only by GdbIndex class to determine if
we need to create a .gdb_index section, but we can do the same
check without it.
Added a test that this patch doesn't change the existing behavior.
llvm-svn: 345058
Fangrui Song [Tue, 23 Oct 2018 17:24:15 +0000 (17:24 +0000)]
[IR] Fix -Wunused-function after r345052
llvm-svn: 345057
Daniel Sanders [Tue, 23 Oct 2018 17:23:31 +0000 (17:23 +0000)]
[tblgen] Allow FixedLenDecoderEmitter to use APInt-like objects as InsnType
Summary:
Some targets have very long encodings and uint64_t isn't sufficient. uint128_t
isn't portable so such targets need to use an object instead.
There is one catch with this at the moment, no string of bits extracted
from the encoding may exceeed 64-bits. Fields are still permitted to
exceed 64-bits so long as they aren't one contiguous string of bits. If
this proves to be a problem then we can modify the generation of
fieldFromInstruction() calls to account for it but for now I've added an
assertion for this.
InsnType must either be integral or an APInt-like object that must:
* Have a static const max_size_in_bits equal to the number of bits in the encoding.
* be default-constructible and copy-constructible
* be constructible from a uint64_t (this is the key area the interface deviates
from APInt since this constructor does not take the bit width)
* be constructible from an APInt (this can be private)
* be convertible to uint64_t
* Support the ~, &,, ==, !=, and |= operators with other objects of the same type
* Support shift (<<, >>) with signed and unsigned integers on the RHS
* Support put (<<) to raw_ostream&
Reviewers: bogner, charukcs
Subscribers: nhaehnle, llvm-commits
Differential Revision: https://reviews.llvm.org/D52100
llvm-svn: 345056
Zachary Turner [Tue, 23 Oct 2018 17:22:02 +0000 (17:22 +0000)]
Change two methods from const char* to StringRef [NFC].
llvm-svn: 345055
Reid Kleckner [Tue, 23 Oct 2018 17:20:16 +0000 (17:20 +0000)]
[PDB] Fix -Wunused-private-field in DIA
llvm-svn: 345054
Stefan Pintilie [Tue, 23 Oct 2018 17:11:36 +0000 (17:11 +0000)]
[Power9] Add __float128 support in the backend for bitcast to a i128
Add support to allow bit-casting from f128 to i128 and then
extracting 64 bits from the result.
Differential Revision: https://reviews.llvm.org/D49507
llvm-svn: 345053
Sanjay Patel [Tue, 23 Oct 2018 17:06:03 +0000 (17:06 +0000)]
[IR] remove fake binop queries for not/neg
The initial motivation is that we want to remove the
fneg API because that would silently fail if we add
an actual fneg instruction to IR. The same would be
true for the integer ops, so we might as well get rid
of these too.
We have a newer 'match' API that makes checking for
these patterns simpler. It also works with vectors
that may include undef elements in constants.
If any out-of-tree users need updating, they can model
their code changes on these commits:
rL345050
rL345043
rL345042
rL345041
rL345036
rL345030
llvm-svn: 345052
Andrew Savonichev [Tue, 23 Oct 2018 17:05:29 +0000 (17:05 +0000)]
[OpenCL] Remove PIPE_RESERVE_ID_VALID_BIT from opencl-c.h
Summary:
PIPE_RESERVE_ID_VALID_BIT is implementation defined, so lets not keep it in the header.
Previously the topic was discussed here: https://reviews.llvm.org/D32896
Reviewers: Anastasia, yaxunl
Reviewed By: Anastasia
Subscribers: cfe-commits, asavonic, bader
Differential Revision: https://reviews.llvm.org/D52658
llvm-svn: 345051
Sanjay Patel [Tue, 23 Oct 2018 16:54:28 +0000 (16:54 +0000)]
[InstCombine] use 'match' to simplify code
There's probably some vector-with-undef-element pattern
that shows an improvement, so this is probably not quite
'NFC'.
This is the last step towards removing the fake binop
queries for not/neg. Ie, there are no more uses of those
functions in trunk. Fneg should follow.
llvm-svn: 345050
Alexander Kornienko [Tue, 23 Oct 2018 16:48:16 +0000 (16:48 +0000)]
[clang-tidy] Add a separate section for NOLINT(NEXTLINE)? doc.
llvm-svn: 345049
Simon Pilgrim [Tue, 23 Oct 2018 16:45:26 +0000 (16:45 +0000)]
[TTI][X86] Treat SK_Transpose shuffles as SK_PermuteTwoSrc - there's no difference in lowering.
llvm-svn: 345048
Zachary Turner [Tue, 23 Oct 2018 16:37:53 +0000 (16:37 +0000)]
[NativePDB] Add basic support for tag types to the native pdb plugin.
This adds support to LLDB for named types (class, struct, union, and
enum). This is true cross platform support, and hits the PDB file
directly without a dependency on Windows. Tests are added which
compile a program with certain interesting types and then use
load the target in LLDB and use "type lookup -- <TypeName>" to
dump the layout of the type in LLDB without a running process.
Currently only fields are parsed -- we do not parse methods. Also
we don't deal with bitfields or virtual bases correctly. Those
will make good followups.
Differential Revision: https://reviews.llvm.org/D53511
llvm-svn: 345047
Jordan Rupprecht [Tue, 23 Oct 2018 16:35:51 +0000 (16:35 +0000)]
[DebugInfo][GlobalOpt] Fix -debugify for globalopt shrinking globals to booleans.
Summary:
TryToShrinkGlobalToBoolean, when possible, will split store <value> + load <value> into store <bool> + select <bool ? value : 0>. This preserves DebugLoc during that pass.
Fixes PR37959. The test case here is the simplified .ll for:
```
static int foo;
int bar() {
foo = 5;
return foo;
}
```
Reviewers: dblaikie, gbedwell, aprantl
Reviewed By: dblaikie
Subscribers: mehdi_amini, JDevlieghere, dexonsmith, llvm-commits
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D53531
llvm-svn: 345046
Simon Pilgrim [Tue, 23 Oct 2018 16:27:14 +0000 (16:27 +0000)]
[CostModel][X86] Add transpose shuffle cost tests
llvm-svn: 345045
Andrew Savonichev [Tue, 23 Oct 2018 16:13:16 +0000 (16:13 +0000)]
[OpenCL] Add cl_intel_planar_yuv extension
Just adding a preprocessor #define for the extension.
Patch by Alexey Sotkin and Dmitry Sidorov
Phabricator review: https://reviews.llvm.org/D51402
llvm-svn: 345044
Sanjay Patel [Tue, 23 Oct 2018 16:05:09 +0000 (16:05 +0000)]
[WebAssembly] use 'match' to simplify code; NFC
Vector types are not possible here because this code explicitly
checks for a scalar type, but this is another step towards
completely removing the fake binop queries for not/neg/fneg.
llvm-svn: 345043
Sanjay Patel [Tue, 23 Oct 2018 15:55:06 +0000 (15:55 +0000)]
[Reassociate] replace fake binop queries with 'match' API
We need to update this code before introducing an 'fneg' instruction in IR,
so we might as well kill off the integer neg/not queries too.
This is no-functional-change-intended for scalar code and most vector code.
For vectors, we can see that the 'match' API allows for undef elements in
constants, so we optimize those cases better.
Ideally, there would be a test for each code diff, but I don't see evidence
of that for the existing code, so I didn't try very hard to come up with new
vector tests for each code change.
Differential Revision: https://reviews.llvm.org/D53533
llvm-svn: 345042
Sanjay Patel [Tue, 23 Oct 2018 15:46:10 +0000 (15:46 +0000)]
[SelectionDAG] use 'match' to simplify code; NFC
Vector types are not possible here because this code only starts
matching from the scalar bool value of a conditional branch, but
this is another step towards completely removing the fake binop
queries for not/neg/fneg.
llvm-svn: 345041
Benjamin Kramer [Tue, 23 Oct 2018 15:43:36 +0000 (15:43 +0000)]
[LegalizeDAG] Remove unused variable
llvm-svn: 345040
Simon Pilgrim [Tue, 23 Oct 2018 15:37:19 +0000 (15:37 +0000)]
[LegalizeDAG] Share Vector/Scalar CTTZ Expansion
As suggested on D53258, this patch demonstrates sharing common CTTZ expansion code between VectorLegalizer and SelectionDAGLegalize by putting it in TargetLowering.
I intend to move CTLZ and (scalar) CTPOP over as well and then update D53258 accordingly.
Differential Revision: https://reviews.llvm.org/D53474
llvm-svn: 345039
Andrew Savonichev [Tue, 23 Oct 2018 15:19:20 +0000 (15:19 +0000)]
[OpenCL][NFC] Unify ZeroToOCL* cast types
Reviewers: Anastasia, yaxunl
Reviewed By: Anastasia
Subscribers: asavonic, cfe-commits
Differential Revision: https://reviews.llvm.org/D52654
llvm-svn: 345038
Simon Pilgrim [Tue, 23 Oct 2018 15:13:09 +0000 (15:13 +0000)]
[SLPVectorizer] Add basic support for mul/and/or/xor horizontal reductions
Expand arithmetic reduction to include mul/and/or/xor instructions.
This patch just fixes the SLPVectorizer - the effective reduction costs for AVX1+ are still poor (see rL344846) and will need to be improved before SLP sees this as a valid transform - but we can already see the effect on SSE2 tests.
This partially helps PR37731, but doesn't fix it all as it still falls over on the extraction/reduction order for some reason.
Differential Revision: https://reviews.llvm.org/D53473
llvm-svn: 345037
Sanjay Patel [Tue, 23 Oct 2018 15:05:12 +0000 (15:05 +0000)]
[InstCombine] use 'match' to handle vectors and simplify code
This is another step towards completely removing the fake
binop queries for not/neg/fneg.
llvm-svn: 345036
Samuel Benzaquen [Tue, 23 Oct 2018 14:49:27 +0000 (14:49 +0000)]
Add benchmark for std::set.
Summary:
Benchmarks for construct, find, insert and iterate, with sequential
and random ordered inputs.
It also improves the cartesian product benchmark header to allow for
runtime values to be specified in the product.
Reviewers: EricWF
Subscribers: christof, ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D53523
llvm-svn: 345035
Sanjay Patel [Tue, 23 Oct 2018 14:43:31 +0000 (14:43 +0000)]
[InstCombine] swap select profile metadata when swapping select ops
llvm-svn: 345034
Sanjay Patel [Tue, 23 Oct 2018 14:37:29 +0000 (14:37 +0000)]
[InstCombine] add/move tests for select with inverted condition; NFC
The transform is broken in 2 ways - it doesn't correct metadata (or even drop it),
and it doesn't work with vectors with undef elements.
llvm-svn: 345033
Aleksandr Urakov [Tue, 23 Oct 2018 14:27:45 +0000 (14:27 +0000)]
Revert "[MachinePipeliner] Split MachinePipeliner code into header and cpp files"
This reverts commit
40760b733d9eef841c897338af5e9d81b12551bf.
It seems that the commit is a cuse of the build failure.
llvm-svn: 345032
Sam McCall [Tue, 23 Oct 2018 14:19:54 +0000 (14:19 +0000)]
[clangd] Lazily create CDB, remove setCompileCommandsDir.
Summary:
The only way to actually set the directory is at initialize time,
so now CDB is lazy we can pass it to the constructor.
Reviewers: hokein
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D53572
llvm-svn: 345031
Sanjay Patel [Tue, 23 Oct 2018 14:07:39 +0000 (14:07 +0000)]
[SLSR] use 'match' to simplify code; NFC
This pass could probably be modified slightly to allow
vector splat transforms for practically no cost, but
it only works on scalars for now. So the use of the
newer 'match' API should make no functional difference.
llvm-svn: 345030
Kadir Cetinkaya [Tue, 23 Oct 2018 13:49:37 +0000 (13:49 +0000)]
[clang] Fix a null pointer dereference.
Summary:
Sometimes expression inside switch statement can be invalid, for
example type might be incomplete. In those cases code were causing a null
pointer dereference. This patch fixes that.
Reviewers: sammccall, ioeric, hokein
Reviewed By: sammccall
Subscribers: arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D53561
llvm-svn: 345029
Sanjay Patel [Tue, 23 Oct 2018 13:39:40 +0000 (13:39 +0000)]
[SLSR] auto-generate full test assertions; NFC
llvm-svn: 345028
Roman Lebedev [Tue, 23 Oct 2018 13:19:31 +0000 (13:19 +0000)]
Experimental re-land of [X86][BMI1] X86DAGToDAGISel: select BEXTR from x << (32 - y) >> (32 - y) pattern
This initially landed in rL345014, but was reverted in rL345017
due to sanitizer-x86_64-linux-fast buildbot failure in
check-lld (ELF/relocatable-versioned.s) test.
While i'm not yet quite sure what is the problem, one obvious
thing here is that extra truncation roundtrip.
Maybe that's it? If not, will re-revert.
Differential Revision: https://reviews.llvm.org/D53521
llvm-svn: 345027
Hans Wennborg [Tue, 23 Oct 2018 13:17:13 +0000 (13:17 +0000)]
Revert r345009 "[DebugInfo] Generate debug information for labels. (After fix PR39094)"
This broke the Chromium build. See
https://bugs.chromium.org/p/chromium/issues/detail?id=898152#c1 for the
reproducer.
> Generate DILabel metadata and call llvm.dbg.label after label
> statement to associate the metadata with the label.
>
> After fixing PR37395.
> After fixing problems in LiveDebugVariables.
> After fixing NULL symbol problems in AddressPool when enabling
> split-dwarf-file.
> After fixing PR39094.
>
> Differential Revision: https://reviews.llvm.org/D45045
llvm-svn: 345026
Simon Pilgrim [Tue, 23 Oct 2018 13:14:54 +0000 (13:14 +0000)]
Add BROADCAST shuffle cost tests.
Part of a lot of cleanup necessary before PR39368.
llvm-svn: 345025
Sam McCall [Tue, 23 Oct 2018 13:14:02 +0000 (13:14 +0000)]
[clangd] Remove caching of compilation database commands.
Summary:
The CDB implementations used in open-source code are fast, and our private
slow CDB will soon do the relevant caching itself.
Simplifying the GlobalCDB layer in clangd is important to get auto-index
implemented at the right layer.
Reviewers: ioeric, ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D53439
llvm-svn: 345024
Simon Pilgrim [Tue, 23 Oct 2018 13:00:22 +0000 (13:00 +0000)]
Add BROADCAST shuffle cost tests.
Part of a lot of cleanup necessary before PR39368.
llvm-svn: 345023
Sam McCall [Tue, 23 Oct 2018 11:54:36 +0000 (11:54 +0000)]
[clangd] Support passing a relative path to -compile-commands-dir
Summary: This is useful when using clangd with CMake based projects in Visual Studio Code since when using CMake the `compile_commands.json` file is usually located in a `build` subdirectory which isn't a parent directory of the source files. Allowing passing relative paths to -compile-commands-dir allows specifying `clangd.arguments = ["-compile-commands-dir=build"]` in VSCode's settings file and having it work for each CMake based project that uses the `build` subdirectory as the build directory (instead of having to specify the absolute path to the compile commands directory for each separate project in VSCode's settings).
Patch by Daan De Meyer!
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D53481
llvm-svn: 345022
Dorit Nuzman [Tue, 23 Oct 2018 11:51:55 +0000 (11:51 +0000)]
Leftover bits from https://reviews.llvm.org/D53420 that were accidentally left
out of revision 344883
llvm-svn: 345021
Sam McCall [Tue, 23 Oct 2018 11:51:53 +0000 (11:51 +0000)]
Fix range length comparison in DraftStore::UpdateDraft when Unicode characters are removed from the document
Summary:
See http://lists.llvm.org/pipermail/clangd-dev/2018-October/000171.html for context.
I kept the error (instead of downgrading to a log message) since the range lengths differing does indicate either a bug in the client or server range calculation or the buffers being out of sync (which both seems serious enough to me to be an error). If any existing clients aside from VSCode break they should only break when accidentally typing a Unicode character which should only be a minor nuisance for a little while until the bug is fixed in the respective client.
Patch by Daan De Meyer!
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D53527
llvm-svn: 345020
Greg Bedwell [Tue, 23 Oct 2018 11:34:04 +0000 (11:34 +0000)]
[lit] Only return a found bash executable on Windows if it can understand Windows paths
Some versions of bash.exe, for example WSL's version expect paths in the form
/mnt/c/path/to/dir rather than c:\\path\\to\\dir so will cause failures
for any tests that require an external shell if used by lit. If we're on
Windows and looking for an external shell, check that the found version
of bash is able to parse a native path before returning that version.
This patch also partially reverts the behaviour of r228221 by
restoring the warning if bash cannot be found. This shouldn't pollute
the lit stderr anymore as we're now using internal shell by default on
Windows. If someone is explicitly specifying to use an external shell, it's
probably worth alerting them to the fact that bash could not be found.
Differential Revision: https://reviews.llvm.org/D52831
llvm-svn: 345019
Simon Pilgrim [Tue, 23 Oct 2018 11:33:38 +0000 (11:33 +0000)]
[X86][SSE] Update raw mask shuffle decoders to handle UNDEF mask elts
Matches the approach taken in the constant pool shuffle decoders, and uses an UndefElts mask instead of uint64_t(-1) raw mask values, which doesn't work safely for i32/i64 shuffle mask sizes (as the -1 value is legal).
This allows us to remove the constant pool shuffle decoders from most of the getTargetShuffleMask variable shuffle cases (X86ISD::VPERMV3 will be handled in a future commit).
llvm-svn: 345018
Roman Lebedev [Tue, 23 Oct 2018 10:34:57 +0000 (10:34 +0000)]
Revert "[X86][BMI1] X86DAGToDAGISel: select BEXTR from x << (32 - y) >> (32 - y) pattern"
*Seems* to be breaking sanitizer-x86_64-linux-fast buildbot,
the ELF/relocatable-versioned.s test:
==17758==MemorySanitizer CHECK failed: /b/sanitizer-x86_64-linux-fast/build/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc:191 "((kBlockMagic)) == ((((u64*)addr)[0]))" (0x6a6cb03abcebc041, 0x0)
#0 0x59716b in MsanCheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) /b/sanitizer-x86_64-linux-fast/build/llvm/projects/compiler-rt/lib/msan/msan.cc:393
#1 0x586635 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) /b/sanitizer-x86_64-linux-fast/build/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_termination.cc:79
#2 0x57d5ff in __sanitizer::InternalFree(void*, __sanitizer::SizeClassAllocatorLocalCache<__sanitizer::SizeClassAllocator32<__sanitizer::AP32> >*) /b/sanitizer-x86_64-linux-fast/build/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc:191
#3 0x7fc21b24193f (/lib/x86_64-linux-gnu/libc.so.6+0x3593f)
#4 0x7fc21b241999 in exit (/lib/x86_64-linux-gnu/libc.so.6+0x35999)
#5 0x7fc21b22c2e7 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e7)
#6 0x57c039 in _start (/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/lld+0x57c039)
This reverts commit r345014.
llvm-svn: 345017
George Rimar [Tue, 23 Oct 2018 09:46:15 +0000 (09:46 +0000)]
[LLDB] - Implement the support for the .debug_loclists section.
This implements the support for .debug_loclists section, which is
DWARF 5 version of .debug_loc.
Currently, clang is able to emit it with the use of D53365.
Differential revision: https://reviews.llvm.org/D53436
llvm-svn: 345016
Simon Pilgrim [Tue, 23 Oct 2018 09:42:10 +0000 (09:42 +0000)]
[TTI] Add generic cost handling of SK_Reverse shuffles
These can be treated as a general permute.
This required a fix for missing reverse patterns on ARM
llvm-svn: 345015
Roman Lebedev [Tue, 23 Oct 2018 09:08:44 +0000 (09:08 +0000)]
[X86][BMI1] X86DAGToDAGISel: select BEXTR from x << (32 - y) >> (32 - y) pattern
Summary:
Continuation of D52348.
We also get the `c) x & (-1 >> (32 - y))` pattern here, because of the D48768.
I will add extra-uses into those tests and follow-up with a patch to handle those patterns too.
Reviewers: RKSimon, craig.topper
Reviewed By: craig.topper
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D53521
llvm-svn: 345014
Aleksandr Urakov [Tue, 23 Oct 2018 08:29:17 +0000 (08:29 +0000)]
[PDB] Improve performance of the PDB DIA plugin
Summary:
This patch improves performance of `SymbolFilePDB` on huge executables
in two ways:
- cache names of public symbols by address. When creating variables we are
trying to get a mangled name for each one, and in `GetMangledForPDBData`
we are enumerating all public symbols, which takes O(n) for each variable.
With the cache we can retrieve a mangled name in O(log(n));
- cache section contributions. When parsing variables for context we are
enumerating all variables and check if the current one is belonging
to the current compiland. So we are retrieving a compiland ID
for the variable. But in `PDBSymbolData::getCompilandId` for almost every
variable we are enumerating all section contributions to check if the variable
is belonging to it, and get a compiland ID from the section contribution
if so. It takes O(n) for each variable, but with caching it takes about
O(log(n)). I've placed the cache in `SymbolFilePDB` and have created
`GetCompilandId` there. It actually duplicates `PDBSymbolData::getCompilandId`
except for the cache part. Another option is to support caching
in `PDBSymbolData::getCompilandId` and to place cache in `DIASession`, but it
seems that the last one doesn't imply such functionality, because
it's a lightweight wrapper over DIA and whole its state is only a COM pointer
to the DIA session. Moreover, `PDBSymbolData::getCompilandId` is used only
inside of `SymbolFilePDB`, so I think that it's not a bad place to do such
things. With this patch `PDBSymbolData::getCompilandId` is not used at all.
This bottlenecks were found with profiling. I've discovered these on a simple
demo project of Unreal Engine (x86 executable ~72M, PDB ~82M).
This patch doesn't change external behavior of the plugin, so I think that
there's no need for additional testing (already existing tests should warn us
about regress, if any).
Reviewers: zturner, asmith, labath
Reviewed By: asmith
Subscribers: Hui, lldb-commits, stella.stamenova
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D53375
llvm-svn: 345013
Aleksandr Urakov [Tue, 23 Oct 2018 08:23:22 +0000 (08:23 +0000)]
[AST] Do not align virtual bases in `MicrosoftRecordLayoutBuilder` when
an external layout is used
Summary:
The patch removes alignment of virtual bases when an external layout is used.
We have two cases:
- the external layout source has an information about virtual bases offsets,
so we just use them;
- the external source has no information about virtual bases offsets. In this
case we can't predict where the base will be located. If we will align it but
there will be something like `#pragma pack(push, 1)` really, then likely our
layout will not fit into the real structure size, and then some asserts will
hit. The asserts look reasonable, so I don't think that we need to remove
them. May be it would be better instead don't align fields / bases etc.
(so treat it always as `#pragma pack(push, 1)`) when an external layout source
is used but no info about a field location is presented.
This one is related to D49871
Reviewers: rnk, rsmith, zturner, mstorsjo, majnemer
Reviewed By: rnk
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D53497
llvm-svn: 345012
Aleksandr Urakov [Tue, 23 Oct 2018 08:15:00 +0000 (08:15 +0000)]
Fix non-Windows build for D53324
llvm-svn: 345011
Aleksandr Urakov [Tue, 23 Oct 2018 08:14:53 +0000 (08:14 +0000)]
Revert "Revert "[PDB] Extend IPDBSession's interface to retrieve frame data""
This reverts commit
466ce67d6ec444962e5cc0136243c16a453190c0.
llvm-svn: 345010
Hsiangkai Wang [Tue, 23 Oct 2018 08:06:21 +0000 (08:06 +0000)]
[DebugInfo] Generate debug information for labels. (After fix PR39094)
Generate DILabel metadata and call llvm.dbg.label after label
statement to associate the metadata with the label.
After fixing PR37395.
After fixing problems in LiveDebugVariables.
After fixing NULL symbol problems in AddressPool when enabling
split-dwarf-file.
After fixing PR39094.
Differential Revision: https://reviews.llvm.org/D45045
llvm-svn: 345009
Lama Saba [Tue, 23 Oct 2018 07:58:41 +0000 (07:58 +0000)]
[MachinePipeliner] Split MachinePipeliner code into header and cpp files
Split MachinePipeliner code into header and cpp files to allow inheritance from SwingSchedulerDAG
Differential Revision: https://reviews.llvm.org/D53477
llvm-svn: 345008
Sylvestre Ledru [Tue, 23 Oct 2018 07:13:47 +0000 (07:13 +0000)]
Add support for GNU Hurd in Path.inc and other places
Summary: Patch by Svante Signell & myself
Reviewers: rnk, JDevlieghere, efriedma
Reviewed By: efriedma
Subscribers: efriedma, JDevlieghere, krytarowski, llvm-commits, kristina
Differential Revision: https://reviews.llvm.org/D53409
llvm-svn: 345007
Martin Storsjo [Tue, 23 Oct 2018 07:01:55 +0000 (07:01 +0000)]
Revert "[Driver] Use forward slashes in most linker arguments"
This reverts commit r345004, as it broke tests when actually run
on windows; see e.g.
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/763.
This broke tests that had captured a variable containing a path
with backslashes, which failed to match cases in the output
where the path separators had been changed into forward slashes.
llvm-svn: 345005
Martin Storsjo [Tue, 23 Oct 2018 06:33:26 +0000 (06:33 +0000)]
[Driver] Use forward slashes in most linker arguments
libtool inspects the output of $CC -v to detect what object files and
libraries are linked in by default. When clang is built as a native
windows executable, all paths are formatted with backslashes, and
the backslashes cause each argument to be enclosed in quotes. The
backslashes and quotes break further processing within libtool (which
is implemented in shell script, running in e.g. msys) pretty badly.
Between unix style pathes (that only work in tools that are linked
to the msys runtime, essentially the same as cygwin) and proper windows
style paths (with backslashes, that can easily break shell scripts
and msys environments), the best compromise is to use windows style
paths (starting with e.g. c:) but with forward slashes, which both
msys based tools, shell scripts and native windows executables can
cope with. This incidentally turns out to be the form of paths that
GCC prints out when run with -v on windows as well.
This change potentially makes the output from clang -v a bit more
inconsistent, but it is isn't necessarily very consistent to begin with.
Differential Revision: https://reviews.llvm.org/D53066
llvm-svn: 345004
Martin Storsjo [Tue, 23 Oct 2018 06:33:22 +0000 (06:33 +0000)]
[MinGW] Link to correct openmp library
Patch by Peiyuan Song!
Differential Revision: https://reviews.llvm.org/D53397
llvm-svn: 345003
Dimitry Andric [Tue, 23 Oct 2018 05:53:15 +0000 (05:53 +0000)]
Don't mess up RelIplt symbols during relocatable processing
Summary:
During upgrading of the FreeBSD source tree with lld 7.0.0, I noticed
that it started complaining about `crt1.o` having an "index past the
end of the symbol table".
Such a symbol table looks approximately like this, viewed with `readelf
-s` (note the `Ndx` field being messed up):
```
Symbol table '.symtab' contains 4 entries:
Num: Value Size Type Bind Vis Ndx Name
0:
00000000 0 NOTYPE LOCAL DEFAULT UND
1:
00000000 0 SECTION LOCAL DEFAULT 1
2:
00000000 0 NOTYPE WEAK HIDDEN RSV[0xffff] __rel_iplt_end
3:
00000000 0 NOTYPE WEAK HIDDEN RSV[0xffff] __rel_iplt_start
```
At first, it seemed that recent ifunc relocation work had caused this:
<https://reviews.freebsd.org/rS339351>, but it turned out that it was
due to incorrect processing of the object files by lld, when using `-r`
(a.k.a. --relocatable).
Bisecting showed that rL324421 ("Convert a use of Config->Static") was
the commit where this new behavior began. Simply reverting it solved
the issue, and the `__rel_iplt` symbols had an index of `UND` again.
Looking at Rafael's commit message, I think he simply missed the
possibility of `--relocatable` being in effect, so I have added an
additional check for it.
I also added a simple regression test case.
Reviewers: grimar, ruiu, emaste, espindola
Reviewed By: ruiu
Subscribers: arichardson, krytarowski, llvm-commits
Differential Revision: https://reviews.llvm.org/D53515
llvm-svn: 345002
Marshall Clow [Tue, 23 Oct 2018 05:22:09 +0000 (05:22 +0000)]
Mark the move construct/move assign tests as unsupported on C++03
llvm-svn: 345001
Craig Topper [Tue, 23 Oct 2018 04:18:08 +0000 (04:18 +0000)]
[X86] Regenerate test checks to show fma comments. NFC
llvm-svn: 344999
Marshall Clow [Tue, 23 Oct 2018 02:51:26 +0000 (02:51 +0000)]
Add tests for match_results copy/move assignment operators. NFC
llvm-svn: 344998
Marshall Clow [Tue, 23 Oct 2018 02:31:11 +0000 (02:31 +0000)]
Remove a 'const' from the synopsis. NFC
llvm-svn: 344997
Yaxun Liu [Tue, 23 Oct 2018 02:05:31 +0000 (02:05 +0000)]
Add gfx904 and gfx906 to GPU Arch
Differential Revision: https://reviews.llvm.org/D53472
llvm-svn: 344996
Lang Hames [Tue, 23 Oct 2018 01:36:33 +0000 (01:36 +0000)]
[RuntimeDyld][COFF] Skip non-loaded sections when calculating ImageBase.
Non-loaded sections (whose unused load-address defaults to zero) should not
be taken into account when calculating ImageBase, or ImageBase will be
incorrectly set to 0.
Patch by Andrew Scheidecker. Thanks Andrew!
https://reviews.llvm.org/D51343
+ // The Sections list may contain sections that weren't loaded for
+ // whatever reason: they may be debug sections, and ProcessAllSections
+ // is false, or they may be sections that contain 0 bytes. If the
+ // section isn't loaded, the load address will be 0, and it should not
+ // be included in the ImageBase calculation.
llvm-svn: 344995
Lang Hames [Tue, 23 Oct 2018 01:36:32 +0000 (01:36 +0000)]
[ORC] Show JITDylib search order in JITDylib::dump.
This can be helpful in debugging search-order related failures.
llvm-svn: 344994
Lang Hames [Tue, 23 Oct 2018 01:36:31 +0000 (01:36 +0000)]
[ORC] Dump flags for JITDylib symbol table entries.
This can help when debugging flag-specific symbol table issues.
llvm-svn: 344993
George Karpenkov [Tue, 23 Oct 2018 01:31:08 +0000 (01:31 +0000)]
[analyzer] [NFC] Correct comment on RetainSummaryManager
Differential Revision: https://reviews.llvm.org/D53548
llvm-svn: 344992
George Karpenkov [Tue, 23 Oct 2018 01:30:45 +0000 (01:30 +0000)]
[analyzer] [www] Drop references to GC mode, which was deprecated years ago
Differential Revision: https://reviews.llvm.org/D53302
llvm-svn: 344991
George Karpenkov [Tue, 23 Oct 2018 01:30:26 +0000 (01:30 +0000)]
[analyzer] [testing] Compute data on path length, compute percentiles
Differential Revision: https://reviews.llvm.org/D52844
llvm-svn: 344990
Marshall Clow [Tue, 23 Oct 2018 01:30:14 +0000 (01:30 +0000)]
Updated the issue notes.
llvm-svn: 344989
Marshall Clow [Tue, 23 Oct 2018 01:27:47 +0000 (01:27 +0000)]
Add tests for match_results copy/move construction. NFC
llvm-svn: 344988
Richard Trieu [Tue, 23 Oct 2018 01:26:28 +0000 (01:26 +0000)]
[CodeGen] Attach InlineHint to more functions
For instantiated functions, search the template pattern to see if it marked
inline to determine if InlineHint attribute should be added to the function.
llvm-svn: 344987
Shoaib Meenai [Tue, 23 Oct 2018 01:19:18 +0000 (01:19 +0000)]
[ELF] Split up emulation.s per backend
emulation.s is testing multiple architectures, which means it needs all
the corresponding backends enabled, which might not be true for all
developers (for example, I don't have PPC or MIPS enabled). Rather than
marking the entire test as unsupported for such developers, split it up
per backend to get better testing granularity.
Differential Revision: https://reviews.llvm.org/D53544
llvm-svn: 344986
Kostya Serebryany [Tue, 23 Oct 2018 00:50:40 +0000 (00:50 +0000)]
[hwasan] add stack frame descriptions.
Summary:
At compile-time, create an array of {PC,HumanReadableStackFrameDescription}
for every function that has an instrumented frame, and pass this array
to the run-time at the module-init time.
Similar to how we handle pc-table in SanitizerCoverage.
The run-time is dummy, will add the actual logic in later commits.
Reviewers: morehouse, eugenis
Reviewed By: eugenis
Subscribers: srhines, llvm-commits, kubamracek
Differential Revision: https://reviews.llvm.org/D53227
llvm-svn: 344985
Shoaib Meenai [Tue, 23 Oct 2018 00:34:34 +0000 (00:34 +0000)]
[ELF] Actually fix test from r344976
I don't think the offsets and flags are particularly relevant to the
test; the machine type is what matters.
llvm-svn: 344984
Jonas Devlieghere [Tue, 23 Oct 2018 00:32:22 +0000 (00:32 +0000)]
[dsymutil] Improve error reporting when we cannot create output file.
Before this patch we were returning an empty string in case we couldn't
create the output file. Now we return an expected string so we can
return and print the proper issue. We now return errors instead of bools
and defer printing to the call site.
llvm-svn: 344983
Davide Italiano [Tue, 23 Oct 2018 00:31:46 +0000 (00:31 +0000)]
[ValueObject] Stop assuming types are non-zero sized.
Some backends might violate this assumption. No test case
upstream unfortunately as this is not the case with C++,
but I'm going to add a test in swift language support.
<rdar://problem/
40962410>
llvm-svn: 344982
Heejin Ahn [Tue, 23 Oct 2018 00:28:14 +0000 (00:28 +0000)]
[WebAssembly] Fix assembly printing of br_table
Summary: In `br_table's stack version asm string, \t was missing.
Reviewers: aardappel
Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D53516
llvm-svn: 344981
Shoaib Meenai [Tue, 23 Oct 2018 00:27:27 +0000 (00:27 +0000)]
[ELF] Fix test from r344976
Turns out I wasn't actually running this test locally, since I don't
build the PPC and MIPS backends. Whoops.
Perhaps this test should be split up per-architecture?
llvm-svn: 344980
Jonas Devlieghere [Tue, 23 Oct 2018 00:18:27 +0000 (00:18 +0000)]
Fix typo in ASSERT_MODULE_LOCK macro definition
llvm-svn: 344979
Craig Topper [Tue, 23 Oct 2018 00:15:37 +0000 (00:15 +0000)]
[X86] Remove 'rtm' feature from KNL.
I'm unsure if KNL has this feature, but the backend never thought it did, only clang did. The predefined-arch-macros test lost the check for __RTM__ on KNL when it was removed Skylake CPUs in r344117.
I think we want to drop it from KNL for consistency with Skylake anyway regardless of how we got here.
llvm-svn: 344978
Wouter van Oortmerssen [Tue, 23 Oct 2018 00:12:49 +0000 (00:12 +0000)]
[WebAssembly] Added test for inline assembly roundtrip.
Summary:
Due to previous work to make WebAssembly MC by default stack-only
inline assembly now "just works" (previously it didn't since it had
no way to know types of registers), so no further work required.
So far we only have tests (in inline-asm.ll) which test with
non-existing instructions, so this adds a test that roundtrips
both the inline assembly and its surrounding code thru the assembler.
Reviewers: dschuff, sunfish
Subscribers: sbc100, jgravelle-google, eraman, aheejin, llvm-commits
Differential Revision: https://reviews.llvm.org/D52914
llvm-svn: 344977
Shoaib Meenai [Mon, 22 Oct 2018 23:56:10 +0000 (23:56 +0000)]
[ELF] Handle elf32-littlearm in OUTPUT_FORMAT
We need this to support 32-bit ARM. Add test cases for emulation
handling for this architecture as well.
Differential Revision: https://reviews.llvm.org/D53539
llvm-svn: 344976
Marshall Clow [Mon, 22 Oct 2018 23:52:09 +0000 (23:52 +0000)]
Added more notes to the issues.
llvm-svn: 344975
Fangrui Song [Mon, 22 Oct 2018 23:43:53 +0000 (23:43 +0000)]
[ELF] Don't warn on two legitimate cases when reading .llvm.call-graph-profile
Summary:
Before, superfluous warnings were emitted for the following two cases:
1) When from symbol was in a discarded section.
The profile should be thought of as affiliated to the section.
It makes sense to ignore the profile if the section is discarded.
2) When to symbol was in a shared object.
The object file containing the profile may not know about the to
symbol, which can reside in another object file (useful profile) or a
shared object (not useful as symbols in the shared object are fixed
and unorderable). It makes sense to ignore the profile from the object
file.
Note, the warning when to symbol was undefined was suppressed in
D53044, which is still useful for --symbol-ordering-file=
This patch silences the warnings. The check is actually more relaxed (no
warnings if either From or To is not Defined) for simplicity and I don't
see a compelling reason to warn on more cases.
Reviewers: ruiu, davidxl, espindola, Bigcheese
Reviewed By: ruiu
Subscribers: emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D53470
llvm-svn: 344974
Saleem Abdulrasool [Mon, 22 Oct 2018 23:34:24 +0000 (23:34 +0000)]
X86: fix a comment copy-paste issue (NFC)
The comment was copy-pasted but not updated. NFC.
llvm-svn: 344973
Craig Topper [Mon, 22 Oct 2018 23:14:55 +0000 (23:14 +0000)]
[X86] Remove unused entries from the X86ProcFamily enum. Add a note to discourage creation of new enum entries.
As we've learned multiple times, a coarse grained enum like this is not scalable and we should be migrating away from it.
llvm-svn: 344972
Leonard Chan [Mon, 22 Oct 2018 23:08:40 +0000 (23:08 +0000)]
[Intrinsic] Unigned Saturation Addition Intrinsic
Add an intrinsic that takes 2 integers and perform unsigned saturation
addition on them.
This is a part of implementing fixed point arithmetic in clang where some of
the more complex operations will be implemented as intrinsics.
Differential Revision: https://reviews.llvm.org/D53340
llvm-svn: 344971
Matthias Braun [Mon, 22 Oct 2018 22:52:23 +0000 (22:52 +0000)]
X86: Do not optimize branches with undef eflags inputs
analyzeBranch()/insertBranch() etc. do not properly deal with an undef
flag on the eflags input and used to produce invalid MIR. I don't see
this ever affecting real world inputs (I don't think it is possible to
produce undef flags with llvm IR), so I simply changed the code to bail
out in this case.
rdar://
42122367
llvm-svn: 344970
Sanjay Patel [Mon, 22 Oct 2018 22:50:27 +0000 (22:50 +0000)]
[Reassociate] remove bogus tests; NFC
I was trying to provide test coverage for D53533
with rL344964, but these don't do it...and I don't
think they add any value, so deleting.
llvm-svn: 344969
Benjamin Kramer [Mon, 22 Oct 2018 22:43:17 +0000 (22:43 +0000)]
[clang-tidy] Fix typo abls->absl.
llvm-svn: 344968
Reid Kleckner [Mon, 22 Oct 2018 22:29:09 +0000 (22:29 +0000)]
[MC] Shrink MCAsmParser by grouping bools, add const, NFC
I was considering adding another boolean here. I standardized on bools
since they allow default member initializers in the class definition.
This makes ShowParsedOperands protected instead of private, but that's
probably fine.
Reduce the SmallVector size while we're at it, since the common case is
that there is never a pending error.
llvm-svn: 344967
Simon Pilgrim [Mon, 22 Oct 2018 22:26:00 +0000 (22:26 +0000)]
[ARM] Regenerate reverse shuffle costs
Came about while cleaning up general shuffle costs for PR39368
llvm-svn: 344966
Craig Topper [Mon, 22 Oct 2018 22:14:05 +0000 (22:14 +0000)]
Recommit r344877 "[X86] Stop promoting integer loads to vXi64"
I've included a fix to DAGCombiner::ForwardStoreValueToDirectLoad that I believe will prevent the previous miscompile.
Original commit message:
Theoretically this was done to simplify the amount of isel patterns that were needed. But it also meant a substantial number of our isel patterns have to match an explicit bitcast. By making the vXi32/vXi16/vXi8 types legal for loads, DAG combiner should be able to change the load type to rem
I had to add some additional plain load instruction patterns and a few other special cases, but overall the isel table has reduced in size by ~12000 bytes. So it looks like this promotion was hurting us more than helping.
I still have one crash in vector-trunc.ll that I'm hoping @RKSimon can help with. It seems to relate to using getTargetConstantFromNode on a load that was shrunk due to an extract_subvector combine after the constant pool entry was created. So we end up decoding more mask elements than the lo
I'm hoping this patch will simplify the number of patterns needed to remove the and/or/xor promotion.
Reviewers: RKSimon, spatel
Reviewed By: RKSimon
Subscribers: llvm-commits, RKSimon
Differential Revision: https://reviews.llvm.org/D53306
llvm-svn: 344965
Sanjay Patel [Mon, 22 Oct 2018 22:04:13 +0000 (22:04 +0000)]
[Reassociate] add vector tests with undef elements; NFC
Also, regenerate checks for these files. We should do better
on the vector tests by using the PatternMatch API instead of
BinaryOperator::isNot/isNeg.
llvm-svn: 344964