Commit Graph

404168 Commits

Author SHA1 Message Date
Gulfem Savrun Yeniceri 126e7611c7 [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
2021-11-09 20:30:03 +00:00
David Green 1f01b31755 [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.
2021-11-09 20:29:42 +00:00
Matt Arsenault 62ffcc5f37 AMDGPU: Regenerate test checks
Update these to include -NEXT to avoid spurious changes in a future
commit.
2021-11-09 15:28:59 -05:00
Andrzej Warzynski e3349fa1a3 [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>
2021-11-09 20:22:45 +00:00
Nikita Popov 0aabdad1ef [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.
2021-11-09 21:18:31 +01:00
LLVM GN Syncbot a8b2277069 [gn build] Port 737c4a2673 2021-11-09 20:11:28 +00:00
Atmn Patel 737c4a2673 [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
2021-11-09 15:11:05 -05:00
Mogball 2dd00c17e0 [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
2021-11-09 20:09:21 +00:00
Nikita Popov bb12dedede [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
2021-11-09 21:05:46 +01:00
Yonghong Song 8d499bd5bc BPF: change btf_type_tag BTF output format
For the declaration like below:
  int __tag1 * __tag1 __tag2 *g
Commit 41860e602a ("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
2021-11-09 11:34:25 -08:00
Stanislav Mekhanoshin 791baf38e1 [InstCombine] Fuse checks for LHS (~(A | B) & C) | ... NFC.
Differential Revision: https://reviews.llvm.org/D113132
2021-11-09 11:31:22 -08:00
Jorge Gorbe Moya 74add1b6d6 Revert "[clang-tidy] Fix lint warning in ClangTidyDiagnosticConsumer.cpp (NFC)"
The change causes multiple clang-tidy tests to fail under ASan.

This reverts commit 0076957202.
2021-11-09 11:28:48 -08:00
Sanjay Patel d5c002bdc7 [InstCombine] fix code comment to match code; NFC 2021-11-09 14:27:29 -05:00
Mark de Wever 65fceaebc7 [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
2021-11-09 20:12:02 +01:00
Yuanfang Chen 7562c64197 [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
2021-11-09 10:57:38 -08:00
Ellis Hoag f19471a249 [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
2021-11-09 10:52:34 -08:00
Pavel Labath adc7d63f46 [lldb] XFAIL TestPlatformKill on windows
-> PR52451
2021-11-09 19:50:14 +01:00
Adrian Prantl 68a4d179c2 Use yaml2obj instead of relying on invoking the Darwin system assembler. 2021-11-09 10:47:26 -08:00
Dwight Guth 16c3db8def [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
2021-11-09 10:43:38 -08:00
LLVM GN Syncbot a5d6dcbbb2 [gn build] Port 5338629333 2021-11-09 18:38:40 +00:00
Arthur Eubanks 1d8750c3da [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
2021-11-09 10:35:58 -08:00
Kazu Hirata a340d47419 [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]
2021-11-09 10:34:00 -08:00
Douglas Yung 7cd273c339 Revert "Reapply db28934 "[IndVars] Pass TTI to replaceCongruentIVs""
This reverts commit 5ec2386332.

This change is causing test failures on the PS4 linux build bot: https://lab.llvm.org/buildbot/#/builders/139/builds/12871
2021-11-09 10:28:41 -08:00
Simon Pilgrim 5338629333 Revert rG299aa4dfa1d8c120648b1404b481d858b76c8173 "Misleading unicode identifier detection pass"
This is failing on various buildbots: https://lab.llvm.org/buildbot/#/builders/109/builds/25932
2021-11-09 18:25:55 +00:00
Arthur Eubanks 29a8b1fe18 [gn build] Port 299aa4dfa1 2021-11-09 10:21:17 -08:00
Arthur Eubanks 87003cd80d [gn build] Port 22a1aa5a43 2021-11-09 10:21:17 -08:00
Scott Linder ee76525698 [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
2021-11-09 18:19:11 +00:00
Louis Dionne 181763d475 [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
2021-11-09 13:18:23 -05:00
Chih-Ping Chen cf0e32d197 [CodeView] Properly handle a DISubprogram in getScopeIndex.
Differential Revision: https://reviews.llvm.org/D113142
2021-11-09 13:18:07 -05:00
Louis Dionne a4ba780510 [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
2021-11-09 13:17:45 -05:00
Adrian Prantl 56f7da6e0d Add a requires line to test. 2021-11-09 10:16:03 -08:00
Dwight Guth fbfd327fdf [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
2021-11-09 10:14:08 -08:00
Mehdi Amini c296609b68 Revert "[mlir] Add nano precision clock to execution engine"
This reverts commit 48d1f099d4.

Broke the MLIR buildbots
2021-11-09 18:12:42 +00:00
Michael Jones 8298424cae [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:
fe94de252c

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
2021-11-09 10:12:18 -08:00
Fangrui Song 5f1e509579 [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
2021-11-09 10:08:41 -08:00
Gulfem Savrun Yeniceri ee88b8d63e [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
2021-11-09 18:04:12 +00:00
Mark de Wever 1e78d5d008 [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
2021-11-09 19:01:22 +01:00
Mark de Wever a948a0a23c [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
2021-11-09 19:00:09 +01:00
Mark de Wever 3ca520f19f [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
2021-11-09 18:57:44 +01:00
Benjamin Kramer 194897eccf [ARM] Fix unused variable warning in Release builds 2021-11-09 18:55:52 +01:00
Fangrui Song 213d1849a4 [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
2021-11-09 09:54:12 -08:00
Emil Kieri 384b4e0d33 [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
2021-11-09 18:46:54 +01:00
Sanjay Patel 2a88d00cf2 [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:
83c2fb9f66
baa6a85130

https://alive2.llvm.org/ce/z/5MrVB9
2021-11-09 12:46:03 -05:00
Sanjay Patel de12ca31d4 [InstCombine] fix typo in test; NFC
This was intended to commute the previous test, but failed to swap the values.
2021-11-09 12:46:03 -05:00
Adrian Prantl c9881c7d99 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
2021-11-09 09:44:37 -08:00
Aaron Puchert 196554d42d 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
2021-11-09 18:35:26 +01:00
Konstantin Varlamov 68072a7166 [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
2021-11-09 09:32:24 -08:00
Jacques Pienaar 8619212b94 [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
2021-11-09 09:30:37 -08:00
Ard Biesheuvel 24772720c5 [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
2021-11-09 18:29:30 +01:00
Luís Ferreira 22a1aa5a43 [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
2021-11-09 09:29:13 -08:00