Commit Graph

412563 Commits

Author SHA1 Message Date
Casey Carter 93230ac1d2 [libcxx][test] Use bool allocators for vector<bool>::get_allocator test
... to be consistent with other `get_allocator` tests, and to avoid requiring `vector<T, allocator<U>>` to be valid.
2022-01-25 10:29:12 -08:00
Fangrui Song 4cdc441690 [ELF] Parallelize --compress-debug-sections=zlib
When linking a Debug build clang (265MiB SHF_ALLOC sections, 920MiB uncompressed
debug info), in a --threads=1 link "Compress debug sections" takes 2/3 time and
in a --threads=8 link "Compress debug sections" takes ~70% time.

This patch splits a section into 1MiB shards and calls zlib `deflake` parallelly.

DEFLATE blocks are a bit sequence. We need to ensure every shard starts
at a byte boundary for concatenation. We use Z_SYNC_FLUSH for all shards
but the last to flush the output to a byte boundary. (Z_FULL_FLUSH can
be used as well, but Z_FULL_FLUSH clears the hash table which just
wastes time.)

The last block requires the BFINAL flag. We call deflate with Z_FINISH
to set the flag as well as flush the output to a byte boundary. Under
the hood, all of Z_SYNC_FLUSH, Z_FULL_FLUSH, and Z_FINISH emit a
non-compressed block (called stored block in zlib). RFC1951 says "Any
bits of input up to the next byte boundary are ignored."

In a --threads=8 link, "Compress debug sections" is 5.7x as fast and the total
speed is 2.54x. Because the hash table for one shard is not shared with the next
shard, the output is slightly larger. Better compression ratio can be achieved
by preloading the window size from the previous shard as dictionary
(`deflateSetDictionary`), but that is overkill.

```
# 1MiB shards
% bloaty clang.new -- clang.old
    FILE SIZE        VM SIZE
 --------------  --------------
  +0.3%  +129Ki  [ = ]       0    .debug_str
  +0.1%  +105Ki  [ = ]       0    .debug_info
  +0.3%  +101Ki  [ = ]       0    .debug_line
  +0.2% +2.66Ki  [ = ]       0    .debug_abbrev
  +0.0% +1.19Ki  [ = ]       0    .debug_ranges
  +0.1%  +341Ki  [ = ]       0    TOTAL

# 2MiB shards
% bloaty clang.new -- clang.old
    FILE SIZE        VM SIZE
 --------------  --------------
  +0.2% +74.2Ki  [ = ]       0    .debug_line
  +0.1% +72.3Ki  [ = ]       0    .debug_str
  +0.0% +69.9Ki  [ = ]       0    .debug_info
  +0.1%    +976  [ = ]       0    .debug_abbrev
  +0.0%    +882  [ = ]       0    .debug_ranges
  +0.0%  +218Ki  [ = ]       0    TOTAL
```

Bonus in not using zlib::compress

* we can compress a debug section larger than 4GiB
* peak memory usage is lower because for most shards the output size is less
  than 50% input size (all less than 55% for a large binary I tested, but
  decreasing the initial output size does not decrease memory usage)

Reviewed By: ikudrin

Differential Revision: https://reviews.llvm.org/D117853
2022-01-25 10:29:04 -08:00
serge-sans-paille 4eb909c884 Cleanup header dependencies of llvm/Support/Compiler.h
<new> and <cstdef> were introduced in aa60b3fd87 but the dependency
is now dead.

As a consequence you may need to include <new> where you use it while it
was auto-included as an implicit dependency before.

The impact on the codebase is small, as <new> is a very small header
(<100 SLOC) but it gets included everywhere, so that somehow counts (?)
2022-01-25 19:25:42 +01:00
Mark de Wever ee522345ae [libc++][doc] Update format implementation status. 2022-01-25 19:23:48 +01:00
eopXD 970a191203 [Clang][RISCV] Guard vmulh, vsmul correctly
According to v-spec 1.0, `vmulh`, `vmulhu`, `vmulhsu` and `vsmul` are
NOT supported for EEW=64 in Zve64*.

This patch tries to guard it correctly.

Authored by: Craig Topper <craig.topper@sifive.com> @craig.topper
Co-Authored by: Eop Chen <eop.chen@sifive.com> @eopXD

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D117913
2022-01-25 10:19:12 -08:00
David Green c415ff186d [AArch64] Add extra vecreduce.add tests, including extending reductions. NFC
This is all the reductions from i8 -> i64 with either sign or zero
extensions.
2022-01-25 18:10:09 +00:00
Zinovy Nis 19d7a0b47b [clang-tidy] [bugprone-assert-side-effect] Ignore list for functions/methods
A semicolon-separated list of the names of functions or methods to be considered as not having side-effects was added for bugprone-assert-side-effect. It can be used to exclude methods like iterator::begin/end from being considered as having side-effects.

Differential Revision: https://reviews.llvm.org/D116478
2022-01-25 21:04:07 +03:00
Jonas Devlieghere c2cd7cc63c [lldb] Only include mach headers on Darwin 2022-01-25 09:58:47 -08:00
David Blaikie 87e68cae50 Improve relnotes for the DWARFv5 default change 2022-01-25 09:56:07 -08:00
eopXD b089e4072a [RISCV] Don't allow i64 vector div by constant to use mulh with Zve64x
EEW=64 of mulh and its vairants requires V extension.

Authored by: Craig Topper <craig.topper@sifive.com> @craig.topper

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D117947
2022-01-25 09:55:05 -08:00
Steven Wan 575c5d2a99 Disable Go binding test on AIX
Disable the Go binding test on AIX because building the binding on AIX with Clang is currently unsupported.

Reviewed By: ZarkoCA

Differential Revision: https://reviews.llvm.org/D117505
2022-01-25 12:39:01 -05:00
Jonas Devlieghere d7e183b225 [lldb] Use new dyld SPIs to query the shared cache local symbols
rdar://85492172
2022-01-25 09:36:48 -08:00
Andrew Litteken dcc3e728ca [IROutliner] Allowing Phi Nodes in exit blocks
In addition to having multiple exit locations, there can be multiple blocks leading to the same exit location, which results in a potential phi node. If we find that multiple blocks within the region branch to the same block outside the region, resulting in a phi node, the code extractor pulls this phi node into the function and uses it as an output.

We make sure that this phi node is given an output slot, and that the two values are removed from the outputs if they are not used anywhere else outside of the region. Across the extracted regions, the phi nodes are combined into a single block for each potential output block, similar to the previous patch.

Reviewers: paquette

Differential Revision: https://reviews.llvm.org/D106995
2022-01-25 11:33:53 -06:00
Ashley Hedberg bd1fac2faf Add assert on End iteration distance to Rewriter::getRewrittenText.
I currently have code that is crashing in the second std::advance call,
and it was not straightforward to identify the problem, as the first line
of the stacktrace is in RopePieceBTreeIterator::operator++:

```

*** SIGILL; stack trace: ***
PC: clang/include/clang/Rewrite/Core/RewriteRope.h:119 clang::RopePieceBTreeIterator::operator++()
    ../include/c++/v1/__iterator/advance.h:35 std::__u::__advance<>()
    ../include/c++/v1/__iterator/advance.h:65 std::__u::advance<>()
    clang/lib/Rewrite/Rewriter.cpp:228 clang::Rewriter::getRewrittenText()
    clang/include/clang/Rewrite/Core/Rewriter.h:106 clang::Rewriter::getRewrittenText()
```

Adding an assertion produces a friendlier error message for the caller.

Reviewed By: gribozavr2

Differential Revision: https://reviews.llvm.org/D117579
2022-01-25 17:26:13 +00:00
Leonard Grey a5c9d71780 [lld-macho] Move order file and call graph sorting into SectionPriorities
See https://reviews.llvm.org/D117354 for context and discussion.
2022-01-25 12:18:15 -05:00
Leonard Grey f23d57a632 [lld-macho] Rename CallGraphSort.{h,cpp} to SectionPriorities
This is in preparation for moving the code that parses and processes
order files into this file.

See https://reviews.llvm.org/D117354 for context and discussion.
2022-01-25 12:15:14 -05:00
Adrian Prantl a22d870a4e Add missing include diagnosed by moduels build. 2022-01-25 09:08:13 -08:00
Alex Brachet ce368e1aa5 [libc][NFC] Workaround clang assertion in inline asm
The clobber list "cc" is added to inline assembly to workaround a clang assertion that triggers when building with a clang built with assertions enabled. See bug [53391](https://github.com/llvm/llvm-project/issues/53391).

See https://godbolt.org/z/z3bc6a9PM showing functionally same output assembly.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D118099
2022-01-25 16:39:55 +00:00
Stanislav Gatev 64ba462b6e [clang][dataflow] Add a transfer function for InitListExpr
This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: xazax.hun

Differential Revision: https://reviews.llvm.org/D118119
2022-01-25 16:28:15 +00:00
Ben Langmuir 0e5ea403e8 Fix running orc-rt tests with LLVM_BUILD_EXTERNAL_COMPILER_RT
Add missing dependency on llvm-jitlink when building compiler-rt with
LLVM_BUILD_EXTERNAL_COMPILER_RT. Previously we would
non-deterministically fail the tests due to the missing binary.

rdar://87247681

Differential Revision: https://reviews.llvm.org/D118087
2022-01-25 08:27:40 -08:00
Simon Pilgrim ef0d90f682 [X86] Regenerate avx-vbroadcast.ll
Remove '' around mattr to stop update script crash and use X86 prefixes instead of X32
2022-01-25 16:23:22 +00:00
Nikita Popov 2f02c7e1f2 [SanitizerCoverage] Avoid pointer element type access
Use the load/store type instead.
2022-01-25 17:22:20 +01:00
serge-sans-paille adc9a346d8 Always use df_iterator_default_set as default set type for [i]df_ext_iterator
This is consistent with other default values in this file.
2022-01-25 16:59:17 +01:00
serge-sans-paille 519810d63e [NFC] Refine header dependencies of llvm/ADT/Any.h 2022-01-25 16:59:17 +01:00
Tue Ly e581841e8c [libc] Implement log10f correctly rounded for all rounding modes.
Based on RLIBM implementation similar to logf and log2f.  Most of the exceptional inputs are the exact powers of 10.

Reviewed By: sivachandra, zimmermann6, santoshn, jpl169

Differential Revision: https://reviews.llvm.org/D118093
2022-01-25 10:33:39 -05:00
Sean Fertile a2505bd063 [PowerPC][AIX] Override markFunctionEnd()
During fast-isel calling 'markFunctionEnd' in the base class will call
tidyLandingPads. This can cause an issue where we have determined that
we need ehinfo and emitted a traceback table with the bits set to
indicate that we will be emitting the ehinfo, but the tidying deletes
all landing pads. In this case we end up emitting a reference to
__ehinfo.N symbol, but not emitting a definition to said symbol and the
resulting file fails to assemble.

Differential Revision: https://reviews.llvm.org/D117040
2022-01-25 10:08:53 -05:00
Simon Pilgrim ea4b0489f5 [X86][AVX] Add PR47194 shuffle test case 2022-01-25 15:06:39 +00:00
Balázs Kéri 9d8c3ad94f [clang-tidy] Change code of SignalHandlerCheck (NFC).
Using clang::CallGraph to get the called functions.
This makes a better foundation to improve support for
C++ and print the call chain.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D118016
2022-01-25 15:52:38 +01:00
Florian Hahn b0956a9acf
[GVN] Add tests for loop load PRE through select. 2022-01-25 14:49:17 +00:00
Jim Lin f3314e3747 [clang-tidy] Pop Files only if FileChangeReason is ExitFile
enum FileChangeReason has four possible type EnterFile, ExitFile,
SystemHeaderPragma and RenameFile,
It should pop the back element of Files only if FileChangeReason is ExitFile.
2022-01-25 22:46:12 +08:00
Nikita Popov 98db33349b [SLC] Fix pointer diff type in sprintf() optimization
We should always be calculating a byte-wise difference here.
Previously this calculated the pointer difference while taking
the pointer element type into account, which is incorrect.
2022-01-25 15:22:56 +01:00
Benjamin Kramer 2c8a77ab21 [mlir] Move duplicated BufferizableOpInterface::kBufferLayoutAttrName defs to a single place 2022-01-25 15:20:30 +01:00
Sebastian Neubauer 4ed7c6eec9 [AMDGPU] Only match correct type for a16
Addresses are floats when a sampler is present and unsigned integers
when no sampler is present.

Therefore, only zext instructions, not sext instructions should match.

Also match integer constants that can be truncated.

Differential Revision: https://reviews.llvm.org/D118043
2022-01-25 14:59:16 +01:00
Nikita Popov 7cc3e141d7 [MemProf] Avoid pointer element type access
Determine the masked load/store access type from the value type
of the intrinsics, rather than the pointer element type. For
cleanliness, include the access type in InterestingMemoryAccess.
2022-01-25 14:52:54 +01:00
Nikita Popov 8e3e772f84 [OpenMPIRBuilderTest] Avoid some pointer element type accesses (NFC)
Use isOpaqueOrPointeeTypeMatches() instead, where possible.
2022-01-25 14:40:01 +01:00
Hans Wennborg bf00f7a64e Add llvm-dwp to LLVM_TOOLCHAIN_TOOLS
since it qualifies as a toolchain tool rather than "internal llvm tool".
This will make it part of builds which set the
LLVM_INSTALL_TOOLCHAIN_ONLY cmake option, such as the Windows installer.

Differential revision: https://reviews.llvm.org/D118042
2022-01-25 14:37:31 +01:00
Nikita Popov 475927d046 [AsmParserTest] Avoid pointer element type accesses (NFC)
Use isOpaqueOrPointeeTypeEquals() instead.
2022-01-25 14:31:51 +01:00
Nikita Popov a3a2239aaa [GlobalISel] Avoid pointer element type access during InlineAsm lowering
Same change as has been made for the SDAG lowering.
2022-01-25 14:26:47 +01:00
Christian Kühnel c0e3c893aa [NFC][clangd] cleaning up llvm-qualified-auto
This is a cleanup of all llvm-qualified-auto findings.
This patch was created by automatically applying the fixes from
clang-tidy.

Differential Revision: https://reviews.llvm.org/D113898
2022-01-25 13:26:33 +00:00
Matthias Springer d581c94d6b [mlir][linalg][bufferize] Support tensor.from_elements
This is mostly a copy of the existing tensor.from_elements bufferization. Once TensorInterfaceImpl.cpp is moved to the tensor dialect, the existing rewrite pattern can be deleted.

Differential Revision: https://reviews.llvm.org/D117775
2022-01-25 22:19:59 +09:00
Matthias Springer 71bbb78b8f [mlir][linalg][bufferize] Support tensor.generate
This is mostly a copy of the existing tensor.generate bufferization. Once TensorInterfaceImpl.cpp is moved to the tensor dialect, the existing rewrite pattern can be deleted.

Differential Revision: https://reviews.llvm.org/D117770
2022-01-25 22:19:22 +09:00
Nikita Popov 6a008de82a [Evaluator] Simplify handling of bitcasted calls
When fetching the function, strip casts. When casting the result,
use the call result type. Don't actually inspect the bitcast.
2022-01-25 14:19:04 +01:00
Marek Kurdej 4100cf2e92 [Visualizers] Fix Optional visualizer.
As discussed in https://reviews.llvm.org/D118105#3268773, OptionalStorage has been changed in commit fb97305750, but the visualizer still tries to use old members.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D118117
2022-01-25 14:16:03 +01:00
Matthias Springer 694df0f0a8 [mlir][linalg][bufferize] Fix build
This fixes a linker error related to ModuleBufferization.cpp.

Differential Revision: https://reviews.llvm.org/D118127
2022-01-25 21:59:23 +09:00
Pavel Labath 6b67e89b45 [lldb] Fix windows build for D117490
I forgot to update ProcessWindowsLog to the new API.
2022-01-25 13:51:53 +01:00
Pavel Labath 345d85e124 [lldb] Fix mac build for D117490
This is exactly that kind of a API misuse that the patch was meant to
detect.
2022-01-25 13:42:24 +01:00
Simon Pilgrim fc15ab7b1b [X86] Add folded load tests to PR46809 tests 2022-01-25 12:37:15 +00:00
Danila Malyutin 153b1e3cba [AArch64] Add patterns for relaxed atomic ld/st into fp registers
Adds patterns to match integer loads/stores bitcasted to fp values

Fixes https://github.com/llvm/llvm-project/issues/52927

Differential Revision: https://reviews.llvm.org/D117573
2022-01-25 15:33:37 +03:00
Paul Walker d95cf1f6cf [SVE] Enable ISD::ABDS/U ISel for scalable vectors.
NOTE: This patch also includes tests that highlight those cases
where the existing DAG combine doesn't yet work well for SVE.

Differential Revision: https://reviews.llvm.org/D117873
2022-01-25 12:14:53 +00:00
Nikita Popov 78e1f70220 [ObjCARCOpts] Use standard non-terminator unreachable pattern
This is what CreateNonTerminatorUnreachable() in InstCombine uses.
Specific choice here doesn't really matter, but we should pick
one that is pointer element type independent.
2022-01-25 13:08:03 +01:00