Aaron Puchert [Tue, 9 Nov 2021 21:24:44 +0000 (22:24 +0100)]
Comment AST: Add support for variable templates
We treat them as variables of course, though if they have function
pointer type we treat them as functions, i.e. allow parameter and return
value specifications. Just like VarDecls.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D111266
Aaron Puchert [Tue, 9 Nov 2021 20:51:38 +0000 (21:51 +0100)]
Comment AST: Declare function pointer variables as functions
We were doing this already for type aliases, and it deduplicates the
code looking through aliases and pointers to find a function type. As
a side effect, this finds two warnings that we apparently missed before.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D111264
Aaron Puchert [Tue, 9 Nov 2021 20:46:56 +0000 (21:46 +0100)]
Comment AST: Factor out function type extraction in DeclInfo::fill (NFC)
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D111262
David Blaikie [Tue, 9 Nov 2021 20:51:05 +0000 (12:51 -0800)]
DebugInfoDWARF: Refactor/simplify a couple of minor things
Haojian Wu [Tue, 9 Nov 2021 10:10:11 +0000 (11:10 +0100)]
[clang] Don't crash on an incomplete-type base specifier in template context.
Differential Revision: https://reviews.llvm.org/D113474
Nikita Popov [Tue, 9 Nov 2021 20:59:40 +0000 (21:59 +0100)]
[InstCombine] Add tests for and/or of range checks (NFC)
David Tenty [Tue, 9 Nov 2021 17:44:44 +0000 (12:44 -0500)]
[libcxx][CI][AIX] Switch to LLVM_ENABLE_RUNTIMES
and to the new `runtimes` top level CMakeLists.txt since the old path is now deprecated. This requires a slight adjustment of the libcxxabi CMake, since there are required macro definitions we previously got via the `llvm/CMakeList.txt` path.
Reviewed By: ldionne, #libc, #libc_abi
Differential Revision: https://reviews.llvm.org/D113403
C. Rayroud [Sun, 7 Nov 2021 19:56:35 +0000 (20:56 +0100)]
[clang-format] Refactor SpaceBeforeParens to add options
The coding style of some projects requires to have more control on space
before opening parentheses.
The goal is to add the support of clang-format to more projects.
For example adding a space only for function definitions or
declarations.
This revision adds SpaceBeforeParensOptions to configure each option
independently from one another.
Differentiel Revision: https://reviews.llvm.org/D110833
Björn Schäpers [Fri, 5 Nov 2021 21:20:52 +0000 (22:20 +0100)]
[clang-format] Address fixme
Differential Revision: https://reviews.llvm.org/D113320
serge-sans-paille [Fri, 15 Oct 2021 13:18:52 +0000 (15:18 +0200)]
Misleading unicode identifier detection pass
Detect when an identifier contains some Right-To-Left characters.
This pass relates to https://trojansource.codes/
This is a recommit of
299aa4dfa1d8c120648b1404b481d858b76c8173 with missing
option registration fixed.
Differential Revision: https://reviews.llvm.org/D112914
Ellis Hoag [Tue, 9 Nov 2021 20:45:54 +0000 (12:45 -0800)]
[DebugInfo] Fix broken MachO test
This test was introduced in https://reviews.llvm.org/D112337 and breaks on mac.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D113506
Luís Ferreira [Tue, 9 Nov 2021 20:40:45 +0000 (12:40 -0800)]
[Tools] Add a fuzzing tool to help fuzzing D demangler
This patch adds a fuzzing helper tool for D demangler by feeding the demangler API with
pseudo-random null terminated strings with the help of libfuzzer heuristics.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D111432
Ilya Yanok [Tue, 9 Nov 2021 20:35:43 +0000 (21:35 +0100)]
[RegAllocFast] Fix nondeterminism in debuginfo generation
Changes from commit
1db137b1859692ae33228c530d4df9f2431b2151
added iteration over hash map that can result in non-deterministic
order. Fix that by using a SmallMapVector to preserve the order.
Differential Revision: https://reviews.llvm.org/D113468
Gulfem Savrun Yeniceri [Tue, 9 Nov 2021 20:21:49 +0000 (20:21 +0000)]
[compiler-rt] Fix diagnostic in InstrProfError
This patch fixes some issues introduced in
https://reviews.llvm.org/D108942:
1) Remove the default label to fix the bots that use
-Werror,-Wcovered-switch-default
2) Modify the malformed test to fix the bots that are
built without zlib support
3) Modify some error messages in malformed profiles
David Green [Tue, 9 Nov 2021 20:29:42 +0000 (20:29 +0000)]
[AArch64] Extend and regenerate fcvt_combine.ll. NFC
This adds half and fptoi.sat variants of the tests in fcvt_combine.ll,
and regenerates the resulting check lines.
Matt Arsenault [Thu, 4 Nov 2021 23:31:56 +0000 (19:31 -0400)]
AMDGPU: Regenerate test checks
Update these to include -NEXT to avoid spurious changes in a future
commit.
Andrzej Warzynski [Wed, 3 Nov 2021 07:57:13 +0000 (07:57 +0000)]
[flang][CodeGen] Transform `fir.{store|load}` to `llvm.{store|load}`
This patch extends the `FIRToLLVMLowering` pass in Flang by adding a
hook to transform `fir.store`/`fir.load` to `llvm.store`/`fir.load`,
respectively.
This is part of the upstreaming effort from the `fir-dev` branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project
Differential Revision: https://reviews.llvm.org/D113090
Patch originally written by:
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Nikita Popov [Tue, 9 Nov 2021 20:17:09 +0000 (21:17 +0100)]
[InstCombine] Combine code for and/or of icmps (NFC)
The implementation for and/or is the same, apart from the choice
of exactIntersectWith() vs exactUnionWith(). Extract a common
function to make future extension easier.
LLVM GN Syncbot [Tue, 9 Nov 2021 20:11:28 +0000 (20:11 +0000)]
[gn build] Port
737c4a2673da
Atmn Patel [Tue, 9 Nov 2021 04:16:54 +0000 (23:16 -0500)]
[clang][openmp][NFC] Remove arch-specific CGOpenMPRuntimeGPU files
The existing CGOpenMPRuntimeAMDGCN and CGOpenMPRuntimeNVPTX classes are
just code bloat. By removing them, the codebase gets a bit cleaner.
Reviewed By: jdoerfert, JonChesterfield, tianshilei1992
Differential Revision: https://reviews.llvm.org/D113421
Mogball [Tue, 9 Nov 2021 18:59:06 +0000 (18:59 +0000)]
[mlir][ods] Cleanup of handling Op vs OpAdaptor
In preparation for implementation subrange lookup on attributes.
Depends on D113039
Reviewed By: jpienaar, Chia-hungDuan
Differential Revision: https://reviews.llvm.org/D113128
Nikita Popov [Sat, 6 Nov 2021 21:15:26 +0000 (22:15 +0100)]
[InstCombine] Refactor and/or of icmp with constant (NFCI)
Rather than testing for many specific combinations of predicates
and values, compute the exact icmp regions for both comparisons
and check whether they union/intersect exactly. If they do,
construct the equivalent icmp for the new range. Assuming that the
existing code handled all possible cases, this should be NFC.
Differential Revision: https://reviews.llvm.org/D113367
Yonghong Song [Mon, 8 Nov 2021 04:36:52 +0000 (20:36 -0800)]
BPF: change btf_type_tag BTF output format
For the declaration like below:
int __tag1 * __tag1 __tag2 *g
Commit
41860e602aaa ("BPF: Support btf_type_tag attribute")
implemented the following encoding:
VAR(g) -> __tag1 --> __tag2 -> pointer -> __tag1 -> pointer -> int
Some further experiments with linux btf_type_tag support, esp.
with generating attributes in vmlinux.h, and also some internal
discussion showed the following format is more desirable:
VAR(g) -> pointer -> __tag2 -> __tag1 -> pointer -> __tag1 -> int
The format makes it similar to other modifier like 'const', e.g.,
const int *g
which has encoding VAR(g) -> PTR -> CONST -> int
Differential Revision: https://reviews.llvm.org/D113496
Stanislav Mekhanoshin [Wed, 3 Nov 2021 18:10:26 +0000 (11:10 -0700)]
[InstCombine] Fuse checks for LHS (~(A | B) & C) | ... NFC.
Differential Revision: https://reviews.llvm.org/D113132
Jorge Gorbe Moya [Tue, 9 Nov 2021 19:24:05 +0000 (11:24 -0800)]
Revert "[clang-tidy] Fix lint warning in ClangTidyDiagnosticConsumer.cpp (NFC)"
The change causes multiple clang-tidy tests to fail under ASan.
This reverts commit
00769572025f9b0d36dc832d3c1bc61500091ed5.
Sanjay Patel [Tue, 9 Nov 2021 18:26:04 +0000 (13:26 -0500)]
[InstCombine] fix code comment to match code; NFC
Mark de Wever [Sat, 6 Nov 2021 19:30:08 +0000 (20:30 +0100)]
[libc++] Adds missing forward_list merge tests.
During the review of D112660 it turned out the tests for
`std::forward_list::merge` are incomplete.
Adds tests for the rvalue reference overloads. The tests are extended to
better test the Effects [forward.list.ops]/25 and Remarks
[forward.list.ops]/27 of the function:
- x is empty after the merge.
- Pointers and references to the moved elements of x now refer to those
same elements but as members of *this.
- Iterators referring to the moved elements will continue to refer to
their elements, but they now behave as iterators into *this, not into x.
- The algorithm is stable.
Reviewed By: Quuxplusone, #libc, ldionne
Differential Revision: https://reviews.llvm.org/D113364
Yuanfang Chen [Tue, 9 Nov 2021 18:33:33 +0000 (10:33 -0800)]
[Sema] Mark virtual method declaration in union as invalid
Currently, this is only diagnosed but the decl is not marked invalid. This may hit assertions down the path.
This also reverts the fix for PR49534 since it is not needed anymore.
Reviewed By: hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D113145
Ellis Hoag [Tue, 9 Nov 2021 18:52:10 +0000 (10:52 -0800)]
[DebugInfo] Only create concrete DIEs of concrete functions
At the begining of the module we can iterate through the functions to
see which SPs should have concrete DIEs. Then when we need to reference
a DIE for a SP we can decide if it's ok to create a concrete DIE or not.
Fixes
* https://bugs.llvm.org/show_bug.cgi?id=52159
* https://bugs.llvm.org/show_bug.cgi?id=30637
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D112337
Pavel Labath [Tue, 9 Nov 2021 18:39:17 +0000 (19:39 +0100)]
[lldb] XFAIL TestPlatformKill on windows
-> PR52451
Adrian Prantl [Tue, 9 Nov 2021 18:46:09 +0000 (10:46 -0800)]
Use yaml2obj instead of relying on invoking the Darwin system assembler.
Dwight Guth [Tue, 9 Nov 2021 18:42:52 +0000 (10:42 -0800)]
[llvm-reduce] Fix invalid reduction in basic-blocks delta pass
Previously, if the basic-blocks delta pass tried to remove a basic block
that was the last basic block in a function that did not have external
or weak linkage, the resulting IR would become invalid. Since removing
the last basic block in a function is effectively identical to removing
the function body itself, we check explicitly for this case and if we
detect it, we run the same logic as in ReduceFunctionBodies.cpp
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D113486
LLVM GN Syncbot [Tue, 9 Nov 2021 18:38:40 +0000 (18:38 +0000)]
[gn build] Port
533862933398
Arthur Eubanks [Mon, 1 Nov 2021 15:56:48 +0000 (08:56 -0700)]
[NFC] Rename GVN -> GVNPass and SROA -> SROAPass
To be more consistent with other pass struct names.
There are still more passes that don't end with "Pass", but these are the important ones.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D112935
Kazu Hirata [Tue, 9 Nov 2021 18:34:00 +0000 (10:34 -0800)]
[ProfileData] Fix a warning
This patch fixes:
llvm/lib/ProfileData/InstrProf.cpp:146:3: error: default label in
switch which covers all enumeration values
[-Werror,-Wcovered-switch-default]
Douglas Yung [Tue, 9 Nov 2021 18:28:41 +0000 (10:28 -0800)]
Revert "Reapply db28934 "[IndVars] Pass TTI to replaceCongruentIVs""
This reverts commit
5ec23863320ca12bfabb6dcff1d0425cb614b7a5.
This change is causing test failures on the PS4 linux build bot: https://lab.llvm.org/buildbot/#/builders/139/builds/12871
Simon Pilgrim [Tue, 9 Nov 2021 18:25:07 +0000 (18:25 +0000)]
Revert rG299aa4dfa1d8c120648b1404b481d858b76c8173 "Misleading unicode identifier detection pass"
This is failing on various buildbots: https://lab.llvm.org/buildbot/#/builders/109/builds/25932
Arthur Eubanks [Tue, 9 Nov 2021 18:20:43 +0000 (10:20 -0800)]
[gn build] Port
299aa4dfa1d8
Arthur Eubanks [Tue, 9 Nov 2021 18:20:42 +0000 (10:20 -0800)]
[gn build] Port
22a1aa5a43cb
Scott Linder [Thu, 4 Nov 2021 16:52:32 +0000 (16:52 +0000)]
[DebugInfo] Enforce implicit constraints on `distinct` MDNodes
Add UNIQUED and DISTINCT properties in Metadata.def and use them to
implement restrictions on the `distinct` property of MDNodes:
* DIExpression can currently be parsed from IR or read from bitcode
as `distinct`, but this property is silently dropped when printing
to IR. This causes accepted IR to fail to round-trip. As DIExpression
appears inline at each use in the canonical form of IR, it cannot
actually be `distinct` anyway, as there is no syntax to describe it.
* Similarly, DIArgList is conceptually always uniqued. It is currently
restricted to only appearing in contexts where there is no syntax for
`distinct`, but for consistency it is treated equivalently to
DIExpression in this patch.
* DICompileUnit is already restricted to always being `distinct`, but
along with adding general support for the inverse restriction I went
ahead and described this in Metadata.def and updated the parser to be
general. Future nodes which have this restriction can share this
support.
The new UNIQUED property applies to DIExpression and DIArgList, and
forbids them to be `distinct`. It also implies they are canonically
printed inline at each use, rather than via MDNode ID.
The new DISTINCT property applies to DICompileUnit, and requires it to
be `distinct`.
A potential alternative change is to forbid the non-inline syntax for
DIExpression entirely, as is done with DIArgList implicitly by requiring
it appear in the context of a function. For example, we would forbid:
!named = !{!0}
!0 = !DIExpression()
Instead we would only accept the equivalent inlined version:
!named = !{!DIExpression()}
This essentially removes the ability to create a `distinct` DIExpression
by construction, as there is no syntax for `distinct` inline. If this
patch is accepted as-is, the result would be that the non-canonical
version is accepted, but the following would be an error and produce a diagnostic:
!named = !{!0}
; error: 'distinct' not allowed for !DIExpression()
!0 = distinct !DIExpression()
Also update some documentation to consistently use the inline syntax for
DIExpression, and to describe the restrictions on `distinct` for nodes
where applicable.
Reviewed By: StephenTozer, t-tye
Differential Revision: https://reviews.llvm.org/D104827
Louis Dionne [Wed, 4 Nov 2020 13:56:04 +0000 (08:56 -0500)]
[libc++] Simplify selftest to avoid passing arguments to it
This makes the test pass on executors that don't support passing additional
arguments.
Differential Revision: https://reviews.llvm.org/D113483
Chih-Ping Chen [Wed, 3 Nov 2021 20:44:00 +0000 (16:44 -0400)]
[CodeView] Properly handle a DISubprogram in getScopeIndex.
Differential Revision: https://reviews.llvm.org/D113142
Louis Dionne [Fri, 29 Oct 2021 16:36:57 +0000 (12:36 -0400)]
[libc++] Enable -Wformat-nonliteral when building libc++
Using user-provided data as a format string is a well known source of
security vulnerabilities. For this reason, it is a good idea to compile
our code with -Wformat-nonliteral, which basically warns if a non-constant
string is used as a format specifier. This is the compiler’s best signal
that a format string call may be insecure.
I audited the code after adding the warning and made sure that the few
places where we used a non-literal string as a format string were not
potential security issues. I either disabled the warning locally for
those instances or fixed the warning by using a literal. The idea is
that after we add the warning to the build, any new use of a non-literal
string in a format string will trigger a diagnostic, and we can either
get rid of it or disable the warning locally, which is a way of
acknowledging that it has been audited.
I also looked into enabling it in the test suite, which would perhaps
allow finding additional instances of it in our headers, however that
is not possible at the moment because Clang doesn't support putting
__attribute__((__format__(...))) on variadic templates, which would
be needed.
rdar://
84571685
Differential Revision: https://reviews.llvm.org/D112927
Adrian Prantl [Tue, 9 Nov 2021 18:15:54 +0000 (10:15 -0800)]
Add a requires line to test.
Dwight Guth [Tue, 9 Nov 2021 18:13:33 +0000 (10:13 -0800)]
[llvm-reduce] Add flag to start at finer granularity
Sometimes if llvm-reduce is interrupted in the middle of a delta pass on
a large file, it can take quite some time for the tool to start actually
doing new work if it is restarted again on the partially-reduced file. A
lot of time ends up being spent testing large chunks when these large
chunks are very unlikely to actually pass the interestingness test. In
cases like this, the tool will complete faster if the starting
granularity is reduced to a finer amount. Thus, we introduce a command
line flag that automatically divides the chunks into smaller subsets a
fixed, user-specified number of times prior to beginning the core loop.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D112651
Mehdi Amini [Tue, 9 Nov 2021 18:11:59 +0000 (18:11 +0000)]
Revert "[mlir] Add nano precision clock to execution engine"
This reverts commit
48d1f099d492b0d796743d1528f09947e4d2d864.
Broke the MLIR buildbots
Michael Jones [Mon, 1 Nov 2021 17:32:19 +0000 (10:32 -0700)]
[libc] refactor atof string parsing
Split the code for parsing hexadecimal floating point numbers from the
code for parsing the decimal floating point numbers so that the parsing
can be faster for both of them.
This decreases the time for the benchmark in release mode by about 15%,
which noticeably beats GLibc.
Old version: 2.299s
New version: 1.893s
GLibc: 2.133s
Tests run by running the following command 10 times for each version:
time ~/llvm-project/build/bin/libc_str_to_float_comparison_test ~/parse-number-fxx-test-data/data/*
the parse-number-fxx-test-data-repository is here:
https://github.com/nigeltao/parse-number-fxx-test-data/tree/
fe94de252c691900982050c8e7c503d1efd1299a
It's important to build llvm-libc in Release mode for accurate
performance comparisons against glibc (set -DCMAKE_BUILD_TYPE=Release in
your cmake).
You also have to build the libc_str_to_float_comparison_test target.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D113036
Fangrui Song [Tue, 9 Nov 2021 18:08:41 +0000 (10:08 -0800)]
[llvm-objdump] -p: Dump PE header for PE/COFF
For a trivial DLL built with `clang --target=x86_64-windows -O2 -c a.c; lld-link -subsystem:console -dll a.o -out:a.dll`,
`objdump -p` vs `llvm-objdump -p`:
```
-a.dll: file format pei-x86-64
-
+a.dll: file format coff-x86-64
Characteristics 0x2022
executable
large address aware
@@ -57,4 +56,4 @@
Entry d
0000000000000000 00000000 Delay Import Directory
Entry e
0000000000000000 00000000 CLR Runtime Header
Entry f
0000000000000000 00000000 Reserved
-
+Export Table:
```
For a Linux image (`vmlinuz-5.10.76-gentoo-r1`) built with `CONFIG_EFI_STUB=y`
```
-vmlinuz-5.10.76-gentoo-r1: file format pei-x86-64
-
-Characteristics 0x20e
+vmlinuz-5.10.76-gentoo-r1: file format coff-x86-64
+Characteristics 0x206
executable
line numbers stripped
- symbols stripped
debugging information removed
Time/Date Wed Dec 31 16:00:00 1969
@@ -55,10 +53,4 @@
Entry d
0000000000000000 00000000 Delay Import Directory
Entry e
0000000000000000 00000000 CLR Runtime Header
Entry f
0000000000000000 00000000 Reserved
-
-
-PE File Base Relocations (interpreted .reloc section contents)
-
-Virtual Address:
000037ca Chunk size 10 (0xa) Number of fixups 1
- reloc 0 offset 0 [37ca] ABSOLUTE
-
+Export Table:
```
`symbols stripped` looks like a GNU objdump problem.
Reviewed By: jhenderson, alexander-shaposhnikov
Differential Revision: https://reviews.llvm.org/D113356
Gulfem Savrun Yeniceri [Mon, 30 Aug 2021 19:12:16 +0000 (19:12 +0000)]
[compiler-rt] Add more diagnostic to InstrProfError
If profile data is malformed for any kind of reason, we generate
an error that only reports "malformed instrumentation profile data"
without any further information. This patch extends InstrProfError
class to receive an optional error message argument, so that we can
do better error reporting.
Differential Revision: https://reviews.llvm.org/D108942
Mark de Wever [Wed, 3 Nov 2021 19:50:59 +0000 (20:50 +0100)]
[libc++] Fix lifetime issues of temporaries.
The ASAN build failed due to using pointers to a temporary whose
lifetime had expired.
Updating the libc++ Docker image to Ubuntu Focal caused some breakage.
This was temporary disabled in D112737. This re-enables two of these
tests.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D113137
Mark de Wever [Wed, 3 Nov 2021 20:09:59 +0000 (21:09 +0100)]
[libc++] Mark a failing test.
The tests fails in debug mode since it manipulates an iterator to a
`std::string` returned from the dylib. This is a known issue for the
debug iterators.
Updating the libc++ Docker image to Ubuntu Focal caused some breakage.
This was temporary disabled in D112737. This re-enables one of these
tests.
Reviewed By: ldionne, #libc, Quuxplusone
Differential Revision: https://reviews.llvm.org/D113139
Mark de Wever [Mon, 8 Nov 2021 17:58:18 +0000 (18:58 +0100)]
[libc++][cmake] Improves benchmark build.
The CMake dependencies don't properly list the libc++ headers. When a
libc++ header is modified the affected benchmarks aren't rebuild. This
makes testing benchmarks tricky and may cause accidentally not using the
latest modifications during testing. This change causes CMake to
determine the proper dependencies.
This shouldn't affect the CI build.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D113419
Benjamin Kramer [Tue, 9 Nov 2021 17:55:52 +0000 (18:55 +0100)]
[ARM] Fix unused variable warning in Release builds
Fangrui Song [Tue, 9 Nov 2021 17:54:12 +0000 (09:54 -0800)]
[ELF] Improve sh_info=0 and sh_info>=num_sections diagnostic for SHT_REL/SHT_RELA
PR52408 reported an sh_info=0 instance. I have seen sh_info=0
independently before.
sh_info>=num_sections is probably very rare. Just use one diagnostic for
the two types of errors.
Delete invalid-relocations.test which is covered by invalid/bad-reloc-target.test
Differential Revision: https://reviews.llvm.org/D113466
Emil Kieri [Tue, 9 Nov 2021 15:10:42 +0000 (16:10 +0100)]
[flang] Fix error in characteristics check at procedure pointer assignment
If the procedure pointer has an explicit interface, its characteristics must
equal the characteristics of its target, except that the target may be pure or
elemental also when the pointer is not (cf. F2018 10.2.2.4(3)). In the semantics
check for assignment of procedure pointers, the attributes of the procedures
were not checked correctly due to a typo. This caused some illegal
pointer-target-combinations to pass without raising an error. Fix this, and
expand the test case to improve the coverage of procedure pointer assignment
checks.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D113368
Sanjay Patel [Tue, 9 Nov 2021 17:31:15 +0000 (12:31 -0500)]
[InstCombine] fold sub-of-umax to 0-usubsat
Op0 - umax(X, Op0) --> 0 - usub.sat(X, Op1)
I'm not sure if this is really an improvement in IR because
we probably have better recognition/analysis for min/max,
but this lines up with the fold we do for the icmp+select
idiom and removes another diff from D98152.
This is similar to the previous fold in the code that was
added with:
83c2fb9f66be
baa6a851308d
https://alive2.llvm.org/ce/z/5MrVB9
Sanjay Patel [Tue, 9 Nov 2021 16:24:35 +0000 (11:24 -0500)]
[InstCombine] fix typo in test; NFC
This was intended to commute the previous test, but failed to swap the values.
Adrian Prantl [Tue, 9 Nov 2021 01:01:21 +0000 (17:01 -0800)]
Support looking up absolute symbols
The Swift stdlib uses absolute symbols in the dylib to communicate
feature flags to the process. LLDB's expression evaluator needs to be
able to find them. This wires up absolute symbols so they show up in
the symtab lookup command, which is also all that's needed for them to
be visible to the expression evaluator JIT.
rdar://
85093828
Differential Revision: https://reviews.llvm.org/D113445
Aaron Puchert [Tue, 9 Nov 2021 14:05:30 +0000 (15:05 +0100)]
Comment parsing: Complete list of Doxygen commands
These should be all the commands from [1] except those that are marked
obsolete, and "link" / "endlink", as that conflicts with the existing
HeaderDoc pair "link / "/link". For some commands we don't have the
ideal category, but it should work good enough for most cases.
There seems to be no existing test for most commands (except the ones
interpreted by -Wdocumentation), and to some extent such a test wouldn't
look very interesting. But I added a test for the correct parsing of
formulas, as they're a bit special. And I had to adapt
comment-lots-of-unknown-commands.c because typo correction was kicking
in and recognizing some of the commands.
This should fix a couple of reported bugs: PR17437, PR19581, PR24062
(partially, no diagnostic for matching cond/endcond), PR32909, PR37813,
PR44243 (partially, email@domain.com must be addressed separately).
[1] https://www.doxygen.nl/manual/commands.html
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D111190
Konstantin Varlamov [Tue, 9 Nov 2021 17:21:02 +0000 (09:21 -0800)]
[libc++] P0433R2: test that deduction guides are properly SFINAEd away.
Deduction guides for containers should not participate in overload
resolution when called with certain incorrect types (e.g. when called
with a template argument in place of an `InputIterator` that doesn't
qualify as an input iterator). Similarly, class template argument
deduction should not select `unique_ptr` constructors that take a
a pointer.
The tests try out every possible incorrect parameter (but never more
than one incorrect parameter in the same invocation).
Also add deduction guides to the synopsis for associative and unordered
containers (this was accidentally omitted from [D112510](https://reviews.llvm.org/D112510)).
Differential Revision: https://reviews.llvm.org/D112904
Jacques Pienaar [Tue, 9 Nov 2021 17:30:37 +0000 (09:30 -0800)]
[mlir] Flip math dialect to _Both prefixed form (NFC)
See https://llvm.discourse.group/t/psa-ods-generated-accessors-will-change-to-have-a-get-prefix-update-you-apis/4476
Ard Biesheuvel [Tue, 9 Nov 2021 17:26:29 +0000 (18:26 +0100)]
[ARM] reject -mtp=cp15 if target subarch does not support it
Currently, we permit -mtp=cp15 even for targets that don't implement the
TLS register. When building for ARMv6 or earlier, this means we emit
instructions that will UNDEF at runtime. For Thumb1, passing -mtp=cp15
will trigger an assert in the backend.
So let's add some diagnostics to ensure that -mtp=cp15 is only accepted
for ARMv6T2 or newer.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D113026
Luís Ferreira [Tue, 9 Nov 2021 17:04:46 +0000 (09:04 -0800)]
[Demangle] Add minimal support for D programming language
This patch adds minimal support for D programming language demangling on LLVM
core based on the D name mangling spec. This will allow easier integration on a
future LLDB plugin for D either in the upstream tree or outside of it.
Minimal support includes recognizing D demangling encoding and at least one
mangling name, which in this case is `_Dmain` mangle.
Reviewed By: jhenderson, lattner
Differential Revision: https://reviews.llvm.org/D111414
Ard Biesheuvel [Tue, 9 Nov 2021 09:18:09 +0000 (10:18 +0100)]
[ARM] implement support for TLS register based stack protector
Implement support for loading the stack canary from a memory location held in
the TLS register, with an optional offset applied. This is used by the Linux
kernel to implement per-task stack canaries, which is impossible on SMP systems
when using a global variable for the stack canary.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D112768
Jonathan Peyton [Mon, 1 Nov 2021 19:23:54 +0000 (14:23 -0500)]
[OpenMP][libomp][CMake] use uppercase_CMAKE_BUILD_TYPE
Have standalone builds define uppercase_CMAKE_BUILD_TYPE and use it.
llvm/CMakeLists.txt defines uppercase_CMAKE_BUILD_TYPE for regular LLVM
builds with OpenMP enabled.
Differential Revision: https://reviews.llvm.org/D112951
Vy Nguyen [Tue, 9 Nov 2021 15:42:21 +0000 (10:42 -0500)]
Reland "[lld-macho] Fix assertion failure in registerCompactUnwind""
PR/52372
Differential Revision: https://reviews.llvm.org/D112977
New changes:
- use llvm-otool instead of `otool` which doesn't in exist on non-OSX platforms
- add llvm-otool to the set of tools used by test so that the bot will use the <build_dir>/bin/llvm-otool instead of the unqualified `llvm-otool` (which may not exist)
- update tests since the latest (TOT) llvm-otool prints a space between two bytes and the old one doesn't.
Andy Yankovsky [Mon, 8 Nov 2021 14:44:31 +0000 (15:44 +0100)]
[lldb-vscode] Add presentation hints for scopes
Scopes can have an optional hint for how to present this scope in the UI:
https://microsoft.github.io/debug-adapter-protocol/specification#Types_Scope
The IDEs can use the hint to present the data accordingly. For example,
Visual Studio has a separate Registers window, which is populated with the
data from the scope with `presentationHint: "registers"`.
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D113400
zijunzhao [Tue, 9 Nov 2021 16:36:06 +0000 (16:36 +0000)]
Revert "add tsan shared lib"
This reverts commit
92c9b340be4164f44772ddf5a50a4a5acdbd6607.
Sanjay Patel [Tue, 9 Nov 2021 15:48:47 +0000 (10:48 -0500)]
[InstCombine] allow commute in sub-of-umax fold
This fold was added with:
83c2fb9f66be
...but missed the commuted pattern:
https://alive2.llvm.org/ce/z/_tYEGy
Sanjay Patel [Tue, 9 Nov 2021 15:35:13 +0000 (10:35 -0500)]
[InstCombine] add/move tests for sub-of-umax; NFC
Martin Storsjö [Tue, 9 Nov 2021 08:14:16 +0000 (10:14 +0200)]
[libcxx] Add a dependency on unwind in cxx_static, if LIBCXXABI_USE_LLVM_UNWINDER is set
Even if building cxx_static in itself doesn't actually link in the
requested unwinder, add a synthetic dependency so that building
cxx_static makes sure that the unwinder that was requested to be used
also gets built.
This makes sure that tests (when run with just a plain "ninja check-cxx")
actually use the newly built unwinder, as intended.
Differential Revision: https://reviews.llvm.org/D113467
Nathan Sidwell [Tue, 9 Nov 2021 15:39:22 +0000 (07:39 -0800)]
[clang] [docs] Fix markup
code-block needs a blank line
Differential Revision: https://reviews.llvm.org/D113425
Vy Nguyen [Tue, 9 Nov 2021 15:31:47 +0000 (10:31 -0500)]
Revert "[lld-macho] Fix assertion failure in registerCompactUnwind"
broke windows build - reverting to investigate
This reverts commit
b2d92584742e333799ed6a3687c801dde9bb6174.
Nathan Sidwell [Mon, 8 Nov 2021 17:45:26 +0000 (09:45 -0800)]
[clang] GCC directive extension extension: Hash NNN lines
Some time back I extended GCC's '# NNN' line marker semantics.
Specifically popping to a blank filename will restore the filename to
that of the popped-to include. Restore to line 5 of including file
(escaped BOL #'s to avoid git eliding them):
\# 5 "" 2
Added documentation for this line control extension.
This was useful in developing modules tests, but turned out to also be
useful with machine-generated source code. Specifically, a generated
include file that itself includes fragments from elsewhere. The
ability to pop to the generated include file -- with its full path
prefix -- is useful for diagnostic & debug purposes. For instance
something like:
// Machine generated -- DO NOT EDIT
Type Var = {
\# 7 "encoded.dsl" 1 // push to snippet-container
{snippet, of, code}
\# 6 " 2 // Restore to machined-generated source
,
};
// user-code
...
\#include "dsl.h"
...
That pop to "" will restore the filename to '..includepath../dsl.h',
which is better than restoring to plain "dsl.h".
Differential Revision: https://reviews.llvm.org/D113425
Simon Pilgrim [Tue, 9 Nov 2021 15:11:21 +0000 (15:11 +0000)]
[X86] combineMulToPMADDWD - handle any pow2 vector type and split to legal types
combineMulToPMADDWD is currently limited to legal types, but there's no reason why we can't handle any larger type that the existing SplitOpsAndApply code can use to split to legal X86ISD::VPMADDWD ops.
This also exposed a missed opportunity for pre-SSE41 targets to handle SEXT ops from types smaller than vXi16 - without PMOVSX instructions these will always be expanded to unpack+shifts, so we can cheat and convert this into a ZEXT(SEXT()) sequence to make it a valid PMADDWD op.
Differential Revision: https://reviews.llvm.org/D110995
Kazu Hirata [Tue, 9 Nov 2021 15:11:13 +0000 (07:11 -0800)]
[llvm] Use MachineBasicBlock::{successors,predecessors} (NFC)
Vy Nguyen [Tue, 2 Nov 2021 20:28:31 +0000 (16:28 -0400)]
[lld-macho] Fix assertion failure in registerCompactUnwind
PR/52372
Differential Revision: https://reviews.llvm.org/D112977
Matt Morehouse [Tue, 9 Nov 2021 14:52:32 +0000 (06:52 -0800)]
[HWASan] Ensure RNG is initialized in GenerateRandomTag
Fixes a CHECK-failure caused by glibc's pthread_getattr_np
implementation calling realloc. Essentially, Thread::GenerateRandomTag
gets called during Thread::Init and before Thread::InitRandomState:
HWAddressSanitizer: CHECK failed: hwasan_thread.cpp:134 "((random_buffer_)) != (0)" (0x0, 0x0) (tid=314)
#0 0x55845475a662 in __hwasan::CheckUnwind()
#1 0x558454778797 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long)
#2 0x558454766461 in __hwasan::Thread::GenerateRandomTag(unsigned long)
#3 0x55845475c58b in __hwasan::HwasanAllocate(__sanitizer::StackTrace*, unsigned long, unsigned long, bool)
#4 0x55845475c80a in __hwasan::hwasan_realloc(void*, unsigned long, __sanitizer::StackTrace*)
#5 0x5584547608aa in realloc
#6 0x7f6f3a3d8c2c in pthread_getattr_np
#7 0x5584547790dc in __sanitizer::GetThreadStackTopAndBottom(bool, unsigned long*, unsigned long*)
#8 0x558454779651 in __sanitizer::GetThreadStackAndTls(bool, unsigned long*, unsigned long*, unsigned long*, unsigned long*)
#9 0x558454761bca in __hwasan::Thread::InitStackAndTls(__hwasan::Thread::InitState const*)
#10 0x558454761e5c in __hwasan::HwasanThreadList::CreateCurrentThread(__hwasan::Thread::InitState const*)
#11 0x55845476184f in __hwasan_thread_enter
#12 0x558454760def in HwasanThreadStartFunc(void*)
#13 0x7f6f3a3d6fa2 in start_thread
#14 0x7f6f3a15b4ce in __clone
Also reverts
7a3fb71c3cbdd80666335fa8f6f071b43f0b922a, as it's now
unneeded.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D113045
serge-sans-paille [Fri, 15 Oct 2021 13:18:52 +0000 (15:18 +0200)]
Misleading unicode identifier detection pass
Detect when an identifier contains some Right-To-Left characters.
This pass relates to https://trojansource.codes/
Differential Revision: https://reviews.llvm.org/D112914
Sergei Larin [Wed, 7 Feb 2018 17:55:58 +0000 (11:55 -0600)]
Update MaxMinLatency even if dependencies have been already scheduled.
Covers an extremely rare corner case on internal book keeping.
Kerry McLaughlin [Tue, 9 Nov 2021 09:51:00 +0000 (09:51 +0000)]
[LoopVectorize] Extract the last lane from a uniform store
Changes VPReplicateRecipe to extract the last lane from an unconditional,
uniform store instruction. collectLoopUniforms will also add stores to
the list of uniform instructions where Legal->isUniformMemOp is true.
setCostBasedWideningDecision now sets the widening decision for
all uniform memory ops to Scalarize, where previously GatherScatter
may have been chosen for scalable stores.
This fixes an assert ("Cannot yet scalarize uniform stores") in
setCostBasedWideningDecision when we have a loop containing a
uniform i1 store and a scalable VF, which we cannot create a scatter for.
Reviewed By: sdesmalen, david-arm, fhahn
Differential Revision: https://reviews.llvm.org/D112725
Valentin Clement [Tue, 9 Nov 2021 14:37:49 +0000 (15:37 +0100)]
[fir] Add fir.convert op conversion from FIR to LLVM IR
Add conversion pattern for the `fir.convert` operation.
This patch is part of the upstreaming effort from fir-dev branch.
This patch was previously landed with a truncated version that
was failing the windows buildbot.
Reviewed By: rovka, awarzynski
Differential Revision: https://reviews.llvm.org/D113469
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Pavel Labath [Thu, 4 Nov 2021 12:23:12 +0000 (13:23 +0100)]
[lldb] Fix cross-platform kills
This patch fixes an amusing bug where a Platform::Kill operation would
happily terminate a proces on a completely different platform, as long
as they have the same process ID. This was due to the fact that the
implementation was iterating through all known (debugged) processes in
order terminate them directly.
This patch just deletes that logic, and makes everything go through the
OS process termination APIs. While it would be possible to fix the logic
to check for a platform match, it seemed to me that the implementation
was being too smart for its own good -- accessing random Process
objects without knowing anything about their state is risky at best.
Going through the os ensures we avoid any races.
I also "upgrade" the termination signal to a SIGKILL to ensure the
process really dies after this operation.
Differential Revision: https://reviews.llvm.org/D113184
Kristóf Umann [Mon, 8 Nov 2021 13:40:45 +0000 (14:40 +0100)]
[analyzer][docs] Fix the incorrect structure of the checker docs
The alpha.security.cert section came right after alpha.security, making it look
like checkers like alpha.security.MmapWriteExec belonged to that package.
Differential Revision: https://reviews.llvm.org/D113397
Valentin Clement [Tue, 9 Nov 2021 14:03:51 +0000 (15:03 +0100)]
Revert "[fir] Add fir.convert op conversion from FIR to LLVM IR"
This reverts commit
165879ec31ed5cc6e4e1a2524c86fc80b81ebbda.
Windows buildbot failure
Valentin Clement [Tue, 9 Nov 2021 13:54:21 +0000 (14:54 +0100)]
[fir] Add fir.convert op conversion from FIR to LLVM IR
Add conversion pattern for the `fir.convert` operation.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: rovka, awarzynski
Differential Revision: https://reviews.llvm.org/D113469
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Sanjay Patel [Tue, 9 Nov 2021 13:27:09 +0000 (08:27 -0500)]
[InstCombine] enhance vector bitwise select matching
(Cond & C) | (~bitcast(Cond) & D) --> bitcast (select Cond, (bc C), (bc D))
This is part of fixing:
https://llvm.org/PR34047
That report shows a case where a bitcast is sitting between the select condition
candidate and its 'not' value due to current cast canonicalization rules.
There's a bitcast type restriction that might be violated in existing matching,
but I still need to investigate if that is possible -
Alive2 shows we can only do this transform safely when the bitcast is from
narrow to wide vector elements (otherwise poison could leak into elements
that were safe in the original code):
https://alive2.llvm.org/ce/z/Hf66qh
Differential Revision: https://reviews.llvm.org/D113035
Chris Jackson [Tue, 9 Nov 2021 13:26:54 +0000 (13:26 +0000)]
[DebugInfo][LSR] Add test for use of IV with a SCEV containing undef
Added a lit test that checks scev-based salvagaing does not select IVs
that have a SCEV containing an undef.
Original Differential Revision: https://reviews.llvm.org/D111810
Denys Shabalin [Tue, 9 Nov 2021 11:02:33 +0000 (12:02 +0100)]
[mlir] Add nano precision clock to execution engine
Reviewed By: ftynse, nicolasvasilache
Differential Revision: https://reviews.llvm.org/D113476
Valentin Clement [Tue, 9 Nov 2021 13:26:40 +0000 (14:26 +0100)]
[fir] Force target for FIR to LLVM IR conversion
Valentin Clement [Tue, 9 Nov 2021 13:15:07 +0000 (14:15 +0100)]
[fir] Add complex operations conversion from FIR LLVM IR
This patch add conversion for primitive operations on complex types.
- fir.addc
- fir.subc
- fir.mulc
- fir.divc
- fir.negc
This adds also the type conversion for !fir.complex<KIND> type.
This patch is part of the upstreaming effort from fir-dev branch.
This patch was updated to avoid failure on windows buildbot.
Flang codegen does not support windows target so we force the test
to use a known target instead.
Reviewed By: kiranchandramohan, rovka
Differential Revision: https://reviews.llvm.org/D113434
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Chris Jackson [Tue, 9 Nov 2021 12:22:59 +0000 (12:22 +0000)]
[DebugInfo][LSR] Add more stringent checks on IV selection and salvage
attempts
Prevent the selection of IVs that have a SCEV containing an undef. Also
prevent salvaging attempts for values for which a SCEV could not be
created by ScalarEvolution and have only SCEVUknown.
Reviewed by: Orlando
Differential Revision: https://reviews.llvm.org/D111810
Florian Hahn [Tue, 9 Nov 2021 12:56:22 +0000 (12:56 +0000)]
[SimplifyCFG] Add early bailout if Use is not in same BB.
Without this patch, passingValueIsAlwaysUndefined will iterate over all
instructions from I to the end of the basic block, even if the use is
outside the block.
This patch adds an early bail out, if the use instruction is outside I's
BB. This can greatly reduce compile-time in cases where very large basic
blocks are involved, with a large number of PHI nodes and incoming
values.
Note that the refactoring makes the handling of the case where I is a
phi and Use is in PHI more explicit as well: for phi nodes, we can also
directly bail out. In the existing code, we would iterate until we reach
the end and return false.
Based on an earlier patch by Matt Wala.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D113293
David Pagan [Tue, 9 Nov 2021 12:33:39 +0000 (07:33 -0500)]
Initial parsing/sema for 'align' clause
Added basic parsing/sema/serialization support for 'align' clause for use with
'allocate' directive.
Andrew Savonichev [Tue, 9 Nov 2021 12:30:19 +0000 (15:30 +0300)]
[AArch64] Add Machine InstCombiner patterns for FMUL indexed variant
This patch adds DUP+FMUL => FMUL_indexed pattern to InstCombiner.
FMUL_indexed is normally selected during instruction selection, but it
does not work in cases when VDUP and VMUL are in different basic
blocks.
Differential Revision: https://reviews.llvm.org/D99662
Salman Javed [Tue, 9 Nov 2021 12:03:26 +0000 (01:03 +1300)]
[clang-tidy] Fix lint warning in ClangTidyDiagnosticConsumer.cpp (NFC)
Calling clang-tidy on ClangTidyDiagnosticConsumer.cpp gives a
"unmatched NOLINTBEGIN without a subsequent NOLINTEND" warning.
The "NOLINTBEGIN" and "NOLINTEND" string literals used in the
implementation of `createNolintError()` get mistaken for actual
NOLINTBEGIN/END comments used to suppress clang-tidy warnings.
Rewrite the string literals so that they can no longer be mistaken for
actual suppression comments.
Differential Revision: https://reviews.llvm.org/D113472
Valentin Clement [Tue, 9 Nov 2021 12:07:36 +0000 (13:07 +0100)]
Revert "[fir] Add complex operations conversion from FIR LLVM IR"
This reverts commit
b9bc64ba147fb90c199c56ec644e24fcabe74a5c.
flang-x86_64-windows is failing with this patch
Daniel Kiss [Thu, 4 Nov 2021 15:29:12 +0000 (16:29 +0100)]
Reland "[libcxxabi][ARM] Make CXX_end_cleanup compatible with Armv6-M"
On Armv6-M the branch may not able to reach the _Unwind_Resume function because it's relocation(R_ARM_THM_JUMP11) is in -2048, 2047 range only.
Reviewed By: chill, stuij, lenary
Differential Revision: https://reviews.llvm.org/D113181
Simon Pilgrim [Tue, 9 Nov 2021 10:18:00 +0000 (10:18 +0000)]
[SelectionDAG] Merge FoldConstantVectorArithmetic into FoldConstantArithmetic (PR36544)
This patch merges FoldConstantVectorArithmetic back into FoldConstantArithmetic.
Like FoldConstantVectorArithmetic we now handle vector ops with any operand count, but we currently still only handle binops for scalar types - this can be improved in future patches - in particular some common unary/trinary ops still have poor constant folding.
There's one change in functionality causing test changes - FoldConstantVectorArithmetic bails early if the build/splat vector isn't all constant (with some undefs) elements, but FoldConstantArithmetic doesn't - it instead attempts to fold the scalar nodes and bails if they fail to regenerate a constant/undef result, allowing some additional identity/undef patterns to be handled.
Differential Revision: https://reviews.llvm.org/D113300
Roman Lebedev [Tue, 9 Nov 2021 11:19:18 +0000 (14:19 +0300)]
[NFC][X86][Costmodel] Add i16 replication shuffle costmodel test coverage