platform/upstream/llvm.git
2 years ago[clang][dataflow] Add transfer function for addrof
Stanislav Gatev [Mon, 17 Jan 2022 16:23:24 +0000 (16:23 +0000)]
[clang][dataflow] Add transfer function for addrof

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: xazax.hun
Differential Revision: https://reviews.llvm.org/D117496

2 years ago[AttrBuilder] Add string attribute getter (NFC)
Nikita Popov [Tue, 18 Jan 2022 11:12:22 +0000 (12:12 +0100)]
[AttrBuilder] Add string attribute getter (NFC)

This avoids the need to scan through td_attrs() in AutoUpgrade,
decoupling it from AttrBuilder implementation details.

2 years ago[VE] VECustomDAG builder class
Simon Moll [Tue, 18 Jan 2022 10:32:19 +0000 (11:32 +0100)]
[VE] VECustomDAG builder class

VECustomDAG's functions simplify emitting VE custom ISD nodes. The class
is just a stub now. We add more functions, in particular for the
VP->VVP->VE lowering, to VECustomDAG as we build up vector isel.

Reviewed By: kaz7

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

2 years ago[VE] vp_select+vectorBinOp passthru isel and tests
Simon Moll [Tue, 18 Jan 2022 09:29:22 +0000 (10:29 +0100)]
[VE] vp_select+vectorBinOp passthru isel and tests

Extend the VE binaryop vector isel patterns to use passthru when the
result of a SDNode is used in a vector select or merge.

Reviewed By: kaz7

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

2 years ago[LVI] Handle implication from icmp of trunc (PR51867)
Nikita Popov [Tue, 18 Jan 2022 09:54:06 +0000 (10:54 +0100)]
[LVI] Handle implication from icmp of trunc (PR51867)

Similar to the existing urem code, if we have (trunc X) >= C,
then also X >= C.

Proof: https://alive2.llvm.org/ce/z/RF4YR2

Fixes https://github.com/llvm/llvm-project/issues/51867.

2 years ago[LegalizeTypes][VP] Add widening support for vp.reduce.*
Victor Perez [Tue, 18 Jan 2022 09:30:31 +0000 (09:30 +0000)]
[LegalizeTypes][VP] Add widening support for vp.reduce.*

When widening these intrinsics, we do not have to insert neutral
elements at the end of the vector as when widening vector.reduce.*
intrinsics, thanks to vector predication semantics.

Reviewed By: craig.topper

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

2 years ago[CVP] Add tests for icmp of trunc implication (NFC)
Nikita Popov [Tue, 18 Jan 2022 10:07:48 +0000 (11:07 +0100)]
[CVP] Add tests for icmp of trunc implication (NFC)

2 years agoRevert "[DAG] Extend SearchForAndLoads with any_extend handling"
Hans Wennborg [Tue, 18 Jan 2022 09:50:55 +0000 (10:50 +0100)]
Revert "[DAG] Extend SearchForAndLoads with any_extend handling"

This caused builds to fail with

  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5638:
  bool (anonymous namespace)::DAGCombiner::BackwardsPropagateMask(llvm::SDNode *):
  Assertion `NewLoad && "Shouldn't be masking the load if it can't be narrowed"' failed.

See the code review for a link to a reproducer.

> This extends the code in SearchForAndLoads to be able to look through
> ANY_EXTEND nodes, which can be created from mismatching IR types where
> the AND node we begin from only demands the low parts of the register.
> That turns zext and sext into any_extends as only the low bits are
> demanded. To be able to look through ANY_EXTEND nodes we need to handle
> mismatching types in a few places, potentially truncating the mask to
> the size of the final load.
>
> Differential Revision: https://reviews.llvm.org/D117457

This reverts commit 578008789fd061a88ce47dac6ff627001b404348.

2 years ago[LVI] Handle commuted SPF min/max operands
Nikita Popov [Tue, 18 Jan 2022 09:42:45 +0000 (10:42 +0100)]
[LVI] Handle commuted SPF min/max operands

We need to check that the operands of the min/max are the operands
of the select, but we don't care which order they are in.

2 years ago[LVI] Compute SPF range even if one operands is overdefined
Nikita Popov [Mon, 17 Jan 2022 16:21:41 +0000 (17:21 +0100)]
[LVI] Compute SPF range even if one operands is overdefined

If we have a constant range for one operand but not the other,
we can generally still compute a useful results for SPF min/max.

2 years ago[lldb] s/dyn_cast/isa in TypeSystemClang
Pavel Labath [Tue, 18 Jan 2022 09:33:40 +0000 (10:33 +0100)]
[lldb] s/dyn_cast/isa in TypeSystemClang

2 years ago[lldb] Fix compiler warning in CommunicationTest
Pavel Labath [Tue, 18 Jan 2022 09:30:33 +0000 (10:30 +0100)]
[lldb] Fix compiler warning in CommunicationTest

"0x80 changes value when converted to char"

2 years ago[mlir][Linalg] NFC - Drop vectorization reliance on ConvolutionOpInterface
Nicolas Vasilache [Tue, 18 Jan 2022 08:54:42 +0000 (08:54 +0000)]
[mlir][Linalg] NFC - Drop vectorization reliance on ConvolutionOpInterface

Differential revision: https://reviews.llvm.org/D117323

2 years ago[LegalizeTypes][VP] Add splitting support for vp.reduction.*
Victor Perez [Mon, 17 Jan 2022 15:55:18 +0000 (15:55 +0000)]
[LegalizeTypes][VP] Add splitting support for vp.reduction.*

Split vp.reduction.* intrinsics by splitting the vector to reduce in
two halves, perform the reduction operation in each one of them and
accumulate the results of both operations.

Reviewed By: craig.topper

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

2 years ago[lldb/python] Use PythonObject in LLDBSwigPython functions
Pavel Labath [Mon, 17 Jan 2022 10:29:35 +0000 (11:29 +0100)]
[lldb/python] Use PythonObject in LLDBSwigPython functions

Return our PythonObject wrappers instead of raw PyObjects (obfuscated as
void *). This ensures that ownership (reference counts) of python
objects is automatically tracked.

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

2 years ago[mlir][Linalg] Drop deprecated convolution vectorization patterns
Nicolas Vasilache [Tue, 18 Jan 2022 08:22:50 +0000 (08:22 +0000)]
[mlir][Linalg] Drop deprecated convolution vectorization patterns

Differential revision: https://reviews.llvm.org/D117326

2 years ago[mlir] fix crash in PybindAdaptors.h
Alex Zinenko [Mon, 17 Jan 2022 13:48:28 +0000 (14:48 +0100)]
[mlir] fix crash in PybindAdaptors.h

The constructor function was being defined without indicating its "__init__"
name, which made it interpret it as a regular fuction rather than a
constructor. When overload resolution failed, Pybind would attempt to print the
arguments actually passed to the function, including "self", which is not
initialized since the constructor couldn't be called. This would result in
"__repr__" being called with "self" referencing an uninitialized MLIR C API
object, which in turn would cause undefined behavior when attempting to print
in C++.

Fix this by specifying the correct name.

This in turn uncovers the fact the the mechanism used by PybindAdaptors.h to
bind constructors directly as "__init__" functions taking "self" is deprecated
by Pybind. Instead, leverage the fact that the adaptors are intended for
attrbutes/types that cannot have additional data members and are all ultimately
instances of "PyAttribute"/"PyType" C++ class. In constructors of derived
classes, construct an instance of the base class first, then steal its internal
pointer to the C++ object to construct the instance of the derived class.

On top of that, the definition of the function was incorrectly indicated as the
method on the "None" object instead of being the method of its parent class.
This would result in a second problem when Pybind would attempt to print
warnings pointing to the parent class since the "None" does not have a
"__name__" field or its C API equivalent.

Fix this by specifying the correct parent class by looking it up by name in the
parent module.

Reviewed By: stellaraccident

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

2 years ago[clangd] Bring back early-claim approach to fix a selection-tree regression.
Haojian Wu [Mon, 17 Jan 2022 13:27:29 +0000 (14:27 +0100)]
[clangd] Bring back early-claim approach to fix a selection-tree regression.

The early-claim hack was removed in 96f5cc1ee417f863f85756d1e56b1bed1bd76a7e,
we see a regression about captured var-decl in lambda.

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

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

2 years ago[LVI] Consistently intersect assumes
Nikita Popov [Tue, 18 Jan 2022 08:51:12 +0000 (09:51 +0100)]
[LVI] Consistently intersect assumes

Integrate intersection with assumes into getBlockValue(), to ensure
that it is consistently performed.

We were doing it in nearly all places, but for example missed it
for select inputs.

2 years ago[CVP] Add test for select with assumes (NFC)
Nikita Popov [Tue, 18 Jan 2022 08:56:46 +0000 (09:56 +0100)]
[CVP] Add test for select with assumes (NFC)

The incoming values of selects are currently not intersected with
assumes.

2 years ago[Chrono] Add missing include <ratio>.
Florian Hahn [Tue, 18 Jan 2022 08:53:57 +0000 (08:53 +0000)]
[Chrono] Add missing include <ratio>.

The file uses std::ratio without including the correct header.
Previously ratio was indirectly provided through chrono in libc++ but
that's not the case any longer.

This should fix a build failure with modules enabled:
https://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/5185/console

2 years ago[DwarfDebug] Restore code that make comments stay aligned in DwarfDebug::emitDebugLoc...
Bjorn Pettersson [Sun, 16 Jan 2022 22:12:21 +0000 (23:12 +0100)]
[DwarfDebug] Restore code that make comments stay aligned in DwarfDebug::emitDebugLocEntry

Commit 2bddab25dba8d4b0 removed a piece of code from
DwarfDebug::emitDebugLocEntry that according to code comments
"Make sure comments stay aligned".

This patch restores that piece of code, together with the addition
of some extra checks in an existing lit test to work as a regression
test. Without this patch we incorrectly get
  .byte   159                             # 0
instead of
  .byte   159                             # DW_OP_stack_value

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

2 years ago[clangd] Remove redundant check for renamed symbol origin
Kirill Bobyrev [Tue, 18 Jan 2022 08:43:40 +0000 (09:43 +0100)]
[clangd] Remove redundant check for renamed symbol origin

This is a follow-up on D116643. `isInSystemHeader` check already detects
symbols coming from the Standard Library, so searching for the qualified name
in StdSymbolMap.inc is no longer necessary.

The tests filtering out purely based on the symbol qualified names are removed.

Reviewed By: hokein

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

2 years agoRevert "[CodeGen][AArch64] Ensure isSExtCheaperThanZExt returns true for negative...
David Sherwood [Tue, 18 Jan 2022 08:40:01 +0000 (08:40 +0000)]
Revert "[CodeGen][AArch64] Ensure isSExtCheaperThanZExt returns true for negative constants"

This reverts commit 197f3c0deb76951315118ef13937b67ea9cbd5aa.

Reverting after miscompilation errors discovered with ffmpeg.

2 years ago[SimplifyCFG] Fix assertion failure when reusing table switch comparison
pvellien [Tue, 18 Jan 2022 08:27:40 +0000 (09:27 +0100)]
[SimplifyCFG] Fix assertion failure when reusing table switch comparison

After D116332, some icmps no longer fold with the target-independent
constant folder. The SimplifyCFG code assumed that the comparison
would always fold, which is not guaranteed. Explicitly check that the
result is either true or false.

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

2 years ago[clang] Add include path for cppwinrt on Windows SDK 10.0.17134+
Kagami Sascha Rosylight [Tue, 18 Jan 2022 08:13:42 +0000 (09:13 +0100)]
[clang] Add include path for cppwinrt on Windows SDK 10.0.17134+

This fixes https://github.com/llvm/llvm-project/issues/53112 by adding
cppwinrt to the include path when the SDK version is higher than
10.0.17134.0.

Differential revision: https://reviews.llvm.org/D117407

2 years ago[AMDGPU] Disable optimizeEndCf at -O0
Christudasan Devadasan [Fri, 7 Jan 2022 16:52:00 +0000 (11:52 -0500)]
[AMDGPU] Disable optimizeEndCf at -O0

Reviewed By: rampitec

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

2 years ago[RISCV] Add instruction schedule for Zbc extension and Zbs extension
Lian Wang [Tue, 18 Jan 2022 07:30:26 +0000 (07:30 +0000)]
[RISCV] Add instruction schedule for Zbc extension and Zbs extension

Zbc extension:
CLMUL/CLMULR/CLMULH are grouped together, defined one schedule class.

Zbs extension:
BCLR/BSET/BINV/BEXT are grouped together, defined one schedule class.
BCLRI/BSETI/BINVI/BEXTI are grouped together, defined one schedule class.

Reviewed By: craig.topper

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

2 years ago[clang][dataflow] Replace initValueInStorageLocation with createValue
Stanislav Gatev [Mon, 17 Jan 2022 15:17:05 +0000 (15:17 +0000)]
[clang][dataflow] Replace initValueInStorageLocation with createValue

Since Environment's setValue method already does part of the work that
initValueInStorageLocation does, we can factor out a new createValue
method to reduce the duplication.

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D117493

2 years ago[AMDGPU] Autogenerate wqm.ll
Carl Ritson [Tue, 18 Jan 2022 02:47:48 +0000 (11:47 +0900)]
[AMDGPU] Autogenerate wqm.ll

Switch wqm.ll to be autogenerated.
Replace gfx6 and gfx8 targets with gfx9 (wave64) and gfx10 (wave32).

Reviewed By: kmitropoulou

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

2 years agoFix flang build after MLIR API change
Mehdi Amini [Tue, 18 Jan 2022 06:59:53 +0000 (06:59 +0000)]
Fix flang build after MLIR API change

In c8e047f5e1 the default for useDefault{Type/Attribute}PrinterParser
was changed in ODS, restore the old value explicitly for the FirDialect.

2 years ago[RISCV] Add patterns for vector widening floating-point multiply
jacquesguan [Tue, 18 Jan 2022 03:02:20 +0000 (11:02 +0800)]
[RISCV] Add patterns for vector widening floating-point multiply

Add patterns for vector widening floating-point multiply

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

2 years agoUse reference for large object passed by value at the moment in MLIR TableGen (NFC)
Mehdi Amini [Tue, 18 Jan 2022 06:47:33 +0000 (06:47 +0000)]
Use reference for large object passed by value at the moment in MLIR TableGen (NFC)

Also make the ODS Operator class have const iterator, and use const
references for existing API taking Operator by reference.

Reviewed By: rriddle

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

2 years agoUse more references in MLIR Diagnostic handling (NFC)
Mehdi Amini [Tue, 18 Jan 2022 06:23:31 +0000 (06:23 +0000)]
Use more references in MLIR Diagnostic handling (NFC)

This saves some copies of non-trivial objects, flagged by Coverity.

Reviewed By: rriddle

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

2 years ago[libcxx][libcxxabi][libunwind][cmake] Use `GNUInstallDirs` to support custom installa...
John Ericson [Sun, 16 Jan 2022 06:00:29 +0000 (06:00 +0000)]
[libcxx][libcxxabi][libunwind][cmake] Use `GNUInstallDirs` to support custom installation dirs

I am breaking apart D99484 so the cause of build failures is easier to
understand.

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

2 years agoEnable useDefault{Type/Attribute}PrinterParser by default in ODS Dialect definition
Mehdi Amini [Tue, 18 Jan 2022 06:33:21 +0000 (06:33 +0000)]
Enable useDefault{Type/Attribute}PrinterParser by default in ODS Dialect definition

The majority of dialects reimplement the same boilerplate over and over,
switching the default makes it for better discoverability and make it simpler
to implement new dialects.

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

2 years ago[ORC] Add Platform::teardownJITDylib method.
Lang Hames [Tue, 18 Jan 2022 04:58:45 +0000 (15:58 +1100)]
[ORC] Add Platform::teardownJITDylib method.

This is a counterpart to Platform::setupJITDylib, and is called when JITDylib
instances are removed (via ExecutionSession::removeJITDylib).

Upcoming MachOPlatform patches will use this to clear per-JITDylib data when
JITDylibs are removed.

2 years ago[RISCV] Provide VLOperand in td.
Han-Kuan Chen [Tue, 18 Jan 2022 04:25:23 +0000 (20:25 -0800)]
[RISCV] Provide VLOperand in td.

Currently, users expected VL is the last operand. However, since some
intrinsics has tail policy in the last operand, this rule cannot be used
anymore.

Reviewed By: craig.topper, frasercrmck

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

2 years ago[RISCV] Make SplatOperand start from 0.
Han-Kuan Chen [Tue, 18 Jan 2022 04:14:05 +0000 (20:14 -0800)]
[RISCV] Make SplatOperand start from 0.

Current SplatOperand starts from 1 because operand 0 (or 1) is intrinsic
id in SelectionDAG.

Reviewed By: craig.topper

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

2 years ago[RISCV] Add patterns for vector widening floating-point add/subtract instructions
jacquesguan [Mon, 17 Jan 2022 12:08:36 +0000 (20:08 +0800)]
[RISCV] Add patterns for vector widening floating-point add/subtract instructions

Add patterns for Vector Widening Floating-Point Add/Subtract Instructions

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

2 years ago[lld] Fix typo. NFC
Alexander Shaposhnikov [Tue, 18 Jan 2022 02:31:08 +0000 (02:31 +0000)]
[lld] Fix typo. NFC

2 years ago[ORC] Fix a stale comment: lookupInitSymbolsAsync does not build a result map.
Lang Hames [Tue, 18 Jan 2022 00:55:23 +0000 (11:55 +1100)]
[ORC] Fix a stale comment: lookupInitSymbolsAsync does not build a result map.

2 years ago[NFC][SDNode] Use `StringSwitch` instead of `if`
Shao-Ce SUN [Mon, 17 Jan 2022 04:19:26 +0000 (12:19 +0800)]
[NFC][SDNode] Use `StringSwitch` instead of `if`

Reviewed By: craig.topper

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

2 years ago[SDAG] add demanded bits transform for bswap
Sanjay Patel [Mon, 17 Jan 2022 23:23:32 +0000 (18:23 -0500)]
[SDAG] add demanded bits transform for bswap

A possible codegen regression for PowerPC is noted in D117406
because we don't recognize a pattern that demands only 1 byte
from a bswap.

This fold  has existed in IR since close to the beginning of LLVM:
https://github.com/llvm/llvm-project/blame/main/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp#L794
...so this patch copies that code as much as possible and adapts
it for SDAG.

The test for PowerPC that would change in D117406 is over-reduced
with undefs, so I recreated it for AArch64 and x86 by passing in
pointer args and renamed the values to make the logic clearer.

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

2 years agoPass options by const ref in TestLinalgCodegenStrategy (NFC)
Mehdi Amini [Mon, 17 Jan 2022 23:16:18 +0000 (23:16 +0000)]
Pass options by const ref in TestLinalgCodegenStrategy (NFC)

These aren't small object, fix Coverity report.

2 years ago[GlobalOpt] Generalize malloc-to-global for any allocation function
Philip Reames [Mon, 17 Jan 2022 23:06:23 +0000 (15:06 -0800)]
[GlobalOpt] Generalize malloc-to-global for any allocation function

We can generalize the malloc-to-global transform for other allocation functions which are both a) removable, and b) have a known initialization value.

One subtlety that I want to point out - mostly because I hadn't realized it was true until I took a closer look - is that the existing code doesn't prove that initialization/malloc happens only once. The initialization function can be called multiple times. This is correct without special handling for malloc as undef can map to any value previously written, but a non-undef initializing allocation it means we may end up memseting the new global repeatedly. In particular, this means it's not legal to fold the memset into the initializer of the global.

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

2 years ago[test] precommit new test for D117503
Philip Reames [Mon, 17 Jan 2022 22:56:49 +0000 (14:56 -0800)]
[test] precommit new test for D117503

2 years ago[RISCV] When expanding CONCAT_VECTORS, don't create INSERT_SUBVECTORS for undef subve...
Craig Topper [Mon, 17 Jan 2022 22:40:57 +0000 (14:40 -0800)]
[RISCV] When expanding CONCAT_VECTORS, don't create INSERT_SUBVECTORS for undef subvectors.

For fixed vectors, the undef will get expanded to an all zeros
build_vector. We don't want that so suppress creating the
insert_subvector.

Reviewed By: frasercrmck

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

2 years ago[RISCV] Legalize fixed length (insert_subvector undef, X, 0) to a scalable insert.
Craig Topper [Mon, 17 Jan 2022 22:31:28 +0000 (14:31 -0800)]
[RISCV] Legalize fixed length (insert_subvector undef, X, 0) to a scalable insert.

We were considering this legal, but later the undef would become an all
zeros vector. This would cause us to need to re-legalize the insert later
into a vslideup with zero vector.

This patch catches the case and directly legalizes it to a scalable
insert.

Reviewed By: frasercrmck

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

2 years ago[Libomptarget] Add `cold` to KeepAlive attributes
Joseph Huber [Mon, 17 Jan 2022 22:03:33 +0000 (17:03 -0500)]
[Libomptarget] Add `cold` to KeepAlive attributes

This patch adds the `cold` attribute to the keepAlive functions in the
RTL. This dummy function exists to keep certain RTL calls alive without
them being optimized out, but it is never called and can be declared
cold. This also helps some erroneous remarks being given on this
function because it has weak linkage and cannot be made internal.

Reviewed By: tianshilei1992

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

2 years ago[ELF] EhInputSection::split: remove unneeded check
Fangrui Song [Mon, 17 Jan 2022 21:59:51 +0000 (13:59 -0800)]
[ELF] EhInputSection::split: remove unneeded check

2 years ago[libc++] [API BREAK] Change `fs::path::iterator::iterator_category` to `input_iterato...
Arthur O'Dwyer [Sun, 2 Jan 2022 00:39:16 +0000 (19:39 -0500)]
[libc++] [API BREAK] Change `fs::path::iterator::iterator_category` to `input_iterator_tag`.

This essentially reverts e02ed1c255d71 and puts in a new fix, which makes `path::iterator`
a true C++20 `bidirectional_iterator`, but downgrades it to an `input_iterator` in C++17.

Fixes #37852.

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

2 years ago[libc++] [test] UNSUPPORTED my new uniform_int_distribution test on MinGW.
Arthur O'Dwyer [Mon, 17 Jan 2022 21:29:02 +0000 (16:29 -0500)]
[libc++] [test] UNSUPPORTED my new uniform_int_distribution test on MinGW.

After 9fe67486cc, this test fails on MinGW for some reason.
https://buildkite.com/llvm-project/libcxx-ci/builds/7922#9e267294-441d-4b79-8a19-30fdb5599c1f
All it says in the build output is

    note: command had no output on stdout or stderr
    error: command failed with exit status: 4294967295

2 years ago[gn build] Port e69a3d18f48b
LLVM GN Syncbot [Mon, 17 Jan 2022 21:32:04 +0000 (21:32 +0000)]
[gn build] Port e69a3d18f48b

2 years ago[lldb] [gdb-remote] Support client fallback for servers without reg defs
Michał Górny [Sun, 9 Jan 2022 18:35:22 +0000 (19:35 +0100)]
[lldb] [gdb-remote] Support client fallback for servers without reg defs

Provide minimal register definition defaults for working with servers
that implement neither target.xml nor qRegisterInfo packets.  This is
useful e.g. when interacting with FreeBSD's kernel minimal gdbserver
that does not send target.xml but uses the same layout for its supported
register subset as GDB.

The prerequisite for this is the ability to determine the correct
architecture, e.g. from the target executable.

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

2 years ago[PowerPC][AIX] Fallback to DAG-ISEL if global has toc-data attribute.
Sean Fertile [Mon, 17 Jan 2022 21:20:28 +0000 (16:20 -0500)]
[PowerPC][AIX] Fallback to DAG-ISEL if global has toc-data attribute.

FAST-ISEL should fall back to DAG-ISEL when a global variable has the
toc-data attribute. A number of the checks were duplicated in the lit
test becuase of
1) Slightly different output between -O0 and -O2 due to FAST-ISEL vs
   DAG-ISEL codegen.
2) In preperation of a peephole optimization that will run when
   optimizations are enabled.

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

2 years ago[AsyncToLLVM] aligned_alloc requires the size to be a multiple of aignment, so round up
Benjamin Kramer [Mon, 17 Jan 2022 20:48:00 +0000 (21:48 +0100)]
[AsyncToLLVM] aligned_alloc requires the size to be a multiple of aignment, so round up

Fixes a crash with debug malloc.

2 years ago[AArch64][x86] add tests for bswap demanded bits; NFC
Sanjay Patel [Mon, 17 Jan 2022 19:34:24 +0000 (14:34 -0500)]
[AArch64][x86] add tests for bswap demanded bits; NFC

2 years ago[LoopDeletion] Add back statistic update lost in 523573e
Philip Reames [Mon, 17 Jan 2022 20:19:44 +0000 (12:19 -0800)]
[LoopDeletion] Add back statistic update lost in 523573e

Caught by a couple of builders as an unused variable warning (e.g. https://lab.llvm.org/buildbot#builders/57/builds/13973).

2 years ago[clang-tidy] Fix false positives involving type aliases in `misc-unconventional-assig...
Fabian Wolff [Mon, 17 Jan 2022 20:10:22 +0000 (21:10 +0100)]
[clang-tidy] Fix false positives involving type aliases in `misc-unconventional-assign-operator` check

clang-tidy currently reports false positives even for simple cases such as:
```
struct S {
    using X = S;
    X &operator=(const X&) { return *this; }
};
```
This is due to the fact that the `misc-unconventional-assign-operator` check fails to look at the //canonical// types. This patch fixes this behavior.

Reviewed By: aaron.ballman, mizvekov

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

2 years ago[libc++] Install clang-tidy in docker containers
Nikolas Klauser [Mon, 17 Jan 2022 18:56:23 +0000 (19:56 +0100)]
[libc++] Install clang-tidy in docker containers

Install clang-tidy

Reviewed By: ldionne, #libc

Spies: sammccall, mgorny, libcxx-commits, arichardson

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

2 years ago[pstl][cmake] Use `GNUInstallDirs` to support custom installation dirs
John Ericson [Sun, 16 Jan 2022 06:07:13 +0000 (06:07 +0000)]
[pstl][cmake] Use `GNUInstallDirs` to support custom installation dirs

I am breaking apart D99484 so the cause of build failures is easier to
understand.

Reviewed By: ldionne, #libc

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

2 years ago[Support] Fix -Wreturn-type in LLVM_ENABLE_THREADS=OFF build after D116846
Fangrui Song [Mon, 17 Jan 2022 20:04:30 +0000 (12:04 -0800)]
[Support] Fix -Wreturn-type in LLVM_ENABLE_THREADS=OFF build after D116846

2 years ago[clang-tidy] Fix `readability-redundant-declaration` false positive for template...
Fabian Wolff [Mon, 17 Jan 2022 19:50:32 +0000 (20:50 +0100)]
[clang-tidy] Fix `readability-redundant-declaration` false positive for template friend declaration

Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=48086 | PR#48086 ]]. The problem is that the current matcher uses `hasParent()` to detect friend declarations, but for a template friend declaration, the immediate parent of the `FunctionDecl` is a `FunctionTemplateDecl`, not the `FriendDecl`. Therefore, I have replaced the matcher with `hasAncestor()`.

Reviewed By: aaron.ballman

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

2 years ago[LoopDeletion] Revert 3af8a11 and add test coverage for breakage
Philip Reames [Mon, 17 Jan 2022 19:39:19 +0000 (11:39 -0800)]
[LoopDeletion] Revert 3af8a11 and add test coverage for breakage

This reverts 3af8a11 because I'd used an upper bound where an lower bound was required.  The included reduced test case demonstrates the issue.

2 years agoRevert "[mlir][Linalg] NFC - Drop vectorization reliance on ConvolutionOpInterface"
Nicolas Vasilache [Fri, 14 Jan 2022 16:18:06 +0000 (16:18 +0000)]
Revert "[mlir][Linalg] NFC - Drop vectorization reliance on ConvolutionOpInterface"

This reverts commit c8f5735301993c363c16ce5ddda6f1f6cb968090.

The integration tests are broken.

2 years ago[libc++] Introduce __debug_db_insert_i()
Nikolas Klauser [Mon, 17 Jan 2022 18:25:21 +0000 (19:25 +0100)]
[libc++] Introduce __debug_db_insert_i()

Introduce `__debug_db_insert_i()`

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

2 years ago[libc++] [bench] Stop using uniform_int_distribution<char> in benchmarks.
Arthur O'Dwyer [Mon, 17 Jan 2022 17:06:06 +0000 (12:06 -0500)]
[libc++] [bench] Stop using uniform_int_distribution<char> in benchmarks.

Reviewed as part of D114920.

2 years ago[libc++] [doc] Fix a Sphinx error in ReleaseNotes.rst (I hope)
Arthur O'Dwyer [Mon, 17 Jan 2022 19:29:09 +0000 (14:29 -0500)]
[libc++] [doc] Fix a Sphinx error in ReleaseNotes.rst (I hope)

2 years ago[X86] Add test case for PR53247
Simon Pilgrim [Mon, 17 Jan 2022 19:02:44 +0000 (19:02 +0000)]
[X86] Add test case for PR53247

Test case from Issue #53247

2 years ago[Aarch64] Customer lowering of COPYSIGN to SIMD should check for NEON availability
Akshay Kumar [Mon, 17 Jan 2022 16:39:22 +0000 (22:09 +0530)]
[Aarch64] Customer lowering of COPYSIGN to SIMD should check for NEON availability

For the following test case, clang is crashing for ARM64 architecture
$ cat crash.c
double crash(double a, double b)
{
return __builtin_copysign(a, b);
}

$ clang -O2 -march=armv8-a+nosimd --target=arm64 -S crash.c -o /dev/null
fatal error: error in backend: Cannot select: 0x7fae361bb4e8: v2i64 = AArch64ISD::BIT 0x7fae361bb210, 0x7fae361bb278, 0x7fae361bb480
Fix: PR51806

Reviewed By: dmgreen

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

2 years ago[libc++][P2321R2] Add specializations of basic_common_reference and common_type for...
Nikolas Klauser [Mon, 17 Jan 2022 18:45:42 +0000 (19:45 +0100)]
[libc++][P2321R2] Add specializations of basic_common_reference and common_type for tuple

Add specializations of `basic_common_reference` and `common_type` for `tuple`

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

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

2 years ago[libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <vector>
Nikolas Klauser [Sat, 15 Jan 2022 19:23:29 +0000 (20:23 +0100)]
[libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <vector>

Use `_LIBCPP_DEBUG_ASSERT` in `<vector>`

Reviewed By: Quuxplusone, ldionne, Mordante, #libc

Spies: libcxx-commits

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

2 years ago[ELF] Change std::vector<InputSectionBase *> to SmallVector
Fangrui Song [Mon, 17 Jan 2022 18:25:07 +0000 (10:25 -0800)]
[ELF] Change std::vector<InputSectionBase *> to SmallVector

There is no remaining std::vector<InputSectionBase> now. My x86-64 lld
executable is 2KiB small.

2 years ago[AsyncToLLVM] Align frames to 64 bytes
Benjamin Kramer [Mon, 17 Jan 2022 17:23:44 +0000 (18:23 +0100)]
[AsyncToLLVM] Align frames to 64 bytes

Coroutine lowering always takes the natural alignment when spilling to
the frame (issue #53148) so using AVX2 or AVX512 in a coroutine doesn't
work. Always overalign to 64 bytes to avoid this issue until we have a
better solution.

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

2 years ago[mlir][Linalg] NFC - Cleanup conv1d generators
Nicolas Vasilache [Fri, 14 Jan 2022 17:18:37 +0000 (17:18 +0000)]
[mlir][Linalg] NFC - Cleanup conv1d generators

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

2 years ago[AMDGPU][GFX10][MC] Updated symbolic names of internal HW registers
Dmitry Preobrazhensky [Mon, 17 Jan 2022 17:29:10 +0000 (20:29 +0300)]
[AMDGPU][GFX10][MC] Updated symbolic names of internal HW registers

GFX10 no longer support HW_ID. It has been replaced with HW_ID1 and HW_ID2.
See bug 52904: https://github.com/llvm/llvm-project/issues/52904

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

2 years ago[AMDGPU][MC] Corrected disassembly of s_waitcnt
Dmitry Preobrazhensky [Mon, 17 Jan 2022 17:16:18 +0000 (20:16 +0300)]
[AMDGPU][MC] Corrected disassembly of s_waitcnt

s_waitcnt with default expcnt, vmcnt and lgkmcnt values was disassembled without arguments.
See https://github.com/llvm/llvm-project/issues/52716

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

2 years ago[DebugInfo] ValueMapper impl for DIArgList respects IgnoreMissingLocals
Stephen Tozer [Mon, 17 Jan 2022 11:42:35 +0000 (11:42 +0000)]
[DebugInfo] ValueMapper impl for DIArgList respects IgnoreMissingLocals

This patch fixes an issue in which SSA value reference within a
DIArgList would be unnecessarily dropped by llvm-link, even when
invoking on a single file (which should be a no-op). The reason for the
difference is that the ValueMapper does not refer to the
RF_IgnoreMissingLocals flag for LocalAsMetadata contained within a
DIArgList; this flag is used for direct LocalAsMetadata uses to preserve
SSA references even when the ValueMapper does not have an explicit
mapping for the referenced SSA value, which appears to always be the
case when using llvm-link in this manner.

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

2 years ago[AArch64] Revive optimize add/sub with immediate through MIPeepholeOpt
Micah Weston [Mon, 17 Jan 2022 17:17:15 +0000 (17:17 +0000)]
[AArch64] Revive optimize add/sub with immediate through MIPeepholeOpt

Fixes the build issue with D111034, whose goal was to optimize
add/sub with long immediates.

Optimize ([add|sub] r, imm) -> ([ADD|SUB] ([ADD|SUB] r, #imm0, lsl #12), #imm1),
if imm == (imm0<<12)+imm1. and both imm0 and imm1 are non-zero 12-bit unsigned
integers.

Optimize ([add|sub] r, imm) -> ([SUB|ADD] ([SUB|ADD] r, #imm0, lsl #12), #imm1),
if imm == -(imm0<<12)-imm1, and both imm0 and imm1 are non-zero 12-bit unsigned
integers.

The change which fixed the build issue in D111034 was the use of new virtual
registers so that SSA form is maintained until deleting MI.

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

2 years ago[test] Use opt -passes syntax in DeadArgElim lit tests. NFC
Bjorn Pettersson [Sun, 16 Jan 2022 00:18:29 +0000 (01:18 +0100)]
[test] Use opt -passes syntax in DeadArgElim lit tests. NFC

The legacy PM is deprecated, so update a bunch of lit tests running
opt to use the new PM syntax when specifying the pipeline.

2 years ago[mlir][Linalg] Relax PadTensor tiling constraints and expose it to strategies.
Nicolas Vasilache [Mon, 17 Jan 2022 17:07:46 +0000 (17:07 +0000)]
[mlir][Linalg] Relax PadTensor tiling constraints and expose it to strategies.

Reviewed By: ThomasRaoux

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

2 years ago[libc++] [test] Improve the tests for std::assignable_from.
Arthur O'Dwyer [Sun, 16 Jan 2022 17:32:33 +0000 (12:32 -0500)]
[libc++] [test] Improve the tests for std::assignable_from.

Fixes #50060.

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

2 years ago[mlir][Linalg] NFC - Drop vectorization reliance on ConvolutionOpInterface
Nicolas Vasilache [Fri, 14 Jan 2022 16:18:06 +0000 (16:18 +0000)]
[mlir][Linalg] NFC - Drop vectorization reliance on ConvolutionOpInterface

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

2 years ago[AIX] Support of Big archive (read)
zhijian [Mon, 17 Jan 2022 15:37:08 +0000 (10:37 -0500)]
[AIX] Support of Big archive (read)

Summary:

The patch is based on the EGuesnet's implement of the "Support of Big archive (read)
the first commit of the patch is come from https://reviews.llvm.org/D100651.

the rest of commits of the patch

1  Addressed the comments on the https://reviews.llvm.org/D100651
2  according to https://www.ibm.com/docs/en/aix/7.2?topic=formats-ar-file-format-big
using the "fl_fstmoff" for the first object file number, using "char ar_nxtmem[20]" to get next object file ,
using the "char fl_lstmoff[20]" for the last of the object file will fix the following problems:
   2.1 can not correct reading a archive files which has padding data between too object file
   2.2 can not correct reading a archive files from which some object file has be deleted

3 introduce a new derived class BigArchive for big ar file.

Reviewers: James Henderson
Differential Revision: https://reviews.llvm.org/D111889

2 years agoRevert "[AIX] Support of Big archive (read)"
zhijian [Mon, 17 Jan 2022 16:38:01 +0000 (11:38 -0500)]
Revert "[AIX] Support of Big archive (read)"

This reverts commit 3130134d6e4823b5ee7619288a4b7e1e60831a82.

2 years ago[AIX][ZOS] Handle unsupported builtin function CFStringMakeConstantString
Jake Egan [Mon, 17 Jan 2022 16:22:33 +0000 (11:22 -0500)]
[AIX][ZOS] Handle unsupported builtin function CFStringMakeConstantString

This patch emits an error on AIX and z/OS because XCOFF and GOFF does not currently implement builtin function `CFStringMakeConstantString`. Tests that use this builtin were also disabled.

Reviewed By: SeanP

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

2 years ago[clang-format] Treat ForEachMacros as loops
Marek Kurdej [Fri, 14 Jan 2022 20:59:40 +0000 (21:59 +0100)]
[clang-format] Treat ForEachMacros as loops

TT_ForEachMacro should be considered in rules AllowShortBlocksOnASingleLine
and AllowShortLoopsOnASingleLine.
Fixes https://github.com/llvm/llvm-project/issues/45432.

Reviewed By: MyDeveloperDay

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

2 years ago[mlir][Vector] Generalize and improve folding of ExtractOp from Insert/Transpose...
Nicolas Vasilache [Fri, 14 Jan 2022 16:08:14 +0000 (16:08 +0000)]
[mlir][Vector] Generalize and improve folding of ExtractOp from Insert/Transpose chain.

This revision fixes a bug where the iterative algorithm would walk back def-use chains to an incorrect operand.
This exposed opportunities for a larger refactoring and behavior improvement.
The new algorithm has improved folding behavior and proceeds by tracking both the
permutation of the extraction position and the internal vector permutation.
Multiple partial intersection cases with a candidate insertOp are supported.

The refactoring of the implementation should also help it generalize to strided insert/extract op.

This also subsumes the previous `foldExtractOpFromTranspose` which is now a simple special case and can be deleted.

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

2 years ago[MCA][X86] Add missing zero-idioms test file coverage
Simon Pilgrim [Mon, 17 Jan 2022 15:57:50 +0000 (15:57 +0000)]
[MCA][X86] Add missing zero-idioms test file coverage

atom/slm have no/limited zero-idioms handling but we should test all the common instructions anyhow

znver1/znver2 were just missing - I've copied the Haswell tests for consistent test coverage

2 years ago[ConstantFold] Don't fold load from non-byte-sized vector
Nikita Popov [Mon, 17 Jan 2022 15:59:23 +0000 (16:59 +0100)]
[ConstantFold] Don't fold load from non-byte-sized vector

Following up on https://github.com/llvm/llvm-project/commit/1470f94d71c544327f76b85c55cb6f7cb43a6cbb#r63981173:

The result here (probably) depends on endianness. Don't bother
trying to handle this exotic case, just bail out.

2 years ago[InstCombine] FP with reassoc FMF: (X * C) + X --> X * (MulC + 1.0)
Sanjay Patel [Mon, 17 Jan 2022 15:35:03 +0000 (10:35 -0500)]
[InstCombine] FP with reassoc FMF: (X * C) + X --> X * (MulC + 1.0)

This fold already exists for scalars via FAddCombine (and that's
why 2 of the tests are only changed cosmetically), but that code
misses vectors and has largely been replaced by simpler folds
over time, so this is another step towards removing it.

2 years ago[InstCombine] add tests for fadd+fmul factorization fold; NFC
Sanjay Patel [Mon, 17 Jan 2022 15:03:58 +0000 (10:03 -0500)]
[InstCombine] add tests for fadd+fmul factorization fold; NFC

As shown in the tests, this transform exists partially already.

2 years ago[AIX] Support of Big archive (read)
zhijian [Mon, 17 Jan 2022 15:37:08 +0000 (10:37 -0500)]
[AIX] Support of Big archive (read)

Summary:

The patch is based on the EGuesnet's implement of the "Support of Big archive (read)
the first commit of the patch is come from https://reviews.llvm.org/D100651.

the rest of commits of the patch

1  Addressed the comments on the https://reviews.llvm.org/D100651
2  according to https://www.ibm.com/docs/en/aix/7.2?topic=formats-ar-file-format-big
using the "fl_fstmoff" for the first object file number, using "char ar_nxtmem[20]" to get next object file ,
using the "char fl_lstmoff[20]" for the last of the object file will fix the following problems:
   2.1 can not correct reading a archive files which has padding data between too object file
   2.2 can not correct reading a archive files from which some object file has be deleted

3 introduce a new derived class BigArchive for big ar file.

Reviewers: James Henderson
Differential Revision: https://reviews.llvm.org/D111889

2 years ago[clang][dataflow] Remove TestingSupport's dependency on gtest
Yitzhak Mandelbaum [Fri, 14 Jan 2022 12:57:07 +0000 (12:57 +0000)]
[clang][dataflow] Remove TestingSupport's dependency on gtest

Users outside of the clang repo may use different googletest versions. So, it's
better not to depend on llvm's googletest. This patch removes the dependency by
having `checkDataflow` return an `llvm::Error` instead of calling googletest's
`FAIL` or `ASSERT...` macros.

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

2 years ago[libc++] [test] Improve the test for `uniform_int_distribution<T>`.
Arthur O'Dwyer [Thu, 2 Dec 2021 00:55:26 +0000 (19:55 -0500)]
[libc++] [test] Improve the test for `uniform_int_distribution<T>`.

Extracted from https://reviews.llvm.org/D114920

2 years ago[DAG] Extend SearchForAndLoads with any_extend handling
David Green [Mon, 17 Jan 2022 15:25:11 +0000 (15:25 +0000)]
[DAG] Extend SearchForAndLoads with any_extend handling

This extends the code in SearchForAndLoads to be able to look through
ANY_EXTEND nodes, which can be created from mismatching IR types where
the AND node we begin from only demands the low parts of the register.
That turns zext and sext into any_extends as only the low bits are
demanded. To be able to look through ANY_EXTEND nodes we need to handle
mismatching types in a few places, potentially truncating the mask to
the size of the final load.

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

2 years ago[libc++] [ABI BREAK] Conform lognormal_distribution::param_type.
Arthur O'Dwyer [Tue, 28 Dec 2021 22:51:55 +0000 (17:51 -0500)]
[libc++] [ABI BREAK] Conform lognormal_distribution::param_type.

Fixes #52906.

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

2 years ago[libc++] [test] Check for another kind of modulemap typo in lint_modulemap.sh.py.
Arthur O'Dwyer [Sun, 16 Jan 2022 19:56:42 +0000 (14:56 -0500)]
[libc++] [test] Check for another kind of modulemap typo in lint_modulemap.sh.py.

Verify that the name of the private submodule matches the name of the detail header.

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

2 years agoAMDGPU: Fix crashing on calls to C functions from graphics contexts
Matt Arsenault [Sat, 15 Jan 2022 20:12:18 +0000 (15:12 -0500)]
AMDGPU: Fix crashing on calls to C functions from graphics contexts

If we had one of the shader calling conventions calling a default
calling convention callee, this would crash when the caller did not
have anything to pass to the workitem ID.

This is illegal, but we still need to produce something
sensible. llvm-reduce likes to replace calls to intrinsics with calls
to null or undef, so this does appear and is helpful to avoid hard
erroring.

Pass undef in this case, as already happened for the other implicit
arguments. It might make sense to define the behavior here and pass
null for the pointers, and -1 for the workitem ID. We do have extra
bits in the workitem ID, so this wouldn't conflict with a valid value.