Commit Graph

402977 Commits

Author SHA1 Message Date
Austin Kerbow 02e60f2e77 [AMDGPU] Use max waves for scheduler's initial occupancy target
The scheduler should set critical/excess register usage thresholds that
are guided by the maximum possible occupancy for the function. This
change is focused on setting proper lower bounds on register usage which
we would typically only see when a specific number of maximum waves is
requested with the "waves-per-eu" attribute, or by setting
"amdgpu-num-vgpr|sgpr" directly. This was broken previously. I have a
follow-on patch that will address issues with the scheduler not
targeting correct upper bounds on register usage which is typical with
launch bounds and min "waves-per-eu".

Changes by this patch:

Set the initial critical register usage thresholds to minimum values
that are determined by the maximum possible occupancy for the function,
or the number of allocatable registers, whichever is lower.

Avoid unisgned overflow if register limits are lower than the register
tracking "ErrorMargin", I.e. when using stress-regalloc=2.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D112373
2021-10-26 15:30:26 -07:00
Yuanfang Chen 7c3fa52785 [DebugInfo] Skip ODRUniquing for mismatched tags
Otherwise, ODRUniquing would map some member method/variable MDNodes
to have enum type DIScope, resulting in invalid debug info and bad
DWARF.

- Add a Verifier check that when a 'scope:' operand is an ODR type that is not an enum.
- Makes ODRUniquing apply to only ODR types with the same tag so that the debuginfo/DWARF is well-formed.

Reviewed By: probinson, aprantl

Differential Revision: https://reviews.llvm.org/D111770
2021-10-26 15:28:25 -07:00
Greg Clayton 2887d9fd86 Add new key/value pairs to the module statistics for "statistics dump".
The new key/value pairs that are added to each module's stats are:
"debugInfoByteSize": The size in bytes of debug info for each module.
"debugInfoIndexTime": The time in seconds that it took to index the debug info.
"debugInfoParseTime": The time in seconds that debug info had to be parsed.

At the top level we add up all of the debug info size, parse time and index time with the following keys:
"totalDebugInfoByteSize": The size in bytes of all debug info in all modules.
"totalDebugInfoIndexTime": The time in seconds that it took to index all debug info if it was indexed for all modules.
"totalDebugInfoParseTime": The time in seconds that debug info was parsed for all modules.

Differential Revision: https://reviews.llvm.org/D112501
2021-10-26 15:09:31 -07:00
Nuri Amari a299b24712 Regenerate LC_CODE_SIGNATURE during llvm-objcopy operations
**Context:**

This is a second attempt at introducing signature regeneration to llvm-objcopy. In this diff: https://reviews.llvm.org/D109840, a script was introduced to test
the validity of a code signature. In this diff: https://reviews.llvm.org/D109803 (now reverted), an effort was made to extract the signature generation behavior out of LLD into a common location for use in llvm-objcopy. In this diff: https://reviews.llvm.org/D109972 it was decided that there was no appropriate common location and that a small amount of duplication to bring signature generation to llvm-objcopy would be better. This diff introduces this duplication.

**Summary**

Prior to this change, if a LC_CODE_SIGNATURE load command
was included in the binary passed to llvm-objcopy, the command and
associated section were simply copied and included verbatim in the
new binary. If rest of the binary was modified at all, this results
in an invalid Mach-O file. This change regenerates the signature
rather than copying it.

The code_signature_lc.test test was modified to include the yaml
representation of a small signed MachO executable in order to
effectively test the signature generation.

Reviewed By: alexander-shaposhnikov, #lld-macho

Differential Revision: https://reviews.llvm.org/D111164
2021-10-26 14:51:13 -07:00
Danil Stefaniuc 566bfbb740 [formatters] Add a libstdcpp formatter for bitset and unify tests across stdlibs
This diff adds a data formatter for libstdcpp's bitset. Besides, it unifies the tests for bitset for libcxx and libstdcpp for maintainability.

Reviewed By: wallace

Differential Revision: https://reviews.llvm.org/D112180
2021-10-26 14:49:50 -07:00
Sanjay Patel acabad9ff6 [InstCombine] try to canonicalize icmp with trunc op into mask and cmp
The motivating test is based on:
https://llvm.org/PR52260

We have better analysis for X == 0, so try harder to form that.
2021-10-26 17:43:28 -04:00
Sanjay Patel e8fdd030b1 [InstCombine] add tests for icmp with trunc op; NFC 2021-10-26 17:43:28 -04:00
Aart Bik 1e6ef0cfb0 [mlir][sparse] refine trait of sparse_tensor.convert
Rationale:
The currently used trait was demanding that all types are the same
which is not true (since the sparse part may change and the dim sizes
may be relaxed). This revision uses the correct trait and makes the
rank match test explicit in the verify method.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D112576
2021-10-26 14:36:49 -07:00
William Muir 3e94833823 [Bazel] link backtrace library when building llvm/lib/Support under FreeBSD
Links the backtrace library which is required under FreeBSD when building llvm/lib/Support.  This library is similarly linked by CMake on BSD builds at [llvm/lib/Support/CMakeLists.txt](e158b5634a/llvm/lib/Support/CMakeLists.txt (L39-L46))

Reviewed By: GMNGeoffrey

Differential Revision: https://reviews.llvm.org/D110533
2021-10-26 14:24:02 -07:00
Alexey Bataev 5db7568a6a [SLP][NFC]Add a test for poison-free or reduction. 2021-10-26 14:04:05 -07:00
Aart Bik c8d5dcb035 [mlir][sparse] refactor loop sequence codegen
This refactoring adds a few "event" functions (start/end loop-seq/loop) for
readability of the core function of codegen. This also prepares sparse tensor
output codegen, where these "event" functions will provide convenient
placeholders to start or stop insertion bookkeeping.

This revision also includes a few various minor changes that kept on
pending in my local workspace.

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D112506
2021-10-26 13:42:21 -07:00
Jon Chesterfield e42e5785ad [libomptarget][nfc]Generalise DeviceRTL cmake to allow building for amdgpu
Essentially moves the foreach over sm integers into a macro and instantiates it for nvptx.

NFC in that the macro is not presently instantiated for amdgpu as the corresponding code doesn't compile yet.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D111987
2021-10-26 21:18:21 +01:00
Jez Ng a9353dbe51 [lld-macho] Simplify the handling of "no unwind info" functions
This diff does away with `addEntriesForFunctionsWithoutUnwindInfo()`,
because `addSymbol()` can now determine which functions need those
entries.

While overhauling UnwindInfoSection, I also parallelized the relocation
of the contents of the CUEs. This somewhat offsets the time regression
from creating one InputSection per CUE (which was done in D109944).

Reviewed By: #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D109945
2021-10-26 16:04:16 -04:00
Jez Ng 002eda7056 [lld-macho] Associate compact unwind entries with function symbols
Compact unwind entries (CUEs) contain pointers to their respective
function symbols. However, during the link process, it's far more useful
to have pointers from the function symbol to the CUE than vice versa.
This diff adds that pointer in the form of `Defined::compactUnwind`.

In particular, when doing dead-stripping, we want to mark CUEs live when
their function symbol is live; and when doing ICF, we want to dedup
sections iff the symbols in that section have identical CUEs. In both
cases, we want to be able to locate the symbols within a given section,
as well as locate the CUEs belonging to those symbols. So this diff also
adds `InputSection::symbols`.

The ultimate goal of this refactor is to have ICF support dedup'ing
functions with unwind info, but that will be handled in subsequent
diffs. This diff focuses on simplifying `-dead_strip` --
`findFunctionsWithUnwindInfo` is no longer necessary, and
`Defined::isLive()` is now a lot simpler. Moreover, UnwindInfoSection no
longer has to check for dead CUEs -- we simply avoid adding them in the
first place.

Additionally, we now support stripping of dead LSDAs, which follows
quite naturally since `markLive()` can now reach them via the CUEs.

Reviewed By: #lld-macho, gkm

Differential Revision: https://reviews.llvm.org/D109944
2021-10-26 16:04:15 -04:00
Stanislav Mekhanoshin 4faf88cc14 [InstCombine] Precommit new and-xor-or.ll tests. NFC. 2021-10-26 12:57:17 -07:00
Valentin Clement 9daec09551
[fir] Avoid slice with substr in fir.array_load, fir.array_coor and fir.array_merge_store
Substring information on slice operation has been added in D112441.
The operations fir.array_load, fir.array_coor and fir.array_merge_store can take
a slice but not with a substring. This patch add this check in their verifier.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D112568
2021-10-26 21:44:25 +02:00
Alexander Belyaev 7d79a25769 [mlir] Use float literals to make Windows build happy. 2021-10-26 21:36:04 +02:00
Vassil Vassilev c24a58081b Reinstate "[clang-repl] Re-implement clang-interpreter as a test case."
Original commit message: "
  Original commit message: "
    Original commit message: "
       Original commit message:"
         The current infrastructure in lib/Interpreter has a tool, clang-repl, very
         similar to clang-interpreter which also allows incremental compilation.

         This patch moves clang-interpreter as a test case and drops it as conditionally
         built example as we already have clang-repl in place.
       "

       This patch also ignores ppc due to missing weak symbol for __gxx_personality_v0
       which may be a feature request for the jit infrastructure. Also, adds a missing
       build system dependency to the orc jit.
    "

    Additionally, this patch defines a custom exception type and thus avoids the
    requirement to include header <exception>, making it easier to deploy across
    systems without standard location of the c++ headers.
  "

  This patch also works around PR49692 and finds a way to use llvm::consumeError
  in rtti mode.
"

This patch also checks if stl is built with rtti.

Differential revision: https://reviews.llvm.org/D107049
2021-10-26 19:29:56 +00:00
Florian Hahn d7fbad0dcf
[Matrix] Replace some err kinds with err_builtin_invalid_arg_type. (NFC)
Replace some custom matrix diagnostic kinds with the more generic
err_builtin_invalid_arg_type introduced in D111985.

Reviewed By: aaron.ballman, erichkeane

Differential Revision: https://reviews.llvm.org/D112532
2021-10-26 20:28:16 +01:00
Alexander Belyaev a9a0ea92d1 [mlir] Update Erf approximation. 2021-10-26 21:27:20 +02:00
Valentin Clement d43f779f82
[fir][NFC] Move RewritePatterns.td to CanonicalizationPatterns.td in Dialect
RewritePatterns.td/RewritePatterns.inc is used only by the
FIROps.cpp file. This patch move this file logically in the Dialect
folder together with FIRDialet, FIROps, FIRTypes ...
It also rename it to CanonicalizationPatterns.td.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D112522
2021-10-26 21:12:54 +02:00
Michał Górny 801cf36a23 [lldb] [unittests] Fix TcpListen() call in RNBSocketTest 2021-10-26 21:08:03 +02:00
Julian Lettner c79d484ab1 [TSan] Ensure test uses tagged pointer
This is a test-only failure. The test wrongly assumes that this gets us
a tagged pointer:
```
NSObject* num1 = @7;
assert(isTaggedPtr(num1));
```

However, on newer deployment targets that have “const data support” we
get a “normal” pointer to constant object.

Radar-Id: rdar://problem/83217293
2021-10-26 11:53:02 -07:00
Alexander Belyaev 96cee29762 [mlir] Allow polynomial approximations for N-d vectors.
Polynomial approximation can be extented to support N-d vectors.
N-dimensional vectors are useful when vectorizing operations on N-dimensional
tiles. Before lowering to LLVM these vectors are usually unrolled or flattened
to 1-dimensional vectors.

Differential Revision: https://reviews.llvm.org/D112566
2021-10-26 20:50:00 +02:00
Stella Laurenzo d86688fb1f [mlir][python] Segment MLIR Python test dialect to avoid testonly dependency.
With https://reviews.llvm.org/rG14c9207063bb00823a5126131e50c93f6e288bd3, the build is broken with -DMLIR_INCLUDE_TESTS=OFF. This patch fixes the build and we may want to do a better fix to the layering in a followup.

Differential Revision: https://reviews.llvm.org/D112560
2021-10-26 18:47:36 +00:00
Fangrui Song 226465efe3 [ARC] Fix `undefined symbol: llvm::MachineFunction::dump() const` 2021-10-26 11:44:18 -07:00
Luke Petre a9db0a804a [AST] Fix the EndLoc calculation for ObjCObjectPointer
There is an issue where the AST code does not compute the correct SourceRange
for a ObjCObjectPointer.

From Richard Smith (ie @zygoloid) in discord:

I think the problem is that we set an invalid location for the * (because there
isn't one): https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaType.cpp#L1121
And then we use the default getLocalSourceRangeImpl for a PointerLikeTypeLoc
that just assumes the * location is the type's end location:
https://github.com/llvm/llvm-project/blob/main/clang/include/clang/AST/TypeLoc.h#L1293
Possibly we should be special-casing that here:
https://github.com/llvm/llvm-project/blob/main/clang/lib/AST/TypeLoc.cpp#L228

My change:

introduces a AST dump test to show the issue in the first commit
special cases ObjCObjectPointerType in the second commit to correctly compute
the end location
2021-10-26 14:03:29 -04:00
Zahira Ammarguellat e84c5419e2 Fix indentation and pragma name. 2021-10-26 13:58:43 -04:00
zhijian c2d2fb5093 address an test error on window os , exclude the test llvm/test/tools/llvm-readobj/XCOFF/xcoff-auxiliary-header.test from
windows OS.
http://45.33.8.238/win/47662/step_11.txt
for
https://reviews.llvm.org/D82549
2021-10-26 13:56:52 -04:00
Dmitry Vyukov 65e795c9ca Revert "tsan: turn off COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED"
This reverts commit 5ec832269e.

It broke a number of bots, e.g.:
https://lab.llvm.org/buildbot/#/builders/52/builds/11811

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D112563
2021-10-26 19:53:07 +02:00
Joe Loser 7ad00511e4
[libc++][NFC] Mark LWG2731 as complete
Mark LWG2731 as complete. The type alias `mutex_type` is only provided if
`scoped_lock` is given one mutex type and it has been implemented that
way since the beginning of Clang 5 it seems. There already are tests for
verifying existence (and lack thereof) for `mutex_type` type alias
depending on the number of mutex types, so there is nothing to
do for this LWG issue.

Reviewed By: Quuxplusone, Mordante, #libc

Differential Revision: https://reviews.llvm.org/D112462
2021-10-26 13:46:00 -04:00
Chia-hung Duan 2fa22488d5 [mlir] Placeholder used in predicate should be the base type
Added a notification in the placeholder section. While writing things
like preciate of an attribute, we may embed certain placeholder in the C
expression. Note that the type of the placeholder is only guaranteed to
be the base type like mlir::Type, it's better not to use the derived
type which is based on the implementation.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D112396
2021-10-26 17:36:46 +00:00
Usman Nadeem 560dd1cdad [NFC][Instcombine] Pre-commit some tests for negative fabs
Change-Id: Idcce321c825ecc6b3a111a683e24dc10015f6872
2021-10-26 10:23:39 -07:00
Alexey Bataev 8ba8cf24f7 [SLP][NFC]Add a test for logical reduction with extra op. 2021-10-26 10:14:20 -07:00
Stanislav Mekhanoshin 6860abf748 [InstCombine] Precommit new and-xor-or.ll tests. NFC. 2021-10-26 10:12:53 -07:00
Louis Dionne b2d25ef2d1 [libc++] Implement shared_ptr methods inline in the class
This patch refactors the shared_ptr methods from being defined out-of-line
to being defined inline in the class, like what we do for all new code in
the library. The benefits of doing that are that code is not as scattered
around and is hence easier to understand, and it avoids a ton of duplication
due to SFINAE checks. Defining the method where it is declared also removes
the possibility for mismatched attributes.

As a fly-by change, this also:

- Adds a few _LIBCPP_HIDE_FROM_ABI attributes
- Uses __enable_if_t instead of enable_if as a function argument, to match
  the style that we use everywhere else.

Differential Revision: https://reviews.llvm.org/D112478
2021-10-26 13:11:10 -04:00
Usman Nadeem da1318ccca [NFC][Instcombine] Cleanup some obsolete matches in visitSelectInstr
These are now redundant after https://reviews.llvm.org/D106872

Change-Id: I82edfedf1d45cac4e3368d77ce3a48c78e342c19
2021-10-26 10:07:08 -07:00
Rosie Sumpter b716d0aa94 [LoopVectorize] Clean up VPReductionRecipe::execute. NFC
Use RdxDesc->getOpcode instead of getUnderlingInstr()->getOpcode.
Move the code which finds Kind and IsOrdered to be outside the for loop
since neither of these change with the vector part.

Differential Revision: https://reviews.llvm.org/D112547
2021-10-26 17:18:25 +01:00
Balazs Benics c18407217e [analyzer] Fix StringChecker for Unknown params
It seems like protobuf crashed the `std::string` checker.
Somehow it acquired `UnknownVal` as the sole `std::string` constructor
parameter, causing a crash in the `castAs<Loc>()`.

This patch addresses this.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D112551
2021-10-26 18:15:00 +02:00
Amy Zhuang b9ae741d3e [mlir] Fix getVectorReductionOp
1.Combining kind min/max of Vector reduction op has been changed to
  minf/maxf, minsi/maxsi, and minui/maxui. Modify getVectorReductionOp
  accordingly.
2.Add min/max to supported reductions.

Reviewed By: dcaballe, nicolasvasilache

Differential Revision: https://reviews.llvm.org/D112246
2021-10-26 08:42:34 -07:00
Kazu Hirata c3e698e2f5 [CodeGen, Hexagon] Use MachineBasicBlock::phis (NFC) 2021-10-26 09:01:29 -07:00
Florian Hahn 1ef25d28c1
[Clang] Add elementwise min/max builtins.
This patch implements __builtin_elementwise_max and
__builtin_elementwise_min, as specified in D111529.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D111985
2021-10-26 16:53:40 +01:00
Sanjay Patel 4f423e9127 [x86] add test/run for mayLoadFold with alignment; NFC 2021-10-26 11:53:07 -04:00
Jez Ng 622150ad5f [lld-macho] Put GOT into `__DATA` segment where appropriate
We were previously always emitting the GOT into `__DATA_CONST`, even for
target platforms where it should end up in `__DATA`.

I stumbled onto this while trying to use the `class-dump` tool -- with
the wrong segment names, it fails to locate the ObjC runtime info and
therefore fails to dump any classes.

Reviewed By: #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D112500
2021-10-26 11:38:01 -04:00
Adam Czachorowski 2174524116 [clangd] AddUsing: Fix support for template specializations.
Before this change, we would add "using std::vector<int>" instead of
just "using std::vector;", which would not even compile.

Fixes https://github.com/clangd/clangd/issues/904

Differential Revision: https://reviews.llvm.org/D112530
2021-10-26 17:32:33 +02:00
Adam Czachorowski e8f4a01189 [clangd] Fix a hover crash on templated spaceship operator.
We make assumption that:
getDeclForComment(getDeclForComment(X)) == getDeclForComment(X)
but this is not true if you have a template
instantionation of a template instantiation, which is the case when, for
example, you have a <=> operator in a templated class.

This fix makes getDeclForComment() call itself recursively to ensure
this property is always true.

Fixes https://github.com/clangd/clangd/issues/901

Differential Revision: https://reviews.llvm.org/D112527
2021-10-26 17:28:40 +02:00
Kirill Bobyrev 03506722e0 [clang] Do not traverse EnumDecl's type in RecursiveASTVisitor
This is inconsistent with the code and comments in
RecursiveASTVisitor.h and is not a correct behavior:

https://github.com/llvm/llvm-project/blob/main/clang/include/clang/AST/RecursiveASTVisitor.h#L1879-L1880

> We shouldn't traverse D->getTypeForDecl(); it's a result of
> declaring the type, not something that was written in the source.

Fixes the failures in 1c2e249f93
2021-10-26 17:17:10 +02:00
Matt Morehouse 082d2ad015 [libFuzzer] Improve corpus replacement unit test.
Verify that SecondII is not replaced.
2021-10-26 08:09:11 -07:00
Jonas Paulsson bb506938be [SystemZ] Improvement of emitMemMemWrapper()
It was discovered that an extra register COPY remained when expanding a
(variable length) memory operation with a loop and there was another use of
the involved address register(s) afterwards.

A simple fix for this is to COPY the address registers before the loop and
use that new vreg instead.

Review: Ulrich Weigand

Differential Revision: https://reviews.llvm.org/D112065
2021-10-26 17:03:01 +02:00
Alexey Bataev ce14d1b690 [SLP]Do not reorder reduction nodes.
The final reduction nodes should not be reordered, the order does not
matter for reductions. Also, it might be profitable to vectorize smaller
reduction trees, reduction cost may compensate small tree cost.

Part of D111574

Differential Revision: https://reviews.llvm.org/D112467
2021-10-26 07:41:24 -07:00