platform/upstream/llvm.git
3 years ago[lld-macho][nfc] Remove TODO regarding addends
Jez Ng [Mon, 1 Mar 2021 17:30:08 +0000 (12:30 -0500)]
[lld-macho][nfc] Remove TODO regarding addends

There was initially some concern around the correct handling of pcrel
section relocations with r_length != 2. But it looks like there are no such
relocations in practice -- x86_64's pcrel section relocs all have r_length == 2,
and ARM64 doesn't even have pcrel section relocs. So we can replace the TODO
with an assert.

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D97576

3 years agoFix virtual-dtor warning a different way, since a virtual dtor is not required for...
David Blaikie [Mon, 1 Mar 2021 17:15:00 +0000 (09:15 -0800)]
Fix virtual-dtor warning a different way, since a virtual dtor is not required for this use case.

3 years agoFix a warning about named return value not being moved-from.
David Blaikie [Mon, 1 Mar 2021 17:14:15 +0000 (09:14 -0800)]
Fix a warning about named return value not being moved-from.

The use of an rvalue reference here was using reference lifetime
extension needlessly - the code is simpler and more efficient without
it.

3 years ago[TTI] Consider select form of and/or i1 as having arithmetic cost
Juneyoung Lee [Wed, 24 Feb 2021 07:03:51 +0000 (16:03 +0900)]
[TTI] Consider select form of and/or i1 as having arithmetic cost

This is a patch that updates the cost of `select i1 a, b, false` to be equivalent to that of `and i1 a, b`
as well as the cost of `select i1 a, true, b` equivalent to `or i1 a, b`.

Until now, these selects were folded into and/or i1 by InstCombine, but the transformation is poison-unsafe.
This is a step towards removing the unsafe transformation. D93065 has relevant transformations linked.
These selects should be translated into the assemblies as and/or i1 do in the same manner. The cost should be equivalent.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D97360

3 years ago[libc++/abi] Allow running back-deployment testing against libc++abi
Louis Dionne [Wed, 8 Jul 2020 20:38:54 +0000 (16:38 -0400)]
[libc++/abi] Allow running back-deployment testing against libc++abi

Before this patch, we could only link against the back-deployment libc++abi
dylib. This patch allows linking against the just-built libc++abi, but
running against the back-deployment one -- just like we do for libc++.

Also, add XFAIL markup to flag expected errors.

Differential Revision: https://reviews.llvm.org/D91069

3 years ago[clang] SimpleMFlag helper in Options.td
Stanislav Mekhanoshin [Fri, 19 Feb 2021 18:47:28 +0000 (10:47 -0800)]
[clang] SimpleMFlag helper in Options.td

This is the new helper to create a boolean -m and -mno-
options.

Differential Revision: https://reviews.llvm.org/D97069

3 years ago[clang-cl] make -f(no-)ident a CoreOption
Nico Weber [Mon, 1 Mar 2021 16:49:21 +0000 (11:49 -0500)]
[clang-cl] make -f(no-)ident a CoreOption

On clang emits the compiler version string into debug information
by default for both dwarf and codeview. That makes compiler output
needlessly compiler-version-dependent which makes e.g. comparing
object file outputs during a bisect hard. So it's nice if there's
an easy way to turn this off.

(On ELF, this flag also controls the .comment section, but that
part is ELF-only. The debug-info bit isn't.)

Differential Revision: https://reviews.llvm.org/D97695

3 years ago[VPlan] Remove recipes from back to front.
Florian Hahn [Mon, 1 Mar 2021 16:04:37 +0000 (16:04 +0000)]
[VPlan] Remove recipes from back to front.

Update the deletion order when destroying VPBasicBlocks. This ensures
recipes that depend on earlier ones in the block are removed first.
Otherwise this may cause issues when recipes have remaining users later
in the block.

3 years ago[WebAssembly] call_indirect issues table number relocs
Andy Wingo [Fri, 12 Feb 2021 10:22:13 +0000 (11:22 +0100)]
[WebAssembly] call_indirect issues table number relocs

If the reference-types feature is enabled, call_indirect will explicitly
reference its corresponding function table via TABLE_NUMBER
relocations against a table symbol.

Also, as before, address-taken functions can also cause the function
table to be created, only with reference-types they additionally cause a
symbol table entry to be emitted.

Differential Revision: https://reviews.llvm.org/D90948

3 years ago[TableGen] Avoid repeated TreePredicateFn::getCodeToRunOnSDNode() calls in MatcherTab...
Simon Pilgrim [Mon, 1 Mar 2021 15:38:39 +0000 (15:38 +0000)]
[TableGen] Avoid repeated TreePredicateFn::getCodeToRunOnSDNode() calls in MatcherTableEmitter::EmitNodePredicatesFunction loop. NFCI.

3 years ago[PowerPC] Removing sqrtd2 and sqrtf4 from list of vectorizable function with MASSV
Masoud Ataei [Mon, 1 Mar 2021 15:42:19 +0000 (15:42 +0000)]
[PowerPC] Removing sqrtd2 and sqrtf4 from list of vectorizable function with MASSV

Under -O3 and -Ofast, the MASSV conversion prevents the sqrt call to be inlined.
Inline sqrt is faster than MASSV call on leppc.

Differential Revision: https://reviews.llvm.org/D97487

3 years ago[lldb] [test] Skip AVX lldb-server test on non-x86 architectures
Michał Górny [Thu, 25 Feb 2021 07:44:42 +0000 (08:44 +0100)]
[lldb] [test] Skip AVX lldb-server test on non-x86 architectures

Skip the AVX-related lldb-server test on non-x86 architectures, as they
do not support AVX.  While technically the test worked on Linux because
the AVX check would simply return false, other platforms do not provide
such a straightforward way of checking for AVX (especially remotely),
and the results of such check may need to be interpreted specially
for the platform in question.

Differential Revision: https://reviews.llvm.org/D97450

3 years ago[lldb] [test] Workaround symlink-related test failures
Michał Górny [Mon, 22 Feb 2021 22:39:39 +0000 (23:39 +0100)]
[lldb] [test] Workaround symlink-related test failures

Use realpath() when spawning the executable create_after_attach
to workaround a FreeBSD plugin (and possibly others) problem.
If the executable is started via a path containing a symlink, it is
added to the module list twice -- via the real and apparent path.
This in turn cases the requested breakpoint to resolve twice.

Use realpath() for main program path in lldb-vscode breakpoint tests
to workaround a similar problem.  If the passed path does not match
the realpath, lldb-vscode does not report the breakpoints as verified
and causes tests to fail.

Since the underlying problems are non-trivial to fix and the purpose
of these tests is not to reproduce symlink problems, let's apply
trivial workarounds to make them pass.

Differential Revision: https://reviews.llvm.org/D97230

3 years ago[lldb] Rename NativeRegisterContext{Watchpoint => DBReg}_x86
Michał Górny [Mon, 22 Feb 2021 19:14:31 +0000 (20:14 +0100)]
[lldb] Rename NativeRegisterContext{Watchpoint => DBReg}_x86

Differential Revision: https://reviews.llvm.org/D97210

3 years ago[lldb] Fix handling of `DW_AT_decl_file` according to D91014
Andy Yankovsky [Tue, 16 Feb 2021 14:17:53 +0000 (15:17 +0100)]
[lldb] Fix handling of `DW_AT_decl_file` according to D91014

Apply changes from https://reviews.llvm.org/D91014 to other places where DWARF entries are being processed.

Differential Revision: https://reviews.llvm.org/D96778

3 years ago[X86] Fold shuffle(not(x),undef) -> not(shuffle(x,undef))
Simon Pilgrim [Mon, 1 Mar 2021 14:47:24 +0000 (14:47 +0000)]
[X86] Fold shuffle(not(x),undef) -> not(shuffle(x,undef))

Move NOT out to expose more AND -> ANDN folds

3 years ago[AMDGPU] New intrinsic void llvm.amdgcn.s.sethalt(i32)
Jay Foad [Mon, 1 Mar 2021 09:45:55 +0000 (09:45 +0000)]
[AMDGPU] New intrinsic void llvm.amdgcn.s.sethalt(i32)

The expected use case is for frontends to insert this into
shaders that are to be run under a debugger. The shader can
then be resumed or single stepped from the point of the call
under debugger control.

Differential Revision: https://reviews.llvm.org/D97670

3 years ago[Flang][OpenMP] Add semantic checks for OpenMP clauses.
Praveen [Sat, 30 Jan 2021 16:45:09 +0000 (22:15 +0530)]
[Flang][OpenMP] Add semantic checks for OpenMP clauses.

Semantic checks for the following OpenMP 4.5 clauses.

1. 2.15.4.2 - Copyprivate clause
2. 2.15.3.4 - Firstprivate clause
3. 2.15.3.5 - Lastprivate clause

Add related test cases and resolve test cases marked as XFAIL.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D91920

3 years ago[AMDGPU] Simplify SITargetLowering::isSDNodeSourceOfDivergence. NFC.
Jay Foad [Mon, 1 Mar 2021 10:20:54 +0000 (10:20 +0000)]
[AMDGPU] Simplify SITargetLowering::isSDNodeSourceOfDivergence. NFC.

Check for read-modify-write AtomicSDNodes instead of using an exhaustive
list of ISD opcodes.

Differential Revision: https://reviews.llvm.org/D97671

3 years agoGlobalISel: Verify G_CONCAT_VECTORS has at least 2 sources
Matt Arsenault [Sun, 28 Feb 2021 00:35:48 +0000 (19:35 -0500)]
GlobalISel: Verify G_CONCAT_VECTORS has at least 2 sources

3 years agoGlobalISel: Move splitToValueTypes to generic code
Matt Arsenault [Sun, 28 Feb 2021 16:12:08 +0000 (11:12 -0500)]
GlobalISel: Move splitToValueTypes to generic code

I copied the nearly identical function from AArch64 into AMDGPU, so
fix this duplication.

Mips and X86 have their own more exotic versions which should be
removed. However replacing those is better left for a separate patch
since it requires other changes to avoid regressions.

3 years agoAArch64/GlobalISel: Fix using wrong calling convention for calls
Matt Arsenault [Sun, 28 Feb 2021 16:28:14 +0000 (11:28 -0500)]
AArch64/GlobalISel: Fix using wrong calling convention for calls

This was reusing the parent function calling convention instead of the
callee. I'm not sure if there's a case where there's an observable
difference.

I previously missed this in b72a23650f573299aec30846fb844c3558921fb8

3 years ago[AArch64] NFC: Cleanup some SVE cost-model tests.
Sander de Smalen [Mon, 1 Mar 2021 11:51:52 +0000 (11:51 +0000)]
[AArch64] NFC: Cleanup some SVE cost-model tests.

Moved some of the `sve-getIntrinsicCost-<..>` into a single sve-intrinsics.ll
file, and simplified the tests a bit by bundling all the intrinsics in one
function (instead of testing one intrinsic per function). That makes it easier
to see the cost of the intrinsics.

3 years ago[mlir] Add convenience grouping for tensor type inference
Jacques Pienaar [Mon, 1 Mar 2021 13:21:07 +0000 (05:21 -0800)]
[mlir] Add convenience grouping for tensor type inference

For ops that produces tensor types and implement the shaped type component interface, the type inference interface can be used. Create a grouping of these together to make it easier to specify (it cannot be added into a list of traits, but must rather be appended/concated to one as it isn't a trait but a list of traits).

Differential Revision: https://reviews.llvm.org/D97636

3 years agoRevert "Use the default seed value for djb hash for StringMap"
serge-sans-paille [Mon, 1 Mar 2021 12:58:18 +0000 (13:58 +0100)]
Revert "Use the default seed value for djb hash for StringMap"

This reverts commit d84440ec919019ac446241db72cfd905c6ac9dfa.

It breaks (at least) lldb and lld validation

https://lab.llvm.org/buildbot/#/builders/68/builds/7837
https://lab.llvm.org/buildbot/#/builders/36/builds/5495

3 years ago[AArch64] Add combine for add(udot(0, x, y), z) -> udot(z, x, y).
David Green [Mon, 1 Mar 2021 12:53:34 +0000 (12:53 +0000)]
[AArch64] Add combine for add(udot(0, x, y), z) -> udot(z, x, y).

Given a zero input for a udot, an add can be folded in to take the place
of the input, using thte addition that the instruction naturally
performs.

Differential Revision: https://reviews.llvm.org/D97188

3 years ago[AArch64] Adjust dot produce tests. NFC
David Green [Mon, 1 Mar 2021 12:46:43 +0000 (12:46 +0000)]
[AArch64] Adjust dot produce tests. NFC

This regenerates and splits out the dotproduce tests, adding a few extra
tests for upcoming changes.

3 years agoUse the default seed value for djb hash for StringMap
serge-sans-paille [Wed, 24 Feb 2021 15:15:24 +0000 (16:15 +0100)]
Use the default seed value for djb hash for StringMap

See original comment in 560ce2c70fb1fe8e4b9b5e39c54e494a50373ba8
Baiscally the default seed value results in less collision, but changes the
iteration order, which matters for a few test cases.

Differential Revision: https://reviews.llvm.org/D97396

3 years ago[RISCV] Support INSERT_SUBVECTOR on vector masks
Fraser Cormack [Fri, 26 Feb 2021 14:30:14 +0000 (14:30 +0000)]
[RISCV] Support INSERT_SUBVECTOR on vector masks

Like with EXTRACT_SUBVECTOR, INSERT_SUBVECTOR poses a problem
for vector masks as RVV isn't able to slide mask types around. We choose
instead to bitcast to equivalently-sized i8 types where we can, else we
zero-extend, perform the operation, and truncate back down.

One test was left disabled due to a crash in the legalizer.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D97559

3 years ago[RISCV] Fix INSERT/EXTRACT_SUBVECTOR on fractional LMUL types
Fraser Cormack [Fri, 26 Feb 2021 14:46:23 +0000 (14:46 +0000)]
[RISCV] Fix INSERT/EXTRACT_SUBVECTOR on fractional LMUL types

This patch fixes a bug where the lowering for INSERT_SUBVECTOR and
EXTRACT_SUBVECTOR would insist on first extracting a register-aligned
LMUL1 vector type before perfoming the slide up/down. This was even if
the vector was a fractional LMUL type, in which case the aligned
EXTRACT_SUBVECTOR was invalid.

This issue only occurred for scalable vector types, but a variety of
tests for both scalable and fixed-length vectors have been added to
ensure this does not regress in the future.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D97556

3 years ago[RISCV] Unify scalable- and fixed-vector INSERT_SUBVECTOR lowering
Fraser Cormack [Fri, 26 Feb 2021 12:42:52 +0000 (12:42 +0000)]
[RISCV] Unify scalable- and fixed-vector INSERT_SUBVECTOR lowering

This patch unifies the two disparate paths for lowering INSERT_SUBVECTOR
operations under one roof. Consequently, with this patch it is possible to
support any fixed-length subvector insertion, not just "cast-like" ones.

As before, support for the insertion of mask vectors will come in a
separate patch.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D97543

3 years ago[RISCV] Support EXTRACT_SUBVECTOR on vector masks
Fraser Cormack [Thu, 25 Feb 2021 08:15:25 +0000 (08:15 +0000)]
[RISCV] Support EXTRACT_SUBVECTOR on vector masks

This patch adds support for extracting subvectors from vector masks.
This can be either extracting a scalable vector from another, or a fixed-length
vector from a fixed-length or scalable vector.

Since RVV lacks a way to slide vector masks down on an element-wise
basis and we don't know the true length of the vector registers, in many
cases we must resort to using equivalently-sized i8 vectors to perform
the operation. When this is not possible we fall back and extend to a
suitable i8 vector.

Support was also added for fixed-length truncation to mask types.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D97475

3 years ago[SEH] capture 'this'
Olivier Goffart [Wed, 24 Feb 2021 10:57:38 +0000 (11:57 +0100)]
[SEH] capture 'this'

Simply make sure that the CodeGenFunction::CXXThisValue and CXXABIThisValue
are correctly initialized to the recovered value.
For lambda capture, we also need to make sure to fill the LambdaCaptureFields

Differential Revision: https://reviews.llvm.org/D97534

3 years ago[LV] Generate RT checks up-front and remove them if required.
Florian Hahn [Mon, 1 Mar 2021 09:40:12 +0000 (09:40 +0000)]
[LV] Generate RT checks up-front and remove them if required.

This patch updates LV to generate the runtime checks just after cost
modeling, to allow a more precise estimate of the actual cost of the
checks. This information will be used in future patches to generate
larger runtime checks in cases where the checks only make up a small
fraction of the expected scalar loop execution time.

The runtime checks are created up-front in a temporary block to allow better
estimating the cost and un-linked from the existing IR. After deciding to
vectorize, the checks are moved backed. If deciding not to vectorize, the
temporary block is completely removed.

This patch is similar in spirit to D71053, but explores a different
direction: instead of delaying the decision on whether to vectorize in
the presence of runtime checks it instead optimistically creates the
runtime checks early and discards them later if decided to not
vectorize. This has the advantage that the cost-modeling decisions
can be kept together and can be done up-front and thus preserving the
general code structure. I think delaying (part) of the decision to
vectorize would also make the VPlan migration a bit harder.

One potential drawback of this patch is that we speculatively
generate IR which we might have to clean up later. However it seems like
the code required to do so is quite manageable.

Reviewed By: lebedev.ri, ebrevnov

Differential Revision: https://reviews.llvm.org/D75980

3 years ago[DAG] visitVECTOR_SHUFFLE - attempt to match commuted shuffles with MergeInnerShuffle.
Simon Pilgrim [Mon, 1 Mar 2021 10:41:57 +0000 (10:41 +0000)]
[DAG] visitVECTOR_SHUFFLE - attempt to match commuted shuffles with MergeInnerShuffle.

Try to match "shuffle(C, shuffle(A, B, M0), M1) -> shuffle(A, B, M2)" etc. by using MergeInnerShuffle's commuted inner shuffle mode.

3 years agoRevert "[flang] Detect circularly defined interfaces of procedures"
Andrzej Warzynski [Mon, 1 Mar 2021 10:18:36 +0000 (10:18 +0000)]
Revert "[flang] Detect circularly defined interfaces of procedures"

This reverts commit 07de0846a5055015b55dc2b8faa2143f9902e549.

The original patch has caused 6 out 8 of Flang's public buildbots to
fail. As I'm not sure what the fix should be, I'm reverting this for
now. Please see https://reviews.llvm.org/D97201 for more context and
discussion.

3 years ago[CodeGen] Fix issues with subvector intrinsic index types
Fraser Cormack [Thu, 25 Feb 2021 09:50:20 +0000 (09:50 +0000)]
[CodeGen] Fix issues with subvector intrinsic index types

This patch addresses issues arising from the fact that the index type
used for subvector insertion/extraction is inconsistent between the
intrinsics and SDNodes. The intrinsic forms require i64 whereas the
SDNodes use the type returned by SelectionDAG::getVectorIdxTy.

Rather than update the intrinsic definitions to use an overloaded index
type, this patch fixes the issue by transforming the index to the
correct type as required. Any loss of index bits going from i64 to a
smaller type is unexpected, and will be caught by an assertion in
SelectionDAG::getVectorIdxConstant.

The patch also updates the documentation for INSERT_SUBVECTOR and adds
an assertion to its creation to bring it in line with EXTRACT_SUBVECTOR.
This necessitated changes to AArch64 which was using i64 for
EXTRACT_SUBVECTOR but i32 for INSERT_SUBVECTOR. Only one test changed
its codegen after updating the backend accordingly.

Reviewed By: sdesmalen

Differential Revision: https://reviews.llvm.org/D97459

3 years ago[Statepoint Lowering] Consider dead deopt gc values together with other gc values
Serguei Katkov [Thu, 25 Feb 2021 09:28:50 +0000 (16:28 +0700)]
[Statepoint Lowering] Consider dead deopt gc values together with other gc values

Currently dead gc value mentioned in the deopt section are not listed in gc section
and so are processed separately.
With this CL all deopt gc values are considered as base pointers and processed in the
same way as other gc values.

The fact that deopt gc pointer is a base pointer was used all the time but
it is explicitly documented here by putting the value in SI.Base.

The idea of the patch comes from Philip Reames.

Reviewers: reames, dantrushin
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D97554

3 years ago[lldb/Interpreter] Pacify -Wnon-virtual-dtor
Benjamin Kramer [Mon, 1 Mar 2021 10:19:22 +0000 (11:19 +0100)]
[lldb/Interpreter] Pacify -Wnon-virtual-dtor

3 years ago[Driver] Don't litter the source directory in test
Benjamin Kramer [Mon, 1 Mar 2021 10:18:21 +0000 (11:18 +0100)]
[Driver] Don't litter the source directory in test

3 years ago[libc++] [docs] [C++2b] Update status page with issues (and forgotten papers) adopted...
Marek Kurdej [Mon, 1 Mar 2021 09:31:29 +0000 (10:31 +0100)]
[libc++] [docs] [C++2b] Update status page with issues (and forgotten papers) adopted in November 2020 and February 2021 virtual meetings.

Sources:
* https://github.com/cplusplus/draft/pull/4380 (November 2020)
* https://github.com/cplusplus/draft/pull/4523 (February 2021)
* https://github.com/cplusplus/draft/issues?q=is%3Aissue+LWG+Motion

3 years ago[DAG] visitVECTOR_SHUFFLE - move shuffle canonicalization/merges all under the same...
Simon Pilgrim [Mon, 1 Mar 2021 09:40:43 +0000 (09:40 +0000)]
[DAG] visitVECTOR_SHUFFLE - move shuffle canonicalization/merges all under the same legality test. NFCI.

Minor cleanup to move related combines closer together to make it more coherent, without changing the ordering.

3 years agoUse a fast path when initializing LineOffsetMapping
serge-sans-paille [Tue, 23 Feb 2021 19:46:35 +0000 (20:46 +0100)]
Use a fast path when initializing LineOffsetMapping

Use the fact that the number of line break is lower than printable characters to
guide the optimization process. Also use a fuzzy test that catches both \n and
\r in a single check to speedup the computation.

Differential Revision: https://reviews.llvm.org/D97320

3 years ago[clangd] Use flags from open files when opening headers they include
Sam McCall [Wed, 24 Feb 2021 01:43:53 +0000 (02:43 +0100)]
[clangd] Use flags from open files when opening headers they include

Currently our strategy for getting header compile flags is something like:

A) look for flags for the header in compile_commands.json
   This basically never works, build systems don't generate this info.
B) try to match to an impl file in compile_commands.json and use its flags
   This only (mostly) works if the headers are in the same project.
C) give up and use fallback flags
   This kind of works for stdlib in the default configuration, and
   otherwise doesn't.

Obviously there are big gaps here.

This patch inserts a new attempt between A and B: if the header is
transitively included by any open file (whether same project or not),
then we use its compile command.

This doesn't make any attempt to solve some related problems:
 - parsing non-self-contained header files in context (importing PP state)
 - using the compile flags of non-opened candidate files found in the index

Fixes https://github.com/clangd/clangd/issues/123
Fixes https://github.com/clangd/clangd/issues/695
See https://github.com/clangd/clangd/issues/519

Differential Revision: https://reviews.llvm.org/D97351

3 years ago[NFC] Detect IV increment expressed as uadd_with_overflow and usub_with_overflow
Max Kazantsev [Mon, 1 Mar 2021 06:22:42 +0000 (13:22 +0700)]
[NFC] Detect IV increment expressed as uadd_with_overflow and usub_with_overflow

Current callers do not call it with such argument, so this is NFC.
But for further changes, it can be very useful to detect such cases.

3 years ago[NFC] Introduce function getIVStep for further reuse
Max Kazantsev [Mon, 1 Mar 2021 06:04:17 +0000 (13:04 +0700)]
[NFC] Introduce function getIVStep for further reuse

3 years ago[NFC] Whitespace fix
Max Kazantsev [Mon, 1 Mar 2021 05:14:03 +0000 (12:14 +0700)]
[NFC] Whitespace fix

3 years ago[NFC] Factor out IV detector function for further reuse
Max Kazantsev [Mon, 1 Mar 2021 05:07:46 +0000 (12:07 +0700)]
[NFC] Factor out IV detector function for further reuse

3 years ago[profile] Delete zero-size dummy sections
Fangrui Song [Mon, 1 Mar 2021 05:07:30 +0000 (21:07 -0800)]
[profile] Delete zero-size dummy sections

They were added so that if no metadata section is present,
`__start_llvm_prf_*` references would not cause "undefined symbol"
errors.  By switching to undefined weak symbols in D96936, the dummy
sections are not needed.

This patch is also needed to work around
https://sourceware.org/bugzilla/show_bug.cgi?id=27490

Differential Revision: https://reviews.llvm.org/D97648

3 years ago[SimplifyCFG] Update FoldTwoEntryPHINode to handle and/or of select and binop equally
Juneyoung Lee [Mon, 1 Mar 2021 04:28:18 +0000 (13:28 +0900)]
[SimplifyCFG] Update FoldTwoEntryPHINode to handle and/or of select and binop equally

This is a minor change that fixes FoldTwoEntryPHINode to handle
phis with and/ors of select form and binop form equally.

3 years ago[Statepoint lowering] Require spill of deopt value in case its type is not legal
Serguei Katkov [Fri, 26 Feb 2021 10:27:03 +0000 (17:27 +0700)]
[Statepoint lowering] Require spill of deopt value in case its type is not legal

If the type of the deopt operand has an illegal type and we want to use
register for it then it needs to be legalized.
This is not supported currently by legalizer and it is not actually clear how to
legalize this type of values.

Instead we just spill such values and use spill slot location in statepoint.

Originally tests were created by Philip Reames.

Reviewers: reames, dantrushin
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D97541

3 years ago[lld][ELF] Removing redundant cast. NFC.
Sam Clegg [Mon, 1 Mar 2021 00:42:49 +0000 (16:42 -0800)]
[lld][ELF] Removing redundant cast. NFC.

Also a couple of minor cleanups in merge-string.s:
- fix inconsistent use of tabs
- use `.p2align` rather than `.align` since `.p2align` works the
  same on all platforms (the meaning of align seems to differ
  between platforms according to `AlignmentIsInBytes`.

I noticed these potential cleanups while porting SHF_STRINGS support to
wasm-ld.

Differential Revision: https://reviews.llvm.org/D97647

3 years agoAdd tests which include brace initialization
Stephen Kelly [Mon, 1 Mar 2021 00:33:03 +0000 (00:33 +0000)]
Add tests which include brace initialization

3 years ago[DAGCombiner][X86] Don't peek through ANDs on the shift amount in matchRotateSub...
Craig Topper [Sun, 28 Feb 2021 19:23:46 +0000 (11:23 -0800)]
[DAGCombiner][X86] Don't peek through ANDs on the shift amount in matchRotateSub when called from MatchFunnelPosNeg.

Peeking through AND is only valid if the input to both shifts is
the same. If the inputs are different, then the original pattern
ORs the two values when the masked shift amount is 0. This is ok
if the values are the same since the OR would be a NOP which is
why its ok for rotate.

Fixes PR49365 and reverts PR34641

Differential Revision: https://reviews.llvm.org/D97637

3 years ago[IR] Use range-based for loops (NFC)
Kazu Hirata [Sun, 28 Feb 2021 18:59:23 +0000 (10:59 -0800)]
[IR] Use range-based for loops (NFC)

3 years ago[TableGen] Use ListSeparator (NFC)
Kazu Hirata [Sun, 28 Feb 2021 18:59:21 +0000 (10:59 -0800)]
[TableGen] Use ListSeparator (NFC)

3 years ago[llvm] Use set_is_subset (NFC)
Kazu Hirata [Sun, 28 Feb 2021 18:59:20 +0000 (10:59 -0800)]
[llvm] Use set_is_subset (NFC)

3 years ago[DAGCombiner] Don't skip no overflow check on UMULO if the first computeKnownBits...
Craig Topper [Sun, 28 Feb 2021 16:20:57 +0000 (08:20 -0800)]
[DAGCombiner] Don't skip no overflow check on UMULO if the first computeKnownBits call doesn't return any 0 bits.

Even if the first computeKnownBits call doesn't have any zero
bits it is possible the other operand has bitwidth-1 leading zero.
In that case overflow is still impossible. So always call computeKnownBits
for both operands.

3 years ago[lldb/Target] Remove outdated code
Tatyana Krasnukha [Fri, 19 Feb 2021 22:21:05 +0000 (01:21 +0300)]
[lldb/Target] Remove outdated code

Arg0 callback does work.

3 years ago[lldb/Interpreter] Fix deep copying for OptionValue classes
Tatyana Krasnukha [Fri, 19 Feb 2021 21:49:42 +0000 (00:49 +0300)]
[lldb/Interpreter] Fix deep copying for OptionValue classes

Some implementations of the DeepCopy function called the copy constructor that copied m_parent member instead of setting a new parent. Others just leaved the base class's members (m_parent, m_callback, m_was_set) empty.
One more problem is that not all classes override this function, e.g. OptionValueArgs::DeepCopy produces OptionValueArray instance, and Target[Process/Thread]ValueProperty::DeepCopy produces OptionValueProperty. This makes downcasting via static_cast invalid.

The patch implements idiom "virtual constructor" to fix these issues.
Add a test that checks DeepCopy for correct copying/setting all data members of the base class.

Differential Revision: https://reviews.llvm.org/D96952

3 years ago[lldb] OptionValueProperties::Get[Set]PropertyAtIndexAsArgs should handle OptionValueArgs
Tatyana Krasnukha [Fri, 19 Feb 2021 21:33:47 +0000 (00:33 +0300)]
[lldb] OptionValueProperties::Get[Set]PropertyAtIndexAsArgs should handle OptionValueArgs

3 years ago[lldb][NFC] Make OptionValueArgs::GetArgs constant
Tatyana Krasnukha [Fri, 19 Feb 2021 21:08:18 +0000 (00:08 +0300)]
[lldb][NFC] Make OptionValueArgs::GetArgs constant

3 years ago[lldb/Interpreter][NFC] Remove explicit default initialization of members and base...
Tatyana Krasnukha [Fri, 19 Feb 2021 20:42:42 +0000 (23:42 +0300)]
[lldb/Interpreter][NFC] Remove explicit default initialization of members and base classes

According to clang-tidy's readability-redundant-member-init.

3 years ago[lldb/Interpreter][NFC] Replace default constructors/destructors bodies with "=default"
Tatyana Krasnukha [Thu, 18 Feb 2021 09:32:22 +0000 (12:32 +0300)]
[lldb/Interpreter][NFC] Replace default constructors/destructors bodies with "=default"

3 years ago[lldb/Interpreter][NFC] Remove more deleted const char* overloads
Tatyana Krasnukha [Thu, 18 Feb 2021 08:54:33 +0000 (11:54 +0300)]
[lldb/Interpreter][NFC] Remove more deleted const char* overloads

A follow-up commit to D96861.

3 years agoAMDGPU/GlobalISel: Add subtarget to a test
Matt Arsenault [Sat, 27 Feb 2021 19:41:45 +0000 (14:41 -0500)]
AMDGPU/GlobalISel: Add subtarget to a test

SelectionDAG forces us to have a weird ABI for 16-bit values without
legal 16-bit operations, but currently GlobalISel bypasses this and
sometimes ends up using the gfx8+ ABI in some contexts. Make sure
we're testing the normal ABI to avoid a test change in a future patch.

3 years ago[InstCombine] avoid infinite loop in demanded bits for select
Sanjay Patel [Sun, 28 Feb 2021 15:17:10 +0000 (10:17 -0500)]
[InstCombine] avoid infinite loop in demanded bits for select

https://llvm.org/PR49205

3 years ago[ARM] VMOVN undef folding
David Green [Sun, 28 Feb 2021 14:44:45 +0000 (14:44 +0000)]
[ARM] VMOVN undef folding

If we insert undef using a VMOVN, we can just use the original value in
three out of the four possible combinations. Using VMOVT into a undef
vector will still require the lanes to be moved, but otherwise the
non-undef value can be used.

3 years ago[lld/mac] Simplify encodeDylibOrdinal() a bit
Nico Weber [Sat, 27 Feb 2021 00:13:48 +0000 (19:13 -0500)]
[lld/mac] Simplify encodeDylibOrdinal() a bit

Only one of the two callers used the lastBinding parameter, so
do that work at that one call site. Extract a ordinalForDylibSymbol()
helper to make this tidy.

No behavior change.

Differential Revision: https://reviews.llvm.org/D97597

3 years ago[X86][AVX] Reuse existing VBROADCAST(x) for SCALAR_TO_VECTOR(x)
Simon Pilgrim [Sun, 28 Feb 2021 11:37:27 +0000 (11:37 +0000)]
[X86][AVX] Reuse existing VBROADCAST(x) for SCALAR_TO_VECTOR(x)

Similar to what we already do for BROADCASTs of different vector sizes - if we're going to broadcast it anyway might as well reuse it.

3 years ago[ARM] VECTOR_REG_CAST undef -> undef
David Green [Sun, 28 Feb 2021 11:13:49 +0000 (11:13 +0000)]
[ARM] VECTOR_REG_CAST undef -> undef

Propagate undef through VECTOR_REG_CAST nodes, allowing extra
simplification in some patterns.

3 years ago[SampleFDO] Add a cutoff flag to control how many symbols will be included
Wei Mi [Sun, 28 Feb 2021 05:44:28 +0000 (21:44 -0800)]
[SampleFDO] Add a cutoff flag to control how many symbols will be included
into profile symbol list.

When test is unrepresentative to production behavior, sample profile
collected from production can cause unexpected performance behavior
in test. To triage such issue, it is useful to have a cutoff flag
to control how many symbols will be included into profile symbol list
in order to do binary search.

Differential Revision: https://reviews.llvm.org/D97623

3 years ago[X86] Add avx512f command lines to vec_smulo and vec_umulo.
Craig Topper [Sun, 28 Feb 2021 03:48:01 +0000 (19:48 -0800)]
[X86] Add avx512f command lines to vec_smulo and vec_umulo.

3 years ago[Debug-Info][NFC] use emitDwarfUnitLength for debug line section
Chen Zheng [Sun, 28 Feb 2021 03:33:49 +0000 (22:33 -0500)]
[Debug-Info][NFC] use emitDwarfUnitLength for debug line section

Use emitDwarfUnitLength for debug line, so we can benefit from
overriding of emitDwarfUnitLength inside different streamers.

Reviewed By: ikudrin, dblaikie

Differential Revision: https://reviews.llvm.org/D95998

3 years ago[Attributor] Conditinoally delete fns
William S. Moses [Mon, 22 Feb 2021 20:38:23 +0000 (15:38 -0500)]
[Attributor] Conditinoally delete fns

Allow the attributor to delete functions only if requested

Differential Revision: https://reviews.llvm.org/D97238

3 years ago[mlir][sparse] fixed inaccury in maintaining universal index
Aart Bik [Fri, 26 Feb 2021 22:59:32 +0000 (14:59 -0800)]
[mlir][sparse] fixed inaccury in maintaining universal index

The universal index was maintained if dense indices were still
in place, and lattice points followed. However, it should only
be kept if any of those following lattice points actually
consumes the universal index. This change also fixes an
inaccuracy with a missing broadcast around vector invariant.

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D97594

3 years ago[X86] Fix a couple comments that said LHS where they meant RHS. NFC
Craig Topper [Sun, 28 Feb 2021 01:14:11 +0000 (17:14 -0800)]
[X86] Fix a couple comments that said LHS where they meant RHS. NFC

3 years agoNFC: Adds labels to a linalg test and extend a missing case.
Stella Laurenzo [Sat, 27 Feb 2021 23:59:34 +0000 (15:59 -0800)]
NFC: Adds labels to a linalg test and extend a missing case.

3 years ago[mlir][linalg] Add symbolic type conversion to linalg named ops.
Stella Laurenzo [Sat, 27 Feb 2021 02:01:15 +0000 (18:01 -0800)]
[mlir][linalg] Add symbolic type conversion to linalg named ops.

This enables this kind of construct in the DSL to generate a named op that is polymorphic over numeric type variables `T` and `U`, generating the correct arithmetic casts at construction time:

```
@tc_def_op
def polymorphic_matmul(A=TensorDef(T1, S.M, S.K),
                       B=TensorDef(T2, S.K, S.N),
                       C=TensorDef(U, S.M, S.N, output=True)):
  implements(ContractionOpInterface)
  C[D.m, D.n] += cast(U, A[D.m, D.k]) * cast(U, B[D.k, D.n])
```

Presently, this only supports type variables that are bound to the element type of one of the arguments, although a further extension that allows binding a type variable to an attribute would allow some more expressiveness and may be useful for some formulations. This is left to a future patch. In addition, this patch does not yet materialize the verifier support which ensures that types are bound correctly (for such simple examples, failing to do so will yield IR that fails verification, it just won't yet fail with a precise error).

Note that the full grid of extensions/truncation/int<->float conversions are supported, but many of them are lossy and higher level code needs to be mindful of numerics (it is not the job of this level).

As-is, this should be sufficient for most integer matmul scenarios we work with in typical quantization schemes.

Differential Revision: https://reviews.llvm.org/D97603

3 years ago[mlir][linalg] Generate additional interfaces for named ops.
Stella Laurenzo [Fri, 26 Feb 2021 21:01:03 +0000 (13:01 -0800)]
[mlir][linalg] Generate additional interfaces for named ops.

* Adds ContractionOpInterface to polymorphic_matmul.

Differential Revision: https://reviews.llvm.org/D97601

3 years ago[X86] Add back SSE check prefix for vec-umulo.ll. Regenerate vec-smulo.ll. NFC
Craig Topper [Sat, 27 Feb 2021 22:08:56 +0000 (14:08 -0800)]
[X86] Add back SSE check prefix for vec-umulo.ll. Regenerate vec-smulo.ll. NFC

Simon modified the check prefixes in these tests while D97160
was pending review. When D97160 was commited it wasn't updated
it merge cleanly, but didn't comprehend the check prefix changes.

3 years ago[lld-macho] check minimum header length when opening linkable input files
Greg McGary [Sat, 27 Feb 2021 07:28:52 +0000 (23:28 -0800)]
[lld-macho] check minimum header length when opening linkable input files

Bifurcate the `readFile()` API into ...
* `readRawFile()` which performs no checks, and
* `readLinkableFile()` which enforces minimum length of 20 bytes, same as ld64

There are no new tests because tweaks to existing tests are sufficient.

Differential Revision: https://reviews.llvm.org/D97610

3 years ago[clang-format] Fix AlignConsecutiveDeclarations handling of pointers
Darwin Xu [Sat, 27 Feb 2021 21:40:57 +0000 (22:40 +0100)]
[clang-format] Fix AlignConsecutiveDeclarations handling of pointers

This is a bug fix of https://bugs.llvm.org/show_bug.cgi?id=49175

The expected code format:

unsigned int*       a;
int*                b;
unsigned int Const* c;

The actual code after formatting (without this patch):

unsigned int* a;
int*          b;
unsigned int Const* c;

Differential Revision: https://reviews.llvm.org/D97137

3 years ago[lld-macho] Implement options -rename_section -rename_segment
Greg McGary [Fri, 26 Feb 2021 23:36:49 +0000 (15:36 -0800)]
[lld-macho] Implement options -rename_section -rename_segment

Implement command-line options to rename output sections & segments.

Differential Revision: https://reviews.llvm.org/D97600

3 years agoRevert "[clang-itdy] Simplify virtual near-miss check"
Stephen Kelly [Sat, 27 Feb 2021 19:30:38 +0000 (19:30 +0000)]
Revert "[clang-itdy] Simplify virtual near-miss check"

This reverts commit 9a4b574dd6a07d6811356529ebb8a3f15d6e40a2.

3 years agoFix Block::eraseArguments: keep track the first removed element while removing
Mehdi Amini [Sat, 27 Feb 2021 19:18:09 +0000 (19:18 +0000)]
Fix Block::eraseArguments: keep track the first removed element while removing

Not only this is likely more efficient than BitVector::find_first(), but
also if the BitVector is empty find_first() returns -1, which
llvm::drop_begin isn't robust against.

3 years agoFix Block::eraseArguments to properly update the cached positions
Mehdi Amini [Sat, 27 Feb 2021 19:04:12 +0000 (19:04 +0000)]
Fix Block::eraseArguments to properly update the cached positions

This is fixing correctness and ASAN failure post-ee90bb3486948.

3 years agoChange the error message when `-split-input-file` is used with mlir-opt to make it...
Mehdi Amini [Sat, 27 Feb 2021 18:32:21 +0000 (18:32 +0000)]
Change the error message when `-split-input-file` is used with mlir-opt to make it recognizable by IDEs

By adding the line number of the split point immediately after the file
name (separated by `:`) this is recognized by various tool as a proper
location.

Ideally we would want to point to the line of the error, but that would
require some very invasive changes I suspect.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D93363

3 years ago[NFC][AMDGPU] Document the AMDGPU target feature defaults
Tony Tye [Sat, 27 Feb 2021 00:39:29 +0000 (00:39 +0000)]
[NFC][AMDGPU] Document the AMDGPU target feature defaults

Document the default for the XNACK and SRAMECC target features for code object V2-V3 and V4.

Reviewed By: kzhuravl

Differential Revision: https://reviews.llvm.org/D97598

3 years ago[mlir] Improve test coverage for print-op-graph
Jacques Pienaar [Sat, 27 Feb 2021 18:18:38 +0000 (10:18 -0800)]
[mlir] Improve test coverage for print-op-graph

3 years ago[IR] Use range-based for loops (NFC)
Kazu Hirata [Sat, 27 Feb 2021 18:09:25 +0000 (10:09 -0800)]
[IR] Use range-based for loops (NFC)

3 years ago[llvm] Fix typos in documentation (NFC)
Kazu Hirata [Sat, 27 Feb 2021 18:09:23 +0000 (10:09 -0800)]
[llvm] Fix typos in documentation (NFC)

3 years ago[llvm-readobj] Use ListSeparator (NFC)
Kazu Hirata [Sat, 27 Feb 2021 18:09:21 +0000 (10:09 -0800)]
[llvm-readobj] Use ListSeparator (NFC)

3 years ago[lld-macho] Extract embedded addends for arm64 UNSIGNED relocations
Jez Ng [Sat, 27 Feb 2021 17:30:19 +0000 (12:30 -0500)]
[lld-macho] Extract embedded addends for arm64 UNSIGNED relocations

On arm64, UNSIGNED relocs are the only ones that use embedded addends
instead of the ADDEND relocation.

Also ensure that the addend works when UNSIGNED is part of a SUBTRACTOR
pair.

Reviewed By: #lld-macho, alexshap

Differential Revision: https://reviews.llvm.org/D97105

3 years ago[lld-macho] Add test for a variety of arm64 relocations
Jez Ng [Sat, 27 Feb 2021 17:30:17 +0000 (12:30 -0500)]
[lld-macho] Add test for a variety of arm64 relocations

Reviewed By: #lld-macho, smeenai

Differential Revision: https://reviews.llvm.org/D97104

3 years ago[lld-macho] Don't emit rebase opcodes for subtractor minuend relocs
Jez Ng [Sat, 27 Feb 2021 17:30:16 +0000 (12:30 -0500)]
[lld-macho] Don't emit rebase opcodes for subtractor minuend relocs

Also add a few asserts to verify that we are indeed handling an
UNSIGNED relocation as the minued. I haven't made it an actual
user-facing error since I don't think llvm-mc is capable of generating
SUBTRACTOR relocations without an associated UNSIGNED.

Reviewed By: #lld-macho, smeenai

Differential Revision: https://reviews.llvm.org/D97103

3 years ago[lld-macho] Properly test subtractor relocations & fix their attributes
Jez Ng [Sat, 27 Feb 2021 17:30:15 +0000 (12:30 -0500)]
[lld-macho] Properly test subtractor relocations & fix their attributes

`llvm-mc` doesn't generate any relocations for subtractions
between local symbols -- they must be global -- so the previous test
wasn't actually testing any relocation logic. I've fixed that and
extended the test to cover r_length=3 relocations as well as both x86_64
and arm64.

Reviewed By: #lld-macho, smeenai

Differential Revision: https://reviews.llvm.org/D97057

3 years agoStore (cache) the Argument number (index in the argument list) inside the BlockArgume...
Mehdi Amini [Sat, 27 Feb 2021 17:20:28 +0000 (17:20 +0000)]
Store (cache) the Argument number (index in the argument list) inside the BlockArgumentImpl

This avoids linear search in BlockArgument::getArgNumber().

Differential Revision: https://reviews.llvm.org/D97596

3 years ago[clang][Lifetimes] Fix false positive warning from BUG 49342
Gabor Horvath [Sat, 27 Feb 2021 16:08:24 +0000 (08:08 -0800)]
[clang][Lifetimes] Fix false positive warning from BUG 49342

Differential Revision: https://reviews.llvm.org/D97605

3 years ago[SimplifyCFG] avoid illegal phi with both poison and undef
Sanjay Patel [Sat, 27 Feb 2021 14:09:03 +0000 (09:09 -0500)]
[SimplifyCFG] avoid illegal phi with both poison and undef

In the example based on:
https://llvm.org/PR49218
...we are crashing because poison is a subclass of undef, so we merge blocks and create:

PHI node has multiple entries for the same basic block with different incoming values!
  %k3 = phi i64 [ poison, %entry ], [ %k3, %g ], [ undef, %entry ]

If both poison and undef values are incoming, we soften the poison values to undef.

Differential Revision: https://reviews.llvm.org/D97495