Igor Kudrin [Tue, 20 Aug 2019 09:50:44 +0000 (09:50 +0000)]
[DWARF] Fix DWARFUnit::getDebugInfoSize() for 64-bit DWARF.
The calculation there was correct only for DWARF32.
Differential Revision: https://reviews.llvm.org/D66421
llvm-svn: 369356
Raphael Isemann [Tue, 20 Aug 2019 09:26:58 +0000 (09:26 +0000)]
[lldb][NFC] Test quotes when completing
llvm-svn: 369353
Jan Kratochvil [Tue, 20 Aug 2019 09:24:20 +0000 (09:24 +0000)]
[lldb] D66174 `RegularExpression` cleanup
I find as a good cleanup to drop the Compile method. As I do not find TIMTOWTDI
as an advantage and there is already constructor parameter to compile the
regex.
Differential Revision: https://reviews.llvm.org/D66392
llvm-svn: 369352
Fangrui Song [Tue, 20 Aug 2019 09:20:05 +0000 (09:20 +0000)]
[ELF][PPC] Allow PT_LOAD to have overlapping p_offset ranges on EM_PPC
Ported the D64906 technique to EM_PPC.
Delete ppc-rela.s that is covered by ppc32-abs-pic.s
llvm-svn: 369351
Ilya Biryukov [Tue, 20 Aug 2019 08:54:30 +0000 (08:54 +0000)]
[clangd] Skip function bodies inside processed files while indexing
Summary:
This significantly improves performance of background indexing.
We do not collect references and declarations inside the processed
files, so this does not affect the final indexing results.
The idea is borrowed from libclang, which has a similar optimization in
its indexing functionality.
Measurements show a nice decrease in indexing time, up to ~40% for
building the whole index. These are not proper benchmarks, so one should
not rely on these results too much.
1. Rebuilding the whole index for LLVM:
- Before. Total time: 14m58s.
./bin/clangd -pch-storage=memory < ./clangd.input 23917.67s user 515.86s system 2718% cpu 14:58.68 total
- After. Total time: 8m41s.
./bin/clangd -pch-storage=memory < ./clangd.input 13627.29s user 288.10s system 2672% cpu 8:40.67 total
2. Rebuilding index after removing shards matching '*clangd*' (case-insensitively):
- Before. Total time: 30s.
./bin/clangd -pch-storage=memory < ./clangd.input 130.94s user 6.82s system 452% cpu 30.423 total
- After. Total time: 26s.
./bin/clangd -pch-storage=memory < ./clangd.input 80.51s user 5.40s system 333% cpu 25.777 total
Reviewers: kadircet, sammccall
Reviewed By: kadircet
Subscribers: MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66226
llvm-svn: 369349
Seiya Nuta [Tue, 20 Aug 2019 08:49:07 +0000 (08:49 +0000)]
[yaml2obj/obj2yaml][MachO] Allow setting custom section data
Reviewers: alexshap, jhenderson, rupprecht
Reviewed By: alexshap, jhenderson
Subscribers: abrachet, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65799
llvm-svn: 369348
Fangrui Song [Tue, 20 Aug 2019 08:43:47 +0000 (08:43 +0000)]
[ELF][X86] Allow PT_LOAD to have overlapping p_offset ranges on EM_386
Ported the D64906 technique to EM_386.
If `sh_addralign(.tdata) < sh_addralign(.tbss)`,
we can potentially make `p_vaddr(PT_TLS)%p_align(PT_TLS) != 0`.
ld.so that are known to have problems if p_vaddr%p_align!=0:
* FreeBSD 13.0-CURRENT rtld-elf
* glibc https://sourceware.org/bugzilla/show_bug.cgi?id=24606
New test i386-tls-vaddr-align.s checks our workaround makes p_vaddr%p_align = 0.
Reviewed By: ruiu
Differential Revision: https://reviews.llvm.org/D65865
llvm-svn: 369347
Seiya Nuta [Tue, 20 Aug 2019 08:36:47 +0000 (08:36 +0000)]
[llvm-objcopy][MachO] Fix method names. NFC.
Reviewers: alexshap, rupprecht, jhenderson
Reviewed By: alexshap, rupprecht
Subscribers: jakehehrlich, abrachet, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65540
llvm-svn: 369346
Stephan Bergmann [Tue, 20 Aug 2019 08:36:21 +0000 (08:36 +0000)]
Rudimentary support for Doxygen \retval command
...so that at least a preceding \param etc. that lacks a description gets a
-Wdocumentation warning (instead of erroneously treating the \retval ... text as
its paragraph).
Differential Revision: https://reviews.llvm.org/D66350
llvm-svn: 369345
Fangrui Song [Tue, 20 Aug 2019 08:34:56 +0000 (08:34 +0000)]
[ELF][AArch64] Allow PT_LOAD to have overlapping p_offset ranges
Ported the D64906 technique to AArch64. It deletes 3 alignments at
PT_LOAD boundaries for the default case: the size of an aarch64 binary
decreases by at most 192kb.
If `sh_addralign(.tdata) < sh_addralign(.tbss)`,
we can potentially make `p_vaddr(PT_TLS)%p_align(PT_TLS) != 0`.
ld.so that are known to have problems if p_vaddr%p_align!=0:
* musl<=1.1.22
* FreeBSD 13.0-CURRENT (and before) rtld-elf arm64
New test aarch64-tls-vaddr-align.s checks that our workaround makes p_vaddr%p_align = 0.
Reviewed By: ruiu
Differential Revision: https://reviews.llvm.org/D64930
llvm-svn: 369344
Fangrui Song [Tue, 20 Aug 2019 08:34:25 +0000 (08:34 +0000)]
[ELF][PPC] Allow PT_LOAD to have overlapping p_offset ranges
This change affects the non-linker script case (precisely, when the
`SECTIONS` command is not used). It deletes 3 alignments at PT_LOAD
boundaries for the default case: the size of a powerpc64 binary can be
decreased by at most 192kb. The technique can be ported to other
targets.
Let me demonstrate the idea with a maxPageSize=65536 example:
When assigning the address to the first output section of a new PT_LOAD,
if the end p_vaddr of the previous PT_LOAD is 0x10020, we advance to
the next multiple of maxPageSize: 0x20000. The new PT_LOAD will thus
have p_vaddr=0x20000. Because p_offset and p_vaddr are congruent modulo
maxPageSize, p_offset will be 0x20000, leaving a p_offset gap [0x10020,
0x20000) in the output.
Alternatively, if we advance to 0x20020, the new PT_LOAD will have
p_vaddr=0x20020. We can pick either 0x10020 or 0x20020 for p_offset!
Obviously 0x10020 is the choice because it leaves no gap. At runtime,
p_vaddr will be rounded down by pagesize (65536 if
pagesize=maxPageSize). This PT_LOAD will load additional initial
contents from p_offset ranges [0x10000,0x10020), which will also be
loaded by the previous PT_LOAD. This is fine if -z noseparate-code is in
effect or if we are not transiting between executable and non-executable
segments.
ld.bfd -z noseparate-code leverages this technique to keep output small.
This patch implements the technique in lld, which is mostly effective on
targets with large defaultMaxPageSize (AArch64/MIPS/PPC: 65536). The 3
removed alignments can save almost 3*65536 bytes.
Two places that rely on p_vaddr%pagesize = 0 have to be updated.
1) We used to round p_memsz(PT_GNU_RELRO) up to commonPageSize (defaults
to 4096 on all targets). Now p_vaddr%commonPageSize may be non-zero.
The updated formula takes account of that factor.
2) Our TP offsets formulae are only correct if p_vaddr%p_align = 0.
Fix them. See the updated comments in InputSection.cpp for details.
On targets that we enable the technique (only PPC64 now),
we can potentially make `p_vaddr(PT_TLS)%p_align(PT_TLS) != 0`
if `sh_addralign(.tdata) < sh_addralign(.tbss)`
This exposes many problems in ld.so implementations, especially the
offsets of dynamic TLS blocks. Known issues:
FreeBSD 13.0-CURRENT rtld-elf (i386/amd64/powerpc/arm64)
glibc (HEAD) i386 and x86_64 https://sourceware.org/bugzilla/show_bug.cgi?id=24606
musl<=1.1.22 on TLS Variant I architectures (aarch64/powerpc64/...)
So, force p_vaddr%p_align = 0 by rounding dot up to p_align(PT_TLS).
The technique will be enabled (with updated tests) for other targets in
subsequent patches.
Reviewed By: ruiu
Differential Revision: https://reviews.llvm.org/D64906
llvm-svn: 369343
George Rimar [Tue, 20 Aug 2019 08:23:57 +0000 (08:23 +0000)]
[test/Object] - Move/rewrite 2 more test cases.
This patch makes a change for test/Object tests responsible
for relocations.
* 2 tests were moved to llvm-readobj/llvm-objdump folders:
Object/elf-reloc-no-sym.test -> tools/llvm-readobj/elf-reloc-no-sym.test
Object/objdump-reloc-shared.test -> tools/llvm-objdump/relocations-in-nonreloc.test
* A prerecompiled binary was removed and these tests were refactored.
Differential revision: https://reviews.llvm.org/D66291
llvm-svn: 369342
Fangrui Song [Tue, 20 Aug 2019 07:42:04 +0000 (07:42 +0000)]
[MC] Delete an overload of MCExpr::evaluateKnownAbsolute and its associated hack
The hack dated back to 2010 (r121076) and was documented by r122144:
// FIXME: The use if InSet = Addrs is a hack. Setting InSet causes us
// absolutize differences across sections and that is what the MachO writer
// uses Addrs for.
llvm-svn: 369337
Hans Wennborg [Tue, 20 Aug 2019 07:41:14 +0000 (07:41 +0000)]
[compiler-rt][crt] Pass -fno-lto in check_cxx_section_exists
Otherwise it doesn't work when building with -DLLVM_ENABLE_LTO=thin
(We hit this in Chromium in
https://bugs.chromium.org/p/chromium/issues/detail?id=966403)
llvm-svn: 369336
Fangrui Song [Tue, 20 Aug 2019 07:21:43 +0000 (07:21 +0000)]
[Attributor] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after r369331
llvm-svn: 369334
Craig Topper [Tue, 20 Aug 2019 06:58:00 +0000 (06:58 +0000)]
[X86] Add back the -x86-experimental-vector-widening-legalization comand line flag and all associated code, but leave it enabled by default
Google is reporting performance issues with the new default behavior
and have asked for a way to switch back to the old behavior while we
investigate and make fixes.
I've restored all of the code that had since been removed and added
additional checks of the command flag onto code paths that are
not otherwise guarded by a check of getTypeAction.
I've also modified the cost model tables to hopefully get us back
to the previous costs.
Hopefully we won't need to support this for very long since we
have no test coverage of the old behavior so we can very easily
break it.
llvm-svn: 369332
Johannes Doerfert [Tue, 20 Aug 2019 06:15:50 +0000 (06:15 +0000)]
[Attributor] Create abstract attributes on-demand
Before, we create the set of abstract attributes initially and then
dealt with the fact hat a lookup could fail, e.g., return a nullptr.
This patch will ensure we always return a valid object from a lookup,
allowing us not only to remove the nullptr checks but also to grow the
set of abstract attributes "in-flight" on-demand.
One can now start from those that have the best chance of improving
performance without the need to specify all they might depend on.
While this introduces some boilerplate, the usage of attributes is much
easier and cleaner now.
Reviewers: uenoku, sstefan1
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66276
llvm-svn: 369331
Johannes Doerfert [Tue, 20 Aug 2019 06:09:56 +0000 (06:09 +0000)]
[Attributor][NFC] Cleanup statistics code
llvm-svn: 369330
Johannes Doerfert [Tue, 20 Aug 2019 06:08:35 +0000 (06:08 +0000)]
[Attributor] Use structured deduction for AADereferenceable
Summary:
This is analogous to D66128 but for AADereferenceable. We have the logic
concentrated in the floating value updateImpl and we use the combiner
helper classes for arguments and return values.
The regressions will go away with "on-demand" attribute creation.
Improvements are already visible in the existing tests.
Reviewers: uenoku, sstefan1
Subscribers: hiraditya, bollu, jfb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66272
llvm-svn: 369329
Johannes Doerfert [Tue, 20 Aug 2019 06:02:39 +0000 (06:02 +0000)]
[Attributor] Use structured deduction for AANonNull
Summary:
What D66126 did for AAAlign, this patch does for AANonNull. Agian, the
logic becomes more concise and localized. Again, returned poiners are
not annotated properly but that will not be an issue if this lands with
the "on-demand" generation of attributes. First improvements due to the
genericValueTraversal are already visible.
Reviewers: sstefan1, uenoku
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66128
llvm-svn: 369328
Johannes Doerfert [Tue, 20 Aug 2019 05:57:01 +0000 (05:57 +0000)]
[Attributor] Fix the "clamp" operator
The clamp operator should not take the known of the given state as the
known is potentially based on assumed information. This also adds TODOs
to guide improvements.
llvm-svn: 369327
Thomas Raoux [Tue, 20 Aug 2019 05:21:27 +0000 (05:21 +0000)]
[NFC] Test commit, fix some comment spelling.
llvm-svn: 369326
Karl-Johan Karlsson [Tue, 20 Aug 2019 05:13:57 +0000 (05:13 +0000)]
[AsmPrinter] Remove const qualifier from EmitBasicBlockStart.
Overriders may want to modify state in it. AMDGPU wants
to, but has to make its members mutable in order to do so.
Besides, EmitBasicBlockEnd is not const, so why should
Start be?
Patch by Bevin Hansson.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D66341
llvm-svn: 369325
Fangrui Song [Tue, 20 Aug 2019 04:14:43 +0000 (04:14 +0000)]
MCAsmMacro: add `#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)` to some dump() declarations
llvm-svn: 369324
Artem Dergachev [Tue, 20 Aug 2019 02:22:37 +0000 (02:22 +0000)]
[CallGraph] Take into accound calls that aren't within any function bodies.
This patch improves Clang call graph analysis by adding in expressions
that are not found in regular function bodies, such as default arguments
or member initializers.
Patch by Joshua Cranmer!
Differential Revision: https://reviews.llvm.org/D65453
llvm-svn: 369321
Artem Dergachev [Tue, 20 Aug 2019 02:15:50 +0000 (02:15 +0000)]
[analyzer] NFC: Rename GRBugReporter to PathSensitiveBugReporter.
The GR prefix is super ancient.
llvm-svn: 369320
Artem Dergachev [Tue, 20 Aug 2019 02:15:47 +0000 (02:15 +0000)]
[analyzer] NFC: Drop support for extra text attached to bug reports.
It was introduced in 2011 but never used since then.
llvm-svn: 369319
Fangrui Song [Tue, 20 Aug 2019 02:02:57 +0000 (02:02 +0000)]
[WebAssembly][MC] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after r369317
llvm-svn: 369318
Sam Clegg [Tue, 20 Aug 2019 00:33:50 +0000 (00:33 +0000)]
[WebAssembly][MC] Simplify WasmObjectWriter::recordRelocation. NFC.
WebAssembly doesn't support PC relative relocation or relocation
expressions that can't be reduced to single symbol.
The only support for we have for fixups involving two symbols are when
both symbols are defined and withing the same section. In this case
evaluateFixup will already have evaluated to the expression before
calling recordRelocation.
llvm-svn: 369317
Richard Trieu [Tue, 20 Aug 2019 00:28:21 +0000 (00:28 +0000)]
Fix typo. "piont" => "point"
Found by Chris Morris (cwmorris).
llvm-svn: 369316
Dinar Temirbulatov [Tue, 20 Aug 2019 00:22:04 +0000 (00:22 +0000)]
[SLP][NFC] Avoid repetitive calls to getSameOpcode()
We can avoid repetitive calls getSameOpcode() for already known tree elements by keeping MainOp and AltOp in TreeEntry.
Differential Revision: https://reviews.llvm.org/D64700
llvm-svn: 369315
Julian Lettner [Tue, 20 Aug 2019 00:04:19 +0000 (00:04 +0000)]
[TSan] Rename file with libdispatch interceptors
llvm-svn: 369314
Med Ismail Bennani [Mon, 19 Aug 2019 23:59:31 +0000 (23:59 +0000)]
[lldb] Fix typo on the BreakpointLocation header and the lldbtest.py (NFC)
Summary:
This commit fixes some typo I found while exploring LLDB's codebase.
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D66452
llvm-svn: 369313
Louis Dionne [Mon, 19 Aug 2019 23:51:26 +0000 (23:51 +0000)]
Provide a meaningful diagnostic when LLVM_PATH doesn't point to a directory
llvm-svn: 369312
Julian Lettner [Mon, 19 Aug 2019 23:47:35 +0000 (23:47 +0000)]
[sanitizer_common] Extend test after switch to posix_spawn
llvm-svn: 369311
Hubert Tong [Mon, 19 Aug 2019 23:12:48 +0000 (23:12 +0000)]
[cmake] Link in LLVMPasses due to dependency by LLVMOrcJIT; NFC
Summary:
rL367756 (f5c40cb) increases the dependency of LLVMOrcJIT on LLVMPasses.
In particular, symbols defined in LLVMPasses that are referenced by the
destructor of `PassBuilder` are now referenced by LLVMOrcJIT through
`Speculation.cpp.o`.
We believe that referencing symbols defined in LLVMPasses in the
destructor of `PassBuilder` is valid, and that adding to the set of such
symbols is legitimate. To support such cases, this patch adds LLVMPasses
to the set of libraries being linked when linking in LLVMOrcJIT causes
such symbols from LLVMPasses to be referenced.
Reviewers: Whitney, anhtuyen, pree-jackie
Reviewed By: pree-jackie
Subscribers: mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66441
llvm-svn: 369310
Joel E. Denny [Mon, 19 Aug 2019 22:59:37 +0000 (22:59 +0000)]
[lit] Check for accidental external command calls
This patch extends lit's test suite to check that lit's internal shell
doesn't accidentally execute internal commands as external commands.
It does so by putting fake failing versions of those commands in
`PATH` while the entire lit test suite is running. Without the fixes
in D65697 but with its tests, this approach catches accidental
external `env` calls.
Reviewed By: probinson
Differential Revision: https://reviews.llvm.org/D66293
llvm-svn: 369309
Anton Afanasyev [Mon, 19 Aug 2019 22:58:26 +0000 (22:58 +0000)]
[Support][Time profiler] Make FE codegen blocks to be inside frontend blocks
Summary:
Add `Frontend` time trace entry to `HandleTranslationUnit()` function.
Add test to check all codegen blocks are inside frontend blocks.
Also, change `--time-trace-granularity` option a bit to make sure very small
time blocks are outputed to json-file when using `--time-trace-granularity=0`.
This fixes http://llvm.org/pr41969
Reviewers: russell.gallop, lebedev.ri, thakis
Reviewed By: russell.gallop
Subscribers: vsapsai, aras-p, lebedev.ri, hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D63325
llvm-svn: 369308
Saleem Abdulrasool [Mon, 19 Aug 2019 22:45:01 +0000 (22:45 +0000)]
Windows: Include "windows" Instead of "Windows"
The actual include directory is lldb/Host/windows not
lldb/Host/Windows which breaks on case sensitive file systems
Patch by Gwen Mittertreiner!
llvm-svn: 369307
Matthias Gehre [Mon, 19 Aug 2019 21:59:44 +0000 (21:59 +0000)]
[ORC] fix use-after-free detected by -Wreturn-stack-address
Summary:
llvm/lib/ExecutionEngine/Orc/Layer.cpp:53:12: warning: returning address of local temporary object [-Wreturn-stack-address]
In
```
StringRef IRMaterializationUnit::getName() const {
[...]
return TSM.withModuleDo(
[](const Module &M) { return M.getModuleIdentifier(); });
```
`getModuleIdentifier()` returns a `const std::string &`, but the implicit return type
of the lambda is `std::string` by value, and thus the returned `StringRef` refers
to a temporary `std::string`.
Detect by annotating `llvm::StringRef` with `[[gsl::Pointer]]`.
Reviewers: lhames, sgraenitz
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66440
llvm-svn: 369306
Johannes Doerfert [Mon, 19 Aug 2019 21:56:38 +0000 (21:56 +0000)]
[CaptureTracker] Let subclasses provide dereferenceability information
Summary:
CaptureTracker subclasses might have better dereferenceability
information which allows null pointer checks to be no-capturing.
The first user will be D59922.
Reviewers: sanjoy, hfinkel, aykevl, sstefan1, uenoku, xbolva00
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66371
llvm-svn: 369305
Matthias Gehre [Mon, 19 Aug 2019 21:39:16 +0000 (21:39 +0000)]
Fix use-after-free
Summary:
The warning
```
lldb/source/Core/FormatEntity.cpp:2350:25: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling]
```
is emitted after annotating `llvm::StringRef` with `[[gsl::Pointer]]`.
The reason is that in
```
size_t FormatEntity::AutoComplete(CompletionRequest &request) {
llvm::StringRef str = request.GetCursorArgumentPrefix().str();
```
the function `GetCursorArgumentPrefix()` returns a `StringRef`, and `StringRef::str()` returns
a temporary `std::string`.
Reviewers: jingham, JDevlieghere
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D66442
llvm-svn: 369304
Johannes Doerfert [Mon, 19 Aug 2019 21:35:31 +0000 (21:35 +0000)]
Recommit "[Attributor] Fix: Do not partially resolve returned calls."
This reverts commit
b1752f670f3d6393306dd5d37546b6e23384d8a2.
Fixed the issue with a different commit, reapply this one as it was,
afaik, not broken.
llvm-svn: 369303
Seiya Nuta [Mon, 19 Aug 2019 21:12:02 +0000 (21:12 +0000)]
Recommit "[llvm-objcopy][MachO] Implement a layout algorithm for executables"
Summary: The layout algorithm for relocatable objects and for executable are somewhat different. This patch implements the latter one based on the algorithm in LLD (MachOFileLayout).
Reviewers: alexshap, rupprecht, jhenderson
Reviewed By: alexshap
Subscribers: jakehehrlich, abrachet, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65539
llvm-svn: 369301
Evgeniy Stepanov [Mon, 19 Aug 2019 21:08:04 +0000 (21:08 +0000)]
Refactor isPointerOffset (NFC).
Summary:
Simplify the API using Optional<> and address comments in
https://reviews.llvm.org/D66165
Reviewers: vitalybuka
Subscribers: hiraditya, llvm-commits, ostannard, pcc
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66317
llvm-svn: 369300
Vyacheslav Zakharin [Mon, 19 Aug 2019 21:07:03 +0000 (21:07 +0000)]
Fixed placement of llvm.global_dtors on Windows.
Differential revision: https://reviews.llvm.org/D66373
llvm-svn: 369299
Seiya Nuta [Mon, 19 Aug 2019 21:05:31 +0000 (21:05 +0000)]
Recommit "[llvm-objcopy][MachO] Support load commands used in executables/shared libraries"
Summary:
This patch implements copying some load commands that appear in executables/shared libraries such as the indirect symbol table.
I don't add tests intentionally because this patch is incomplete: we need a layout algorithm for executables/shared libraries. I'll submit it as a separate patch with tests.
Reviewers: alexshap, rupprecht, jhenderson, compnerd
Reviewed By: alexshap
Subscribers: abrachet, mgorny, mgrang, MaskRay, mtrent, jakehehrlich, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63395
llvm-svn: 369298
Evgeniy Stepanov [Mon, 19 Aug 2019 20:47:09 +0000 (20:47 +0000)]
MemTag: stack initializer merging.
Summary:
MTE provides instructions to update memory tags and data at the same
time. This change makes use of those to generate more compact code for
stack variable tagging + initialization.
We collect memory store and memset instructions following an alloca or a
lifetime.start call, and replace them with the corresponding MTE
intrinsics. Since the intrinsics work on 16-byte aligned chunks, the
stored values are combined as necessary.
Reviewers: pcc, vitalybuka, ostannard
Subscribers: srhines, javed.absar, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66167
llvm-svn: 369297
Alex Langford [Mon, 19 Aug 2019 20:17:27 +0000 (20:17 +0000)]
[lldb-vscode] add `launchCommands` to handle launch specific commands
Summary:
This can help `lldb-vscode` handle launch commands associate with remote platform
attach request have field `attachCommands` to handle attach specific commands
add a corresponding one for launch request
if no launch command is provided, create a new target and launch; otherwise, execute the launch command
Differential Revision: https://reviews.llvm.org/D65363
Patch by Wanyi Ye <kusmour@gmail.com>
llvm-svn: 369296
Benjamin Kramer [Mon, 19 Aug 2019 19:49:57 +0000 (19:49 +0000)]
[Support] Replace sys::Mutex with their standard equivalents.
Only use a recursive mutex if it can be locked recursively.
llvm-svn: 369295
Johannes Doerfert [Mon, 19 Aug 2019 19:14:10 +0000 (19:14 +0000)]
Re-apply fixed "[Attributor] Fix: Make sure we set the changed flag"
This reverts commit
cedd0d9a6e4b433e1cd6585d1d4d152eb5e60b11.
Re-apply the original commit but make sure the variables are initialized
(even if they are not used) so UBSan is not complaining.
llvm-svn: 369294
Raphael Isemann [Mon, 19 Aug 2019 19:13:26 +0000 (19:13 +0000)]
[lldb] Make TestIOHandlerCompletion more stable and document it
Instead of relying that three tabs show all completions, we should
show all remaining completions which will always stop the mode
where we show completions. Should fix this test on systems that
somehow have more completions that our normal LLDB (as they
would end up being stuck in the mode where we show completions).
llvm-svn: 369293
Sam Clegg [Mon, 19 Aug 2019 19:04:54 +0000 (19:04 +0000)]
[WebAssembly][MC] Allow empty assembly functions
Differential Revision: https://reviews.llvm.org/D66434
llvm-svn: 369292
Alina Sbirlea [Mon, 19 Aug 2019 18:57:40 +0000 (18:57 +0000)]
[MemorySSA] Rename uses when inserting memory uses.
Summary:
When inserting uses from outside the MemorySSA creation, we don't
normally need to rename uses, based on the assumption that there will be
no inserted Phis (if Def existed that required a Phi, that Phi already
exists). However, when dealing with unreachable blocks, MemorySSA will
optimize away Phis whose incoming blocks are unreachable, and these Phis end
up being re-added when inserting a Use.
There are two potential solutions here:
1. Analyze the inserted Phis and clean them up if they are unneeded
(current method for cleaning up trivial phis does not cover this)
2. Leave the Phi in place and rename uses, the same way as whe inserting
defs.
This patch use approach 2.
Resolves first test in PR42940.
Reviewers: george.burgess.iv
Subscribers: Prazek, sanjoy.google, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66033
llvm-svn: 369291
Peter Collingbourne [Mon, 19 Aug 2019 18:43:52 +0000 (18:43 +0000)]
Build symbolizer runtime with C++14.
Should hopefully fix sanitizer-x86_64-linux bot.
llvm-svn: 369290
Julian Lettner [Mon, 19 Aug 2019 18:41:20 +0000 (18:41 +0000)]
[TSan] Rename file to make it clear that it defines interceptors
Rename file `tsan_libdispatch.cpp -> tsan_libdispatch_interceptors.cpp`
to make it clear that it's main purpose is defining interceptors.
llvm-svn: 369289
Andrea Di Biagio [Mon, 19 Aug 2019 18:20:30 +0000 (18:20 +0000)]
[X86] Move scheduling tests for CMPXCHG to the corresponding resources-x86_64.s files. NFC
In D66424 it has been requested to move all the new tests added by r369278 into
resources-x86_64.s. That is because only the 8b/16 ops should be tested by
resources-cmpxchg.s. This partially reverts r369278.
llvm-svn: 369288
Craig Topper [Mon, 19 Aug 2019 18:15:50 +0000 (18:15 +0000)]
[X86] Teach lowerV4I32Shuffle to only use broadcasts if the mask has more than one undef element. Prioritize shifts over broadcast in lowerV8I16Shuffle.
The motivating case are the changes in vector-reduce-add.ll where
we were doing extra work in the scalar domain instead of shuffling.
There may be some one use check that needs to be looked into there,
but this patch sidesteps the issue by avoiding broadcasts that
aren't really broadcasting.
Differential Revision: https://reviews.llvm.org/D66071
llvm-svn: 369287
Erich Keane [Mon, 19 Aug 2019 18:14:22 +0000 (18:14 +0000)]
Fix poorly formatted HTML in the cxx_status.html file caused by adding
1668.
llvm-svn: 369286
David Carlier [Mon, 19 Aug 2019 18:12:15 +0000 (18:12 +0000)]
[Sanitizer] arc4random interception on Mac
Reviewers: yln,vitalybuka
Reviewed By: yln
Differential Revision: https://reviews.llvm.org/D66391
llvm-svn: 369285
Erich Keane [Mon, 19 Aug 2019 18:08:52 +0000 (18:08 +0000)]
Fix test where diagnostics changed in P1668 implementation
llvm-svn: 369284
Craig Topper [Mon, 19 Aug 2019 18:02:24 +0000 (18:02 +0000)]
[CGP] Remove ModifiedDT from the makeBitReverse loop
I don't think anything in this loop modifies the control flow and we don't restart any iteration after setting the flag.
This code was added in http://reviews.llvm.org/D16893 but looking at the test case added there the code that caused the dominator tree to change was merging blocks with their predecessor not the bitreverse optimization.
Differential Revision: https://reviews.llvm.org/D66366
llvm-svn: 369283
Erich Keane [Mon, 19 Aug 2019 17:57:27 +0000 (17:57 +0000)]
Update cxx_status.html with P1668 status.
llvm-svn: 369282
Erich Keane [Mon, 19 Aug 2019 17:39:59 +0000 (17:39 +0000)]
Implement P1668R1
Allow inline assembly statements in unexecuted branches of constexpr
functions.
llvm-svn: 369281
Louis Dionne [Mon, 19 Aug 2019 17:29:42 +0000 (17:29 +0000)]
[libc++] Add XFAIL for is_base_of test on AppleClang 11
llvm-svn: 369280
Andrea Di Biagio [Mon, 19 Aug 2019 17:07:26 +0000 (17:07 +0000)]
[X86] Added extensive scheduling model tests for all the CMPXCHG variants. NFC
Addresses a review comment in D66424
llvm-svn: 369279
Stefan Stipanovic [Mon, 19 Aug 2019 16:39:32 +0000 (16:39 +0000)]
[Attributor] -attributor-verify has false positives. Temporarily remove
it, until resolved.
llvm-svn: 369277
Sam Clegg [Mon, 19 Aug 2019 16:34:51 +0000 (16:34 +0000)]
[lld][WebAssembly] Honor --no-export-dynamic even with -shared
Differential Revision: https://reviews.llvm.org/D66359
llvm-svn: 369276
Johan Vikstrom [Mon, 19 Aug 2019 16:27:49 +0000 (16:27 +0000)]
[clangd] Added highlighting for tokens that are macro arguments.
Summary:
Adds semantic highlighting for tokens that are a macro argument.
Example:
```
D_V(SomeVar);
```
The "SomeVar" inside the macro is highlighted as a variable now.
Tokens that are in a macro body expansion are ignored in this patch for three reasons.
* The spelling loc is inside the macro "definition" meaning it would highlight inside the macro definition (could probably easily be fixed by using getExpansionLoc instead of getSpellingLoc?)
* If wanting to highlight the macro definition this could create duplicate tokens. And if the tokens are of different types there would be conflicts (tokens in the same range but with different types). Say a macro defines some name and both a variable declaration and a function use this, there would be two tokens in the macro definition but one with Kind "Variable" and the other with Kind "Function".
* Thirdly, macro body expansions could come from a file that is not the main file (easily fixed, just check that the Loc is in the main file and not even a problem if we wanted to highlight the actual macro "invocation")
Reviewers: hokein, sammccall, ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64741
llvm-svn: 369275
Jonas Devlieghere [Mon, 19 Aug 2019 16:04:21 +0000 (16:04 +0000)]
[dotest] Add --dwarf-version to override the tested DWARF version.
On the matrix bot on GreenDragon [1] we want to run the test suite
against different DWARF versions. The idea here is not to replace
targeted tests for certain DWARF features, but rather to provide an easy
way to support this configuration.
[1] http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/
Differential revision: https://reviews.llvm.org/D66370
llvm-svn: 369272
Fangrui Song [Mon, 19 Aug 2019 15:52:29 +0000 (15:52 +0000)]
[ELF] Simplify processRelocAux and allow a corner-case error
After D66007/r369262, if the control flow reaches `if (sym.isUndefined())`, we know:
* The relocation is not a link-time constant => symbol is preemptable => Undefined or SharedSymbol
* Not an undef weak.
* -no-pie.
* The symbol type is neither STT_OBJECT nor STT_FUNC.
ld.lld --export-dynamic --unresolved-symbols=ignore-all %t.o can satisfy
these conditions. Delete the isUndefined() test so that we error
`symbol '...' has no type`, because we don't know the type to make the
decision to create copy relocation/canonical PLT.
llvm-svn: 369271
Zoe Carver [Mon, 19 Aug 2019 15:47:16 +0000 (15:47 +0000)]
[libc++] reverts commit
a5f5aad568bb7a91ceee47641f3076ac339ef8c7.
The commit being reverted caused segfaults when building
with libc++ and GCC (and possibly other configurations).
Differential Revision: https://reviews.llvm.org/D62868
llvm-svn: 369270
Pavel Labath [Mon, 19 Aug 2019 15:40:49 +0000 (15:40 +0000)]
Filesystem/Windows: fix inconsistency in readNativeFileSlice API
Summary:
The windows version implementation of readNativeFileSlice, was trying to
match the POSIX behavior of not treating EOF as an error, but it was
only handling the case of reading from a pipe. Attempting to read past
the end of a regular file returns a slightly different error code, which
needs to be handled too. This patch adds ERROR_HANDLE_EOF to the list of
error codes to be treated as an end of file, and adds some unit tests
for the API.
This issue was found while attempting to land D66224, which caused a bunch of
lldb tests to start failing on windows.
Reviewers: rnk, aganea
Subscribers: kristina, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66344
llvm-svn: 369269
Roman Lebedev [Mon, 19 Aug 2019 15:01:42 +0000 (15:01 +0000)]
[TargetLowering] x s% C == 0 fold: vector divisor with INT_MIN handling
Summary:
The general fold is only valid for positive divisors.
Which effectively means, it is invalid for `INT_MIN` divisors,
and we currently bailout if we see them.
But that is too strict, we can just fix-up the results.
For that, let's do a second computation 'in parallel':
```
Name: srem -> and
Pre: isPowerOf2(C)
%o = srem i8 %X, C
%r = icmp eq %o, 0
=>
%n = and i8 %X, C-1
%r = icmp eq %n, 0
```
https://rise4fun.com/Alive/Sup
And then just blend results: if the divisor was `INT_MIN`,
pick the value we got via bit-test,
else pick the value from general fold.
There's interesting observation - `ISD::ROTR` is set to
`LegalizeAction::Expand` before AVX512, so we should not
treat `INT_MIN` divisor as even; and as it can be seen
while `@test_srem_odd_even_one` improves on all run-lines,
`@test_srem_odd_even_INT_MIN` only improves for AVX512.
Reviewers: RKSimon, craig.topper, spatel
Reviewed By: RKSimon
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66300
llvm-svn: 369268
Raphael Isemann [Mon, 19 Aug 2019 14:52:48 +0000 (14:52 +0000)]
[lldb][NFC] Stop using GetNumberOfMatches in CompletionRequest test
This function is just a wrapper for GetNumberOfResults and will
be removed soon. This patch just changes all calls to GetNumberOfResults
where possible (which is currently just the unit test).
llvm-svn: 369267
Serge Guelton [Mon, 19 Aug 2019 14:40:33 +0000 (14:40 +0000)]
[nfc] Silent gcc warning
llvm-svn: 369266
George Rimar [Mon, 19 Aug 2019 14:35:08 +0000 (14:35 +0000)]
[llvm-objdump] - Restore lost comment.
It was removed by mistake in r369263 (D66417).
llvm-svn: 369265
Amaury Sechet [Mon, 19 Aug 2019 14:34:08 +0000 (14:34 +0000)]
Automatically generate AVX512 test cases. NFC
llvm-svn: 369264
George Rimar [Mon, 19 Aug 2019 14:32:23 +0000 (14:32 +0000)]
[Object/COFF.h] - Stop returning std::error_code in a few methods. NFCI.
There are 4 methods that return std::error_code now,
though they do not have to because they are always succeed.
I refactored them.
This allows to simplify the code in tools a bit.
llvm-svn: 369263
Fangrui Song [Mon, 19 Aug 2019 14:30:12 +0000 (14:30 +0000)]
[ELF] Move (copy relocation/canonical PLT) before error checking
In processRelocAux(), we handle errors before copy relocation/canonical PLT.
This makes error checking a bit complex because we have to check for
conditions that will be allowed by copy relocation/canonical PLT.
Instead, move copy relocation/canonical PLT before error checking. This
simplifies the previous clumsy error checking code
`config->shared || (config->pie && expr == R_ABS && type != target->symbolicRel)`
to the simple `config->isPic`. Some diagnostics can be reported in
different ways. The code motion changes diagnostics for some contrived
test cases:
* copy-rel-pie-error.s -> copy-rel-pie2.s:
It was rejected before but accepted now. ld.bfd also accepts the case.
* copy-errors.s: "cannot preempt symbol" changes to "symbol 'bar' has no type"
* got32{,x}-i386.s: the suggestion changes from "-fPIC or -Wl,-z,notext" to "-fPIE"
* x86-64-dyn-rel-error5.s: one diagnostic changes for -pie case
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D66007
llvm-svn: 369262
Jinsong Ji [Mon, 19 Aug 2019 14:19:04 +0000 (14:19 +0000)]
[PeepholeOptimizer] Don't assume bitcast def always has input
Summary:
If we have a MI marked with bitcast bits, but without input operands,
PeepholeOptimizer might crash with assert.
eg:
If we apply the changes in PPCInstrVSX.td as in this patch:
[(set v4i32:$XT, (bitconvert (v16i8 immAllOnesV)))]>;
We will get assert in PeepholeOptimizer.
```
llvm-lit llvm-project/llvm/test/CodeGen/PowerPC/build-vector-tests.ll -v
llvm-project/llvm/include/llvm/CodeGen/MachineInstr.h:417: const
llvm::MachineOperand &llvm::MachineInstr::getOperand(unsigned int)
const: Assertion `i < getNumOperands() && "getOperand() out of range!"'
failed.
```
The fix is to abort if we found out of bound access.
Reviewers: qcolombet, MatzeB, hfinkel, arsenm
Reviewed By: qcolombet
Subscribers: wdng, arsenm, steven.zhang, wuzish, nemanjai, hiraditya, kbarton, MaskRay, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65542
llvm-svn: 369261
Fangrui Song [Mon, 19 Aug 2019 14:07:14 +0000 (14:07 +0000)]
[ELF][Hexagon] Improve error message for unknown relocations
Like rLLD354040
Previously, for unknown relocation types, in -no-pie/-pie mode, we got something like:
foo.o: unrecognized relocation ...
In -shared mode:
error: can't create dynamic relocation ... against symbol: yyy in readonly segment
Delete the default case from Hexagon::getRelExpr and add the error there. We will get consistent error message like `error: unknown relocation (1024) against symbol foo`
Reviewed By: sidneym
Differential Revision: https://reviews.llvm.org/D66275
llvm-svn: 369260
Aaron Ballman [Mon, 19 Aug 2019 13:37:41 +0000 (13:37 +0000)]
Don't keep stale pointers to LoopInfos.
CGLoopInfo was keeping pointers to parent loop LoopInfos, but when the loop info vector grew, it reallocated the storage and invalidated all of the parent pointers, causing use-after-free. Manage the lifetimes of the LoopInfos separately so that the pointers aren't stale.
Patch by Bevin Hansson.
llvm-svn: 369259
Sid Manning [Mon, 19 Aug 2019 13:32:32 +0000 (13:32 +0000)]
[lld][Hexagon] Add GOTREL relocations.
Add GOTREL relocation support. (S + A - GOT)
Differential Revision: https://reviews.llvm.org/D66260
llvm-svn: 369258
Alex Bradbury [Mon, 19 Aug 2019 13:23:02 +0000 (13:23 +0000)]
[RISCV] Don't force absolute FK_Data_X fixups to relocs
The current behavior of shouldForceRelocation forces relocations for the
majority of fixups when relaxation is enabled. This makes sense for
fixups which incorporate symbols but is unnecessary for simple data
fixups where the fixup target is already resolved to an absolute value.
Differential Revision: https://reviews.llvm.org/D63404
Patch by Edward Jones.
llvm-svn: 369257
David Stenberg [Mon, 19 Aug 2019 12:41:22 +0000 (12:41 +0000)]
[DebugInfo] Allow bundled calls in the MIR's call site info
Summary:
Extend the MIR parser and writer so that the call site information can
refer to calls that are bundled.
Reviewers: aprantl, asowda, NikolaPrica, djtodoro, ivanbaev, vsk
Reviewed By: aprantl
Subscribers: arsenm, hiraditya, llvm-commits
Tags: #debug-info, #llvm
Differential Revision: https://reviews.llvm.org/D66145
llvm-svn: 369256
Sanjay Patel [Mon, 19 Aug 2019 12:41:09 +0000 (12:41 +0000)]
[SLP] add test that requires shuffle of scalars; NFC
llvm-svn: 369255
Fangrui Song [Mon, 19 Aug 2019 12:18:18 +0000 (12:18 +0000)]
[llvm-readobj] unwrapOrError: remove unnecessary llvm_unreachable after r369194
llvm-svn: 369254
Sven van Haastregt [Mon, 19 Aug 2019 11:56:03 +0000 (11:56 +0000)]
[OpenCL] Add generic type handling for builtin functions
Generic types are an abstraction of type sets. It mimics the way
functions are defined in the OpenCL specification. For example,
floatN can abstract all the vector sizes of the float type.
This allows to
* stick more closely to the specification, which uses generic types;
* factorize definitions of functions with numerous prototypes in the
tablegen file; and
* reduce the memory impact of functions with many overloads.
Patch by Pierre Gondois and Sven van Haastregt.
Differential Revision: https://reviews.llvm.org/D65456
llvm-svn: 369253
Raphael Isemann [Mon, 19 Aug 2019 11:49:43 +0000 (11:49 +0000)]
[lldb][NFC] Use CompletionRequest in Variable::AutoComplete
llvm-svn: 369252
Anastasia Stulova [Mon, 19 Aug 2019 11:43:16 +0000 (11:43 +0000)]
[OpenCL] Fix addr space deduction for pointers/references to arrays.
Rewrite the logic for detecting if we are deducing addr space of
a pointee type to take into account special logic for arrays. For
pointers/references to arrays we can have any number of parentheses
expressions as well as nested pointers.
Differential Revision: https://reviews.llvm.org/D66137
llvm-svn: 369251
Sanjay Patel [Mon, 19 Aug 2019 11:39:56 +0000 (11:39 +0000)]
[SLP] reduce duplicated code; NFC
llvm-svn: 369250
Raphael Isemann [Mon, 19 Aug 2019 10:46:38 +0000 (10:46 +0000)]
[lldb][NFC] Add a few more completion tests to increase test coverage
These tests are mostly trying to reach the different completion functions
in CommandCompletions.cpp (::ArchitectureNames, ::DiskFiles, ::Modules).
llvm-svn: 369249
Fangrui Song [Mon, 19 Aug 2019 10:05:59 +0000 (10:05 +0000)]
[MC] Simplify ELFObjectWriter::recordRelocation. NFC
llvm-svn: 369248
Jeremy Morse [Mon, 19 Aug 2019 09:53:07 +0000 (09:53 +0000)]
[DebugInfo] Make postra sinking of DBG_VALUEs subregister-safe
Currently the machine instruction sinker identifies DBG_VALUE insts that
also need to sink by comparing register numbers. Unfortunately this isn't
safe, because (after register allocation) a DBG_VALUE may read a register
that aliases what's being sunk. To fix this, identify the DBG_VALUEs that
need to sink by recording & examining their register units. Register units
gives us the following guarantee:
"Two registers overlap if and only if they have a common register unit"
[MCRegisterInfo.h]
Thus we can always identify aliasing DBG_VALUEs if the set of register
units read by the DBG_VALUE, and the register units of the instruction
being sunk, intersect. (MachineSink already uses classes like
"LiveRegUnits" for determining sinking validity anyway).
The test added checks for super and subregister DBG_VALUE reads of a sunk
copy being sunk as well.
Differential Revision: https://reviews.llvm.org/D58191
llvm-svn: 369247
Peter Smith [Mon, 19 Aug 2019 09:46:52 +0000 (09:46 +0000)]
[ELF][ARM] Add a test that maxes out the thunk convergence limit
Add a test that takes the maximum amount of passes permitted to converge.
This will make sure that any symbol defined in a linker script gets the
correct value and that any other convergence limit involving symbol address
doesn't restrict Thunk convergence.
Differential Revision: https://reviews.llvm.org/D66346
llvm-svn: 369246
Sam Tebbs [Mon, 19 Aug 2019 09:38:28 +0000 (09:38 +0000)]
[ARM] Add support for MVE vaddv
This patch adds vecreduce_add and the relevant instruction selection for
vaddv.
Differential revision: https://reviews.llvm.org/D66085
llvm-svn: 369245
David Green [Mon, 19 Aug 2019 09:13:22 +0000 (09:13 +0000)]
[ARM] MVE sext costs
This adds some sext costs for MVE, taken from the length of assembly sequences
that we currently generate.
Differential Revision: https://reviews.llvm.org/D66010
llvm-svn: 369244
Jeremy Morse [Mon, 19 Aug 2019 09:02:18 +0000 (09:02 +0000)]
[DebugInfo] Test for variable range un-coalescing
LiveDebugVariables can coalesce ranges of variable locations across
multiple basic blocks. However when it recreates DBG_VALUE instructions,
it has to recreate one DBG_VALUE per block, otherwise it doesn't
represent the pre-regalloc layout and variable assignments can go missing.
This feature works -- however while mucking around with LiveDebugVariables,
I commented the relevant code it out and no tests failed. Thus, here's a
test that checks LiveDebugVariables preserves DBG_VALUEs across block
boundaries.
Differential Revision: https://reviews.llvm.org/D66347
llvm-svn: 369243
Raphael Isemann [Mon, 19 Aug 2019 08:15:46 +0000 (08:15 +0000)]
[lldb][NFC] Remove StringList::AutoComplete
We don't need this very specific function in StringList that
we only call once in LLDB.
llvm-svn: 369242