Christian Sigg [Wed, 26 Jan 2022 14:52:25 +0000 (15:52 +0100)]
[NVPTX] NFC: Remove unused arguments and attribute from test
Jan Svoboda [Wed, 26 Jan 2022 14:20:19 +0000 (15:20 +0100)]
[clang][lex] Include tracking: simplify and move to preprocessor
This patch replaces the exact include count of each file in `HeaderFileInfo` with a set of included files in `Preprocessor`.
The number of includes isn't a property of a header file but rather a preprocessor state. The exact number of includes is not used anywhere except statistic tracking.
Reviewed By: vsapsai
Differential Revision: https://reviews.llvm.org/D114095
Sam McCall [Thu, 30 Dec 2021 00:57:47 +0000 (01:57 +0100)]
[CodeCompletion][clangd] Clean __uglified parameter names in completion & hover
Underscore-uglified identifiers are used in standard library implementations to
guard against collisions with macros, and they hurt readability considerably.
(Consider `push_back(Tp_ &&__value)` vs `push_back(Tp value)`.
When we're describing an interface, the exact names of parameters are not
critical so we can drop these prefixes.
This patch adds a new PrintingPolicy flag that can applies this stripping
when recursively printing pieces of AST.
We set it in code completion/signature help, and in clangd's hover display.
All three features also do a bit of manual poking at names, so fix up those too.
Fixes https://github.com/clangd/clangd/issues/736
Differential Revision: https://reviews.llvm.org/D116387
Nikita Popov [Wed, 26 Jan 2022 09:53:21 +0000 (10:53 +0100)]
[AMDGPUHSAMetadataStreamer] Do not assume ABI alignment for pointers
AMDGPUHSAMetadataStreamer currently assumes that pointer arguments
without align attribute have ABI alignment of the pointee type.
This is incompatible with opaque pointers, but also plain incorrect:
Pointer arguments without explicit alignment have alignment 1. It is
the responsibility of the frontent to add correct align annotations.
Differential Revision: https://reviews.llvm.org/D118229
David Spickett [Fri, 29 Oct 2021 15:11:14 +0000 (16:11 +0100)]
[lldb] Add option to show memory tags in memory read output
This adds an option --show-tags to "memory read".
(lldb) memory read mte_buf mte_buf+32 -f "x" -s8 --show-tags
0x900fffff7ff8000: 0x0000000000000000 0x0000000000000000 (tag: 0x0)
0x900fffff7ff8010: 0x0000000000000000 0x0000000000000000 (tag: 0x1)
Tags are printed on the end of each line, if that
line has any tags associated with it. Meaning that
untagged memory output is unchanged.
Tags are printed based on the granule(s) of memory that
a line covers. So you may have lines with 1 tag, with many
tags, no tags or partially tagged lines.
In the case of partially tagged lines, untagged granules
will show "<no tag>" so that the ordering is obvious.
For example, a line that covers 2 granules where the first
is not tagged:
(lldb) memory read mte_buf-16 mte_buf+16 -l32 -f"x" --show-tags
0x900fffff7ff7ff0: 0x00000000 <...> (tags: <no tag> 0x0)
Untagged lines will just not have the "(tags: ..." at all.
Though they may be part of a larger output that does have
some tagged lines.
To do this I've extended DumpDataExtractor to also print
memory tags where it has a valid execution context and
is asked to print them.
There are no special alignment requirements, simply
use "memory read" as usual. All alignment is handled
in DumpDataExtractor.
We use MakeTaggedRanges to find all the tagged memory
in the current dump, then read all that into a MemoryTagMap.
The tag map is populated once in DumpDataExtractor and re-used
for each subsequently printed line (or recursive call of
DumpDataExtractor, which some formats do).
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/D107140
Nikita Popov [Wed, 26 Jan 2022 14:32:11 +0000 (15:32 +0100)]
[SCEVExpander] Always use i8 GEP for reused value offset
We could keep the non-i8 GEP code for non-opaque pointers, but
there's two reasons I'm dropping it: First, this actually appears
to be dead code, at least it isn't hit in any of our tests. I
expect that this is because we usually expand trip counts, and
those are never pointers (anymore). Second, the non-i8 GEP was
actually incorrect in multiple ways, because it used SCEV type
sizes, which don't match DL type sizes (for pointers) and certainly
don't match type alloc sizes (which is what GEPs actually use).
As such, I'm simplifying the code to always use the i8 GEP code
path if it does get hit.
Alban Bridonneau [Wed, 26 Jan 2022 13:33:38 +0000 (13:33 +0000)]
Implement correct cost for SVE bitcasts
We have some bitcasts which we know will be simplified,
so their cost is zero.
Reviewed By: david-arm, sdesmalen
Differential Revision: https://reviews.llvm.org/D118019
Sebastian Neubauer [Mon, 24 Jan 2022 19:39:54 +0000 (20:39 +0100)]
[CMake] Disable mvsc warning for new versions
Starting with VS 2019, CMake defaults to the x64 host toolchain, so the
warning does not apply anymore.
References:
VS 2017 defaults to x86
https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2015%202017.html?highlight=host#toolset-selection
VS 2019 and 2022 default to x64 for x64 targets
https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2016%202019.html?highlight=host#toolset-selection
https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2017%202022.html?highlight=host#toolset-selection
Differential Revision: https://reviews.llvm.org/D118228
David Spickett [Wed, 26 Jan 2022 13:41:03 +0000 (13:41 +0000)]
[lldb] Correct \params to \param in StackFrame Doxygen comments
David Spickett [Wed, 26 Jan 2022 13:35:47 +0000 (13:35 +0000)]
[lldb] Correct some uses of \b in Doxygen documentation
Abhina Sreeskantharajan [Wed, 26 Jan 2022 14:01:28 +0000 (09:01 -0500)]
[SystemZ][z/OS] Add AutoConvert.h header to MemoryBuffer.cpp
This commit https://github.com/llvm/llvm-project/commit/
75e164f61d391979b4829bf2746a5d74b94e95f2 removed the AutoConvert.h header causing a build break on z/OS. This patch adds it back to fix it.
Reviewed By: zibi
Differential Revision: https://reviews.llvm.org/D118129
LLVM GN Syncbot [Wed, 26 Jan 2022 13:56:09 +0000 (13:56 +0000)]
[gn build] Port
37c4bd0fdbc6
David Spickett [Fri, 29 Oct 2021 15:10:36 +0000 (16:10 +0100)]
[lldb] Add MemoryTagMap class
The tag map holds a sparse set of memory tags and allows
you to query ranges for tags.
Granules that do not have tags will be set to llvm::None.
to keep the ordering intact. If there are no tags for the
requested range we'll just return an empty result so that
callers don't need to check that all values are llvm::None.
This will be combined with MemoryTagManager's MakeTaggedRanges:
* MakeTaggedRanges
* Read from all those ranges
* Insert the results into the tag map
* Give the tag map to whatever needs to print tags
Which in this case will be "memory read"/DumpDataExtractor.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D112825
Nikita Popov [Wed, 26 Jan 2022 13:25:05 +0000 (14:25 +0100)]
[DSE] Add test with sret argument (NFC)
serge-sans-paille [Wed, 26 Jan 2022 13:02:49 +0000 (08:02 -0500)]
Cleanup LLVMTextAPI headers
Based on the output of iwyu. A full rebuild of llvm-project doesn't exhibit any
significant false dependencies.
The impact on preprocessed output is larger than expected, given the small
amount of changes
$ clang++ -E -Iinclude -I../llvm/include ../llvm/lib/TextAPI/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l
before: 635319
After: 643716
Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup
Salman Javed [Wed, 26 Jan 2022 12:30:38 +0000 (01:30 +1300)]
Rewrite Doxygen comment to resolve -Wdocumentation warning (NFC)
Comment change only, no functional change intended.
Example of warning:
https://lab.llvm.org/buildbot/#/builders/188/builds/8696/steps/4/logs/warnings__2_
Simon Moll [Wed, 26 Jan 2022 09:32:26 +0000 (10:32 +0100)]
[VE] Packed 32/64bit broadcast isel and tests
Packed-mode broadcast of f32/i32 requires the subregister to be
replicated to the full I64 register prior. Add repl_i32 and repl_f32 to
faciliate this.
Reviewed By: kaz7
Differential Revision: https://reviews.llvm.org/D117878
serge-sans-paille [Wed, 26 Jan 2022 13:15:14 +0000 (14:15 +0100)]
Fix conditional include in ThreadPool
Should fix https://lab.llvm.org/buildbot#builders/37/builds/10259
Nikita Popov [Wed, 26 Jan 2022 12:08:39 +0000 (13:08 +0100)]
[DSE] Use helper for unwind check (NFCI)
This should be no functional change, as the cases supported by the
helper and the cases supported by DSE are currently the same, the
code structure is just slightly different.
Paul Walker [Wed, 26 Jan 2022 12:55:15 +0000 (12:55 +0000)]
[AArch64] Add NEON test cases for ISD::ABDS/U.
Andrzej Warzynski [Tue, 25 Jan 2022 09:42:35 +0000 (09:42 +0000)]
[flang][tco] Remove unneeded dependencies
`tco` does not generate machine code, so it does not require (machine)
code-gen related dependencies.
Differential Revision: https://reviews.llvm.org/D118112
Nathan Sidwell [Mon, 24 Jan 2022 15:59:57 +0000 (07:59 -0800)]
[demangler] refactor SpecialSubKind
Code generating the special substitutions in std is a switch statement
with each case block containing the same conststruction template. It
is more efficient to commonize that after the switch, having
determined which SubKind to create. Also, let's sort the cases.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D118131
Nathan Sidwell [Mon, 24 Jan 2022 19:07:29 +0000 (11:07 -0800)]
[demangler] improve test harness
The demangler test harness is a little unclear. The failed demangling
message always causes me to think about 'reality', changing to a
simple 'Found' seems clearer.
The expected-to-fail tests abort as soon as one passes, rather than
continue, and then abort if any passed. This changes that loop to
fail at the end, in a similar manner to the expected-to-work loop.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D118130
serge-sans-paille [Wed, 26 Jan 2022 11:22:41 +0000 (06:22 -0500)]
Cleanup headers for BinaryFormat
A few header removal, some forward declarations. As usual, this can
break your build due to false dependencies, the most notable change are:
- "llvm/BinaryFormat/AMDGPUMetadataVerifier.h" no longer includes "llvm/BinaryFormat/MsgPackDocument.h"
The impact on generated preprocessed lines for LLVMBinaryFormat is
pretty nice:
$ clang++ -E -Iinclude -I../llvm/include ../llvm/lib/BinaryFormat/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l
before this patch: 705281
after this patch: 751456
Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup
Nicolas Vasilache [Wed, 26 Jan 2022 10:57:09 +0000 (05:57 -0500)]
[mlir][LLVM] Add support for operand_attrs to InlineAsmOp
This revision adds enough support to allow InlineAsmOp to work properly with indirect memory constraints "*m".
These require an explicit "elementtype" TypeAttr on the operands to pass LLVM verification and need to be provided.
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D118006
Simon Pilgrim [Wed, 26 Jan 2022 12:32:38 +0000 (12:32 +0000)]
[X86] Extend PR53419 test coverage
Test on SSE2/SSE41/AVX1 targets to compare PMOVMSK vs PTEST codegen paths
Add v8i8 reduction case and test on X64 and X86 targets to check 32-bit handling
alex-t [Fri, 24 Dec 2021 14:40:49 +0000 (17:40 +0300)]
[AMDGPU] Enable divergence-driven XNOR selection
Currently not (xor_one_use) pattern is always selected to S_XNOR irrelative od the node divergence.
This relies on further custom selection pass which converts to VALU if necessary and replaces with V_NOT_B32 ( V_XOR_B32)
on those targets which have no V_XNOR.
Current change enables the patterns which explicitly select the not (xor_one_use) to appropriate form.
We assume that xor (not) is already turned into the not (xor) by the combiner.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D116270
LLVM GN Syncbot [Wed, 26 Jan 2022 12:14:21 +0000 (12:14 +0000)]
[gn build] Port
5da7c040030c
Pavel Labath [Wed, 26 Jan 2022 12:02:48 +0000 (13:02 +0100)]
[lldb] Convert POSIXLog to use the new API
Paul Walker [Mon, 24 Jan 2022 12:35:18 +0000 (12:35 +0000)]
[SVE] Use DUPM to handling more splat immediate cases.
NOTE: Only considers i64 based vectors at this time because smaller
element types require extra isel operand parsing.
Differential Revision: https://reviews.llvm.org/D118040
Salman Javed [Wed, 26 Jan 2022 12:02:35 +0000 (01:02 +1300)]
Re-land "Cache the locations of NOLINTBEGIN/END blocks" with fix for build bot
LLVM GN Syncbot [Wed, 26 Jan 2022 11:52:58 +0000 (11:52 +0000)]
[gn build] Port
8e29d19b8d29
Salman Javed [Wed, 26 Jan 2022 11:52:25 +0000 (00:52 +1300)]
Revert "[clang-tidy] Cache the locations of NOLINTBEGIN/END blocks"
Build warning here:
https://lab.llvm.org/buildbot/#/builders/57/builds/14322
LLVM GN Syncbot [Wed, 26 Jan 2022 11:47:14 +0000 (11:47 +0000)]
[gn build] Port
19eaad94c47f
Nikita Popov [Wed, 26 Jan 2022 10:27:44 +0000 (11:27 +0100)]
[MemCpyOpt] Use helper for unwind check
This extends support to byval arguments. It would be further
extended to handle the case of non-captured noalias returns.
Stanislav Gatev [Mon, 24 Jan 2022 13:29:06 +0000 (13:29 +0000)]
[clang][dataflow] Enable merging distinct values in Environment::join
Make specializations of `DataflowAnalysis` extendable with domain-specific
logic for merging distinct values when joining environments. This could be
a strict lattice join or a more general widening operation.
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/D118038
OCHyams [Wed, 26 Jan 2022 11:09:21 +0000 (11:09 +0000)]
[Dexter] Remove false requirement of lldb for dexter regression tests on Windows
Not quite NFC because a little work was required to configure some tests to run
on Windows at all.
Before this patch on Windows:
$ llvm-lit cross-project-tests\debuginfo-tests\dexter\feature-tests
Unsupported: 49
Passed : 23
After this patch on Windows:
$ llvm-lit cross-project-tests\debuginfo-tests\dexter\feature-tests
Unsupported : 27
Passed : 39
Expectedly failed: 6
There are 3 main changes here. The first is to add a few more substitutions in
cross-project-tests/lit.cfg.py so that tests need to use specific flags can
still use the dexter regression test defaults for the native platform. These
are:
%dexter_regression_test_debugger
%dexter_regression_test_builder
%dexter_regression_test_cflags
%dexter_regression_test_ldflags
Tests that now use these options and therefore can be run on Windows too
(though the second is still failing for unknown reasons):
cross-project-tests/debuginfo-tests/dexte/feature_tests
/subtools/clang-opt-bisect/clang-opt-bisect.cpp
/subtools/test/source-root-dir.cpp
The second change is to remove spurious `REQUIRES: system-linux, lldb` and
`UNSUPPORTED: system-windows` directives, and make changes to lit.local.cfg
files that have the same effect. I've also added comments to the genuine
REQUIRES, UNSUPPORTED, and XFAIL directives so it's easier to understand
requirements at a glance. The most common reason for a test to not be supported
on Windows is that it uses DexLimitSteps, DexDeclareAddress, or DexCommandLine,
none of which are supported in the dbgeng driver.
There are two failures on Windows that were previously hidden, which I've
XFAILed:
cross-project-tests/debuginfo-tests/dexter/feature_tests
/commands/perfect/dex_finish_test/default_conditional.cpp
/commands/perfect/dex_finish_test/default_conditional_hit_count.cpp
And two that were easy to fix:
cross-project-tests/debuginfo-tests/dexter/feature_tests
/commands/perfect/dex_finish_test/default_simple.cpp
/commands/perfect/dex_finish_test/default_hit_count.cpp
Lastly, I've set three directories as unsupported.
cross-project-tests/debuginfo-tests/dexter/feature_tests
/commands/perfect/limit_steps
/commands/perfect/dex_declare_address
/commands/perfect/dex_declare_file
The first two are unsupported on Windows because they contains tests for the
DexLimitSteps and DexDeclareAddress commands which aren't supported in the
dbgeng driver. The third is unsupported on all platforms as the tests involve
invoking clang directly, which isn't currently a supported way of building
tests for dexter in lit (it can cause problems for cross compilers that can
target the host, as the tests use the default triple and linker, which may
be aligned for the default target, not host).
Tested on Windows and Linux.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D118048
Simon Pilgrim [Wed, 26 Jan 2022 11:33:08 +0000 (11:33 +0000)]
Fix MSVC 'not all control paths return a value' warning. NFC.
Sebastian Neubauer [Tue, 25 Jan 2022 14:20:42 +0000 (15:20 +0100)]
[AMDGPU][GlobalISel] Combine unmerge of undef
Fold (unmerge undef) -> undef, undef, ...
Differential Revision: https://reviews.llvm.org/D118138
Sebastian Neubauer [Tue, 25 Jan 2022 14:22:28 +0000 (15:22 +0100)]
[AMDGPU][NFC] Pre-commit regenerated test
David Spickett [Fri, 29 Oct 2021 15:09:03 +0000 (16:09 +0100)]
[lldb][AArch64] Add MakeTaggedRanges to MemoryTagManager
This is to be used when you want to know what subranges
of a larger range have memory tagging. Like MakeTaggedRange
but memory without tags is skipped and you get a list of ranges back.
Will be used later by DumpDataExtractor to show memory tags.
MakeTaggedRanges assumes that the memory regions it is
given are sorted in ascending order and do not overlap.
For the current use case where you get regions from
GetMemoryRegions and are on some Linux like OS, this is
reasonable to assume.
I've used asserts to check those conditions. In future
any API binding will check them up front to prevent a crash.
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/D112824
Max Kazantsev [Wed, 26 Jan 2022 10:48:32 +0000 (17:48 +0700)]
[Test] Add test for PR53419
These tests demonstrate how suboptimal is the lowering of
equality checks for short vectors.
Salman Javed [Wed, 26 Jan 2022 10:56:27 +0000 (23:56 +1300)]
[clang-tidy] Cache the locations of NOLINTBEGIN/END blocks
Support for NOLINT(BEGIN/END) blocks (implemented in D108560) is
currently costly. This patch aims to improve the performance with the
following changes:
- The use of tokenized NOLINTs instead of a series of repetitive ad-hoc
string operations (`find()`, `split()`, `slice()`, regex matching etc).
- The caching of NOLINT(BEGIN/END) block locations. Determining these
locations each time a new diagnostic is raised is wasteful as it
requires reading and parsing the entire source file.
Move NOLINT-specific code from `ClangTidyDiagnosticConsumer` to new
purpose-built class `NoLintDirectiveHandler`.
Differential Revision: https://reviews.llvm.org/D116085
Nicolas Vasilache [Wed, 26 Jan 2022 10:19:53 +0000 (05:19 -0500)]
[mlir][Linalg] Add GenericOp self-copy on buffers folding
Reviewed By: pifon2a
Differential Revision: https://reviews.llvm.org/D118116
Nikita Popov [Wed, 26 Jan 2022 10:48:11 +0000 (11:48 +0100)]
[MemCpyOpt] Add additiona call slot unwind tests (NFC)
Test a possibly unwinding call with a byval and sret argument.
Nuno Lopes [Wed, 26 Jan 2022 10:48:43 +0000 (10:48 +0000)]
remove spurious comma [NFC]
Benjamin Kramer [Thu, 13 Jan 2022 12:12:50 +0000 (13:12 +0100)]
[LSV] Vectorize loads of vectors by turning it into a larger vector
Use shufflevector to do the subvector extracts. This allows a lot more
load merging on AMDGPU and also on NVPTX when <2 x half> is involved.
Differential Revision: https://reviews.llvm.org/D117219
Stanislav Gatev [Wed, 26 Jan 2022 09:15:07 +0000 (09:15 +0000)]
[clang][dataflow] Assign aggregate storage locations to union stmts
This patch ensures that the dataflow analysis framework does not crash
when it encounters access to members of union types.
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/D118226
Alexander Batashev [Wed, 26 Jan 2022 10:10:50 +0000 (10:10 +0000)]
[mlir][openmp] Custom syntax for `omp.target` operation
Add a custom parser and printer for `omp.target` operation.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D117539
Jan Svoboda [Wed, 26 Jan 2022 10:21:49 +0000 (11:21 +0100)]
[clang] Fix serialized diagnostics edge-cases
The Clang frontend sometimes fails on the following assertion when launched with `-serialize-diagnostic-file <x>`:
```
Assertion failed: (BlockScope.empty() && CurAbbrevs.empty() && "Block imbalance"), function ~BitstreamWriter, file BitstreamWriter.h, line 125.
```
This was first noticed when passing an unknown command-line argument to `-cc1`.
It turns out the `DiagnosticConsumer::finish()` function should be called as soon as processing of all source files ends, but there are some code paths where that doesn't happen:
1. when command line parsing fails in `cc1_main()`,
2. when `!Act.PrepareToExecute(*this)` or `!createTarget()` evaluate to `true` in `CompilerInstance::ExecuteAction` and the function returns early.
This patch ensures `finish()` is called in all those code paths.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D118150
Jan Svoboda [Wed, 26 Jan 2022 10:18:00 +0000 (11:18 +0100)]
[clang][syntax] Replace `std::vector<bool>` use
LLVM Programmer’s Manual strongly discourages the use of `std::vector<bool>` and suggests `llvm::BitVector` as a possible replacement.
This patch replaces `std::vector<bool>` with `llvm::BitVector` in the Syntax library and replaces range-based for loop with regular for loop. This is necessary due to `llvm::BitVector` not having `begin()` and `end()` (D117116).
Reviewed By: dexonsmith, dblaikie
Differential Revision: https://reviews.llvm.org/D118109
Jan Svoboda [Wed, 26 Jan 2022 10:16:11 +0000 (11:16 +0100)]
[llvm][support] Replace `std::vector<bool>` use in YAMLTraits
LLVM Programmer’s Manual strongly discourages the use of `std::vector<bool>` and suggests `llvm::BitVector` as a possible replacement.
This patch replaces the use of `std::vector` with `llvm::BitVector` in LLVM's YAML traits and replaces the call to `Vec.insert(Vec.begin(), N, false)` on empty `Vec` with `Vec.resize(N)`, which has the same semantics but avoids using `insert` and iterators, which `llvm::BitVector` doesn't possess.
Reviewed By: dexonsmith, dblaikie
Differential Revision: https://reviews.llvm.org/D118111
Nuno Lopes [Wed, 26 Jan 2022 10:10:22 +0000 (10:10 +0000)]
[NewGVN] FIx phi-of-ops in the presence of memory read operations
The phi-of-ops functionality has a function OpIsSafeForPHIOfOps
to determine when it's safe to create the new phi.
But this function only checks for the obvious dominator conditions
and ignores memory.
This patch takes the conservative approach and disables phi-of-ops
whenever there's a load that doesn't dominate the phi, as its
value may be affected by a store inside the loop.
This can be improved later to check aliasing between the
load/stores.
Fixes https://llvm.org/PR53277
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D117999
serge-sans-paille [Wed, 26 Jan 2022 07:50:00 +0000 (02:50 -0500)]
[NFC] Additional header dependency cleanup LLVMSupport
A few more forward-declarations, a few less headers. the impact on number of
preprocessed lines for LLVMSupport is negligible (-3K lines) but it's always
good to remove dependencies.
Related discourse thread: https://llvm.discourse.group/t/include-what-you-use-include-cleanup
Nikita Popov [Tue, 11 Jan 2022 10:02:26 +0000 (11:02 +0100)]
[LICM] Generalize unwinding check during scalar promotion
This extract a common isNotVisibleOnUnwind() helper into
AliasAnalysis, which handles allocas, byval arguments and noalias
calls. After D116998 this could also handle sret arguments. We
have similar logic in DSE and MemCpyOpt, which will be switched
to use this helper as well.
The noalias call case is a bit different from the others, because
it also requires that the object is not captured. The caller is
responsible for doing the appropriate check.
Differential Revision: https://reviews.llvm.org/D117000
serge-sans-paille [Wed, 26 Jan 2022 10:06:12 +0000 (05:06 -0500)]
Nikita Popov [Tue, 11 Jan 2022 09:57:56 +0000 (10:57 +0100)]
[LICM] Add additional tests for promotion with unwinding (NFC)
Nikita Popov [Wed, 26 Jan 2022 10:02:03 +0000 (11:02 +0100)]
[OpenMPIRBuilderTest] Avoid pointer element type access
This was reintroduced by D110114.
Maciej Gabka [Wed, 26 Jan 2022 09:46:32 +0000 (09:46 +0000)]
Restrict performPostLD1Combine to 64 and 128 bit vectors
When wider vectors are used, for example fixed width SVE,
there is no patterns to select AArch64ISD::LD1LANEpost
nodes, so we should do an early exit.
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D117674
Adrian Kuegel [Wed, 26 Jan 2022 09:15:44 +0000 (10:15 +0100)]
[mlir][Bazel] Remove unnecessary dependencies
Differential Revision: https://reviews.llvm.org/D118221
Martin Storsjö [Sun, 9 Jan 2022 22:32:47 +0000 (22:32 +0000)]
[libcxx] [test] Fix mismatches between _aligned_malloc and free() on Windows
This allows getting rid of one case of LIBCXX-WINDOWS-FIXME. The fixme
comment was inaccurate; aligned allocation functions are provided these
days, but the test kept failing as it was using mismatched allocation
and free functions.
A similar issue was fixed earlier, in
6596778b46ba69517191e7397289228168064ff4. That test was fixed by
overriding the aligned `operator new` too, and returning a dummy fixed
allocation instead. As this test is libcxx specific, it can use the
internal `std::__libcpp_aligned_free()` instead, to match libcxx's
internal aligned `operator new`.
Differential Revision: https://reviews.llvm.org/D118190
Nikita Popov [Wed, 26 Jan 2022 09:34:23 +0000 (10:34 +0100)]
[SCEVExpander] Remove pointer element type access in assertion
Assert directly on i8 rather than the element type of i8*.
Nikita Popov [Wed, 26 Jan 2022 09:20:39 +0000 (10:20 +0100)]
[OpenMPOpt] Add const qualifier (NFC)
Make it clear that this large lambda does not modify the vector.
serge-sans-paille [Tue, 25 Jan 2022 20:48:51 +0000 (15:48 -0500)]
[NFC] Use an llvm::DenseMap instead of std::map in CategorizedHelpPrinter::printOptions
It's a recommit of
6427f4c52c31cc36004 (patch included)
Nikita Popov [Wed, 26 Jan 2022 09:10:13 +0000 (10:10 +0100)]
[AddressSanitizer] Avoid pointer element type accesses
Determine masked load/store type based on the value operand and
result types, rather than pointer element type.
Yury Gribov [Wed, 19 Jan 2022 08:21:44 +0000 (17:21 +0900)]
[flang] Get rid of code duplication in wrapper. Fix checking of undefined variables.
Differential Revision: https://reviews.llvm.org/D117767
David Green [Wed, 26 Jan 2022 08:37:44 +0000 (08:37 +0000)]
[DAG] Create fptoui.sat from clamped fptoui
This is the unsigned variant of D111976, where we convert a clamped
fptoui to a fptoui.sat. Because we are unsigned, the condition this time
is only UMIN of UINT_MAX. Similarly to D111976 it handles ISD::UMIN,
ISD::SETCC/ISD::SELECT, ISD::VSELECT or ISD::SELECT_CC nodes.
This especially helps on ARM/AArch64 where the vcvt instructions
naturally saturate the result.
Differential Revision: https://reviews.llvm.org/D114964
Yury Gribov [Wed, 19 Jan 2022 10:48:54 +0000 (19:48 +0900)]
[flang] Add a custom target for the "flang" wrapper script.
Differential Revision: https://reviews.llvm.org/D117768
Yury Gribov [Fri, 21 Jan 2022 08:24:32 +0000 (17:24 +0900)]
Add ieee_is_normal/ieee_is_negative to ieee_arithmetic module.
jacquesguan [Wed, 26 Jan 2022 07:48:51 +0000 (15:48 +0800)]
[RISCV] Fix support of vlen = 64.
In the Zve* extensions, the vlen could be 64. This patch change the vlen constraint of low bound to 64.
Differential Revision: https://reviews.llvm.org/D118217
Matthias Springer [Tue, 25 Jan 2022 18:35:33 +0000 (03:35 +0900)]
[mlir] Fix merging of delayed registrations during DialectRegistry::appendTo
The existing implementation called DenseMap::insert, which is a no-op if the map already contains an entry with the same key.
Differential Revision: https://reviews.llvm.org/D118165
Marek Kurdej [Wed, 26 Jan 2022 08:11:21 +0000 (09:11 +0100)]
[clang-format] Fix regression in parsing pointers to arrays.
Fixes https://github.com/llvm/llvm-project/issues/53293.
After commit 5c2e7c9, the code:
```
template <> struct S : Template<int (*)[]> {};
```
was misformatted as:
```
template <> struct S : Template<int (*)[]>{};
```
Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D118106
Kristof Beyls [Wed, 26 Jan 2022 08:13:22 +0000 (09:13 +0100)]
Add release note for aarch64-none-elf driver change.
Fangrui Song [Wed, 26 Jan 2022 07:53:23 +0000 (23:53 -0800)]
[ELF] --gdb-index: replace vector<uint8_t> with unique_ptr<uint8_t[]>. NFC
Valentin Clement [Tue, 25 Jan 2022 21:53:20 +0000 (22:53 +0100)]
[flang] Change getLoweredName to translateNameToFrontendMangledName()
getLoweredName() is not a well suited name change it to
translateNameToFrontendMangledName()
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D118140
Fangrui Song [Wed, 26 Jan 2022 07:33:40 +0000 (23:33 -0800)]
[ELF] Optimize .relr.dyn to not grow vector<uint64_t>. NFC
Qiu Chaofan [Wed, 26 Jan 2022 07:19:22 +0000 (15:19 +0800)]
[NFC] Group PowerPC clang codegen tests into directory
Jim Lin [Wed, 26 Jan 2022 01:50:00 +0000 (09:50 +0800)]
[NFC] Remove duplicate include
Fangrui Song [Wed, 26 Jan 2022 06:50:03 +0000 (22:50 -0800)]
[ELF] Simplify and optimize .relr.dyn NFC
Yevgeny Rouban [Wed, 26 Jan 2022 05:38:17 +0000 (12:38 +0700)]
[JumpThreading] Add a test for handling zero !prof branch_weights
The test was a part of the revision D81499 and should have been
added with commit
707836ed4ed.
Reviewed By: yamauchi, wenlei
Differential Revision: https://reviews.llvm.org/D81499
Fangrui Song [Wed, 26 Jan 2022 06:40:53 +0000 (22:40 -0800)]
[ELF] Clarify that Z_BEST_SPEED==1 in a comment. NFC
Fangrui Song [Wed, 26 Jan 2022 06:39:43 +0000 (22:39 -0800)]
[ELF] --build-id: replace vector<uint8_t> with unique_ptr<uint8_t[]>. NFC
We can't use C++20 make_unique_for_overwrite yet.
Fangrui Song [Wed, 26 Jan 2022 06:38:23 +0000 (22:38 -0800)]
[ELF] Cast size to size_t. NFC
To fix
../../chromeclang/bin/../include/c++/v1/__algorithm/min.h:39:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('unsigned long' vs. 'unsigned long long')
on macOS arm64.
Richard [Mon, 3 Jan 2022 23:03:06 +0000 (16:03 -0700)]
Refactor: Extract Class MessagePrefix (NFC)
The work is the same, the only difference is the prefix
of the strings we look for in the reference files.
Rob Suderman [Wed, 26 Jan 2022 06:15:55 +0000 (22:15 -0800)]
[mlir] Propagate arith.index_cast past tensor.extract
If we are extracting it is more useful to push the index_cast past the
extraction. This increases the chance the tensor.extract can evaluated at
compile time.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D118204
Fangrui Song [Wed, 26 Jan 2022 06:15:44 +0000 (22:15 -0800)]
[ELF] maybeCompress: replace vector<uint8_t> with unique_ptr<uint8_t[]>. NFC
And mention that it is zero-initialized. I do not notice a speed-up if
changed to be uninitialized by forcing the zero filler in writeTo.
wangpc [Wed, 26 Jan 2022 06:04:53 +0000 (14:04 +0800)]
[regalloc] Fix assertion error when LiveInterval is empty
When evicting interference, it causes an asseertion error
since LiveIntervals::intervalIsInOneMBB assumes that input
is not empty.
This patch fixed bug mentioned in D118020.
Reviewed By: MatzeB
Differential Revision: https://reviews.llvm.org/D118124
luxufan [Fri, 14 Jan 2022 15:02:27 +0000 (23:02 +0800)]
[MC] Support constant offset for symbol PendingFixup
This patch add support relocation offset of sym+constant(like `foo+4`) form for pending fixup.
In the past, llvm-mc ignored the constant in sym+constant form, for `foo+4`, `4` would be ignored. And test case
```
.text
ret
nop
nop
.reloc foo+4, R_RISCV_32, 6
.data
.globl foo
foo:
.word 0
.word 0
.word 0
```
when run `llvm-mc -filetype=obj -triple=riscv64 %s | llvm-readobj -r`
The output is
```
Relocations [
Section (3) .rela.text {
0x0 R_RISCV_32 - 0x6
}
]
```
After applying this patch, the output is
```
Relocations [
Section (3) .rela.text {
0x4 R_RISCV_32 - 0x6
}
]
```
Differential Revision: https://reviews.llvm.org/D117316
Hongtao Yu [Wed, 26 Jan 2022 00:11:41 +0000 (16:11 -0800)]
[CSSPGO] Adjust SampleContextFrameVector to be a shorter SmallVector
It appears that some memory saving can be archived by tweaking the existing `SampleContextFrameVector` setup. Below are memory usage for two benchmarks before and after this change.
1. Medium benchmark:
- Before:
```
note: After computeSizeForProfiledFunctions
note: VM: 12.50 GB RSS: 11.02 GB
note: After generateProbeBasedProfile
note: **VM: 30.56 GB RSS: 29.08 GB**
note: After postProcessProfiles
note: VM: 31.91 GB RSS: 30.43 GB
```
- After:
```
note: After computeSizeForProfiledFunctions
note: VM: 12.26 GB RSS: 10.80 GB
note: After generateProbeBasedProfile
note: **VM: 28.76 GB RSS: 27.29 GB**
note: After postProcessProfiles
note: VM: 30.12 GB RSS: 28.66 GB
```
2. Large benchmark:
- Before:
```
note: After computeSizeForProfiledFunctions
note: VM: 106.28 GB RSS: 91.25 GB
note: After generateProbeBasedProfile
note: **VM: 245.19 GB RSS: 224.30 GB**
note: After postProcessProfiles
note: VM: 254.96 GB RSS: 221.58 GB
```
- After:
```
note: After computeSizeForProfiledFunctions
note: VM: 105.95 GB RSS: 91.04 GB
note: After generateProbeBasedProfile
note: VM: **234.29 GB RSS: 215.39 GB**
note: After postProcessProfiles
note: VM: 244.03 GB RSS: 213.45 GB
```
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D118203
Qiu Chaofan [Wed, 26 Jan 2022 05:23:21 +0000 (13:23 +0800)]
[PowerPC] Emit gnu_attribute according to float-abi metadata
According to GNU as documentation, PowerPC supports some .gnu_attribute
tags to represent the vector and float ABI type in the object file.
Some linkers like GNU ld respects the attribute and will prevent objects
with conflicting ABIs being linked.
This patch emits gnu_attribute value in assembly printer according to
the float-abi metadata. More attributes for soft-fp, hard single/double
and even vector ABI need to be supported in the future.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D117193
Micah Weston [Wed, 26 Jan 2022 04:21:48 +0000 (04:21 +0000)]
[AArch64] Fixes ADD/SUB opt bug and abstracts shared behavior in MIPeepholeOpt for ADD, SUB, and AND.
This fixes a bug where (SUBREG_TO_REG 0 (MOVi32imm <negative-number>) sub_32)
would generate invalid code since the top 32-bits were not zeroed when inspecting the
immediate value. A new test was added for this case.
Change to abstract shared behavior in MIPeepholeOpt. Both
visitAND and visitADDSUB attempt to split an RR instruction with an immediate
operand into two RI instructions with the immediate split.
The differing behavior lies in how the immediate is split into two pieces and
how the new instructions are built. The rest of the behavior (adding new VRegs,
checking for the MOVImm, constraining reg classes, removing old intructions)
are shared between the operations.
The new helper function splitTwoPartImm implements the shared behavior and
delegates differing behavior to two function objects passed by the caller.
One function object splits the immediate into two values and returns the
opcode to use if it is a valid split. The other function object builds
the new instructions.
I felt this abstraction would help since I believe it will help reduce the
code repetition when adding new instructions of the pattern, such as
SUBS for this conditional optimization.
Tested it locally by running check all with compiler-rt, mlir, clang-tools-extra,
flang, llvm, and clang enabled.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D118000
ly [Wed, 26 Jan 2022 03:49:50 +0000 (11:49 +0800)]
[NFC][llvm] Align the comment
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D116579
Puyan Lotfi [Wed, 26 Jan 2022 03:15:00 +0000 (19:15 -0800)]
[lld][macho][NFC] Make MachO/start-end.s test less britle by checking for _main:
In start-end.s there is a lit check line `# SEG: _main` to begin the
check at the start of the function main where `_main` is the Darwin name
mangling for C main. Because the text file that FileCheck is getting as
input has the path of the compiler build in it from llvm-mc and
llvm-objdump, and because of the lack of a trailing colon in this check
line we end up inadvertently matching against the line of text with the
compiler path in it in the case where said path contains "_main" some
place. This can be very likely if the compiler branch has "main" or
"_main" in it.
To fix this I include the training : since that will match on the
function label and not the path line.
luxufan [Fri, 14 Jan 2022 14:03:23 +0000 (22:03 +0800)]
[MC] Put the Pending Fixups into location symbol's fragment
Differential Revision: https://reviews.llvm.org/D117317
Chuanqi Xu [Wed, 26 Jan 2022 02:53:50 +0000 (10:53 +0800)]
[C++20] [Modules] Only check decls under namespace scope in CheckRedeclarationExported
Since only the decls inhabit in a namespace scope could be exported, it
is not meaningful to check it in CheckRedeclarationExported, which
implements [module.interface]/p6.
Reviewed By: urnathan
Differential Revision: https://reviews.llvm.org/D118120
Giorgis Georgakoudis [Wed, 26 Jan 2022 01:31:35 +0000 (20:31 -0500)]
[OMPIRBuilder] Generate aggregate argument for parallel region outlined functions
Summary:
This patch modifies code generation in OpenMPIRBuilder to pass arguments
to the parallel region outlined function in an aggregate (struct),
besides the global_tid and bound_tid arguments. It depends on the
updated CodeExtractor (see D96854) for support. It mirrors functionality
of Clang codegen (see D102107).
Differential Revision: https://reviews.llvm.org/D110114
Giorgis Georgakoudis [Wed, 26 Jan 2022 01:08:19 +0000 (20:08 -0500)]
[CodeExtractor] Enable partial aggregate arguments
Summary:
Enable CodeExtractor to construct output functions that partially
aggregate inputs/outputs in their argument list. A use case is the
OMPIRBuilder to create outlined functions for parallel regions that
aggregate in a struct the payload variables for the region while passing
as scalars thread and bound identifiers.
Differential Revision: https://reviews.llvm.org/D96854
Zakk Chen [Tue, 25 Jan 2022 15:54:39 +0000 (07:54 -0800)]
[RISCV][NFC] Add getVLOperand for RVV intrinsics.
Use the VLOperand information to get the VL.
Differential Revision: https://reviews.llvm.org/D118156
Zakk Chen [Tue, 25 Jan 2022 08:08:21 +0000 (00:08 -0800)]
[RISCV] Add the passthru operand for RVV nomask load intrinsics.
The goal is support tail and mask policy in RVV builtins.
We focus on IR part first.
If the passthru operand is undef, we use tail agnostic, otherwise
use tail undisturbed.
Co-Authored-by: Hsiangkai Wang <Hsiangkai@gmail.com>
Reviewers: craig.topper, frasercrmck
Differential Revision: https://reviews.llvm.org/D117647
Kirill Stoimenov [Wed, 26 Jan 2022 00:57:40 +0000 (00:57 +0000)]
[ASan] Added a unit test for D118184.
To make sure the the libraries are there for executable and not there for DSOs.
Reviewed By: kda
Differential Revision: https://reviews.llvm.org/D118205