platform/upstream/llvm.git
2 years ago[IR] Track users of comdats
Nikita Popov [Thu, 16 Dec 2021 09:48:40 +0000 (10:48 +0100)]
[IR] Track users of comdats

Track all GlobalObjects that reference a given comdat, which allows
determining whether a function in a comdat is dead without scanning
the whole module.

In particular, this makes filterDeadComdatFunctions() have complexity
O(#DeadFunctions) rather than O(#SymbolsInModule), which addresses
half of the compile-time issue exposed by D115545.

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

2 years ago[clang-format] Missing space after cast in a macro
mydeveloperday [Thu, 6 Jan 2022 08:05:59 +0000 (08:05 +0000)]
[clang-format] Missing space after cast in a macro

https://github.com/llvm/llvm-project/issues/52979

Though SpaceAfterCStyleCast is set to true, clang-format 13 does not add a space after (void *) here:

```
```

This patch addresses that

Fixes: #52979

Reviewed By: curdeius, HazardyKnusperkeks, owenpan

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

2 years agoRe-apply "[JITLink] Update JITLink to use ExecutorAddr rather... " with fixes.
Lang Hames [Thu, 6 Jan 2022 05:03:06 +0000 (16:03 +1100)]
Re-apply "[JITLink] Update JITLink to use ExecutorAddr rather... " with fixes.

This re-applies 133f86e95492b2a00b944e070878424cfa73f87c, which was reverted in
c5965a411c635106a47738b8d2e24db822b7416f while I investigated bot failures.

The original failure contained an arithmetic conversion think-o (on line 419 of
EHFrameSupport.cpp) that could cause failures on 32-bit platforms. The issue
should be fixed in this patch.

2 years agoRevert "SIGSEGV in Sanitizer INTERCEPTOR of strstr function."
Vitaly Buka [Thu, 6 Jan 2022 05:25:26 +0000 (21:25 -0800)]
Revert "SIGSEGV in Sanitizer INTERCEPTOR of strstr function."

Breaks Asan on Fuchsia's and ubsan with gcc.

This reverts commit 685c94c6cbba4f2bf076b01fd3e0dcb4b1425b53.

2 years ago[AMDGPU] Iterate LoweredEndCf in the reverse order
Christudasan Devadasan [Fri, 24 Dec 2021 20:05:41 +0000 (15:05 -0500)]
[AMDGPU] Iterate LoweredEndCf in the reverse order

The function that optimally inserts the exec mask
restore operations by combining the blocks currently
visits the lowered END_CF pseudos in the forward
direction as it iterates the setvector in the order
the entries are inserted in it.

Due to the absence of BranchFolding at -O0, the
irregularly placed BBs cause the forward traversal
to incorrectly place two unconditional branches in
certain BBs while combining them, especially when
an intervening block later gets optimized away in
subsequent iterations.

It is avoided by reverse iterating the setvector.
The blocks at the bottom of a function will get
optimized first before processing those at the top.

Fixes: SWDEV-315215

Reviewed By: rampitec

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

2 years agoRevert "Remove unused variable (-Wunused)"
David Blaikie [Thu, 6 Jan 2022 04:43:30 +0000 (20:43 -0800)]
Revert "Remove unused variable (-Wunused)"

Patch that removed the use of this variable was  reverted in
8ade3d43a3e48eb739c9db2f38b618fa213f0546

This reverts commit 3988a06d86e1a14dfd5f5fdae84ddbf928e85dab.

2 years agollvm-dwarfdump: Speed up type unit lookup using the TUIndex or a cache
David Blaikie [Thu, 6 Jan 2022 04:41:07 +0000 (20:41 -0800)]
llvm-dwarfdump: Speed up type unit lookup using the TUIndex or a cache

Use the TUIndex in a DWP file if present, otherwise (in .o, .dwo, and
non-split linked executables) cache a DenseMap for lookup of type units.

2 years agollvm-dwarfdump --summarize-types: skip compilation units
David Blaikie [Thu, 6 Jan 2022 04:35:08 +0000 (20:35 -0800)]
llvm-dwarfdump --summarize-types: skip compilation units

Important for DWARFv5 debug info which might contain type units in the
debug_info section, which made summarize-types fairly ineffective/lost
amongst the noise of CUs being dumped.

2 years agoRevert "[LoopInterchange] Remove a limitation in LoopInterchange legality"
Congzhe Cao [Thu, 6 Jan 2022 04:26:03 +0000 (23:26 -0500)]
Revert "[LoopInterchange] Remove a limitation in LoopInterchange legality"

This reverts commit 15702ff9ce28b3f4aafec13be561359d4c721595 while I
investigate a ppc build bot failure at
https://lab.llvm.org/buildbot#builders/36/builds/16051.

2 years agoRemove unused variable (-Wunused)
David Blaikie [Thu, 6 Jan 2022 04:29:35 +0000 (20:29 -0800)]
Remove unused variable (-Wunused)

2 years agoDebugInfo: Rebuild varargs function types correctly
David Blaikie [Wed, 5 Jan 2022 21:25:13 +0000 (13:25 -0800)]
DebugInfo: Rebuild varargs function types correctly

Improves llvm-dwarfdump output and for simplified template names roundtripping.

2 years ago[MLIR][DataFlowAnalysis] Use a queue to maintain the worklist
Vaivaswatha Nagaraj [Wed, 5 Jan 2022 08:44:27 +0000 (14:14 +0530)]
[MLIR][DataFlowAnalysis] Use a queue to maintain the worklist

Since the analysis is described to be suitable for a forward
data-flow analysis, maintaining the worklist as a queue mimics
RPO ordering of block visits, thus reaching the fixpoint earlier.

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

2 years agoRevert "[JITLink] Update JITLink to use ExecutorAddr rather than..."
Lang Hames [Thu, 6 Jan 2022 04:18:40 +0000 (15:18 +1100)]
Revert "[JITLink] Update JITLink to use ExecutorAddr rather than..."

This reverts commit 133f86e95492b2a00b944e070878424cfa73f87c while I investigate
the bot failures at https://lab.llvm.org/buildbot#builders/186/builds/3370.

2 years ago[OpenMP][Offloading] Fixed a crash caused by dereferencing nullptr
Shilei Tian [Thu, 6 Jan 2022 04:04:17 +0000 (23:04 -0500)]
[OpenMP][Offloading] Fixed a crash caused by dereferencing nullptr

In function `DeviceTy::getTargetPointer`, `Entry` could be `nullptr` because of
zero length array section. We need to check if it is a valid iterator before
using it.

Reviewed By: ronlieb

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

2 years ago[CMake] Disable LLVM_INCLUDE_GO_TESTS by default
Fangrui Song [Thu, 6 Jan 2022 04:03:52 +0000 (20:03 -0800)]
[CMake] Disable LLVM_INCLUDE_GO_TESTS by default

llvm/test/Bindings/Go is quite flaky in the past few months and nobody fixes it.

See

* https://lists.llvm.org/pipermail/llvm-dev/2021-December/154353.html "Suggestions on debugging pre-merge test failure that looks irrelevant."
* https://github.com/llvm/llvm-project/issues/53017

Reviewed By: aeubanks

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

2 years ago[LoopInterchange] Remove a limitation in LoopInterchange legality
Congzhe Cao [Thu, 6 Jan 2022 03:17:03 +0000 (22:17 -0500)]
[LoopInterchange] Remove a limitation in LoopInterchange legality

There was a limitation in legality that in the original inner loop latch,
no instruction was allowed between the induction variable increment
and the branch instruction. This is because we used to split the
inner latch at the induction variable increment instruction. Since
now we have split at the inner latch branch instruction and have
properly duplicated instructions over to the split block, we remove
this limitation.

Please refer to the test case updates to see how we now interchange
loops where instructions exist between the induction variable increment
and the branch instruction.

Reviewed By: bmahjour

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

2 years ago[msan] Check for AVX regs using offset
Petr Hosek [Thu, 6 Jan 2022 03:24:00 +0000 (19:24 -0800)]
[msan] Check for AVX regs using offset

glibc versions < 2.26 use different names for the fields.
However the layout is unchanged, so using the offset should be a
portable way to address this issue across platforms.

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

Patch By: paulkirth

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

2 years ago[lldb] Add StringList::AppendString(const Twine&) (NFC)
Dave Lee [Wed, 5 Jan 2022 18:21:13 +0000 (10:21 -0800)]
[lldb] Add StringList::AppendString(const Twine&) (NFC)

Add a convenience for appending constructed string values.

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

2 years ago[JITLink] Update JITLink to use ExecutorAddr rather than JITTargetAddress.
Lang Hames [Wed, 5 Jan 2022 06:00:06 +0000 (17:00 +1100)]
[JITLink] Update JITLink to use ExecutorAddr rather than JITTargetAddress.

ExecutorAddr is the preferred representation for executor process addresses now.

2 years ago[ORC] Make ExecutorAddrDiff an alias for uint64_t.
Lang Hames [Mon, 3 Jan 2022 23:21:44 +0000 (10:21 +1100)]
[ORC] Make ExecutorAddrDiff an alias for uint64_t.

We don't need to restrict operations on ExecutorAddrDiff as carefully as we do
for ExecutorAddr.

2 years ago[lldb] Break out long help for 'frame var'
Dave Lee [Wed, 5 Jan 2022 22:22:33 +0000 (14:22 -0800)]
[lldb] Break out long help for 'frame var'

The current help for `frame variable` is somewhat long. Its length, combined
with the few aliases (`var`, `v`, and `vo`) can make the output of `apropos`
redundant and noisy.

This separates out the details into a separate long help.

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

2 years ago[M68k][test][NFC] Add missing tests for MxCMP_RM
Jim Lin [Thu, 6 Jan 2022 02:14:46 +0000 (10:14 +0800)]
[M68k][test][NFC] Add missing tests for MxCMP_RM

Let each format of inst have two tests for it like other MxCMP
testcases.

2 years ago[MLIR][LLVM] Add simple folders for bitcast/addrspacecast/gep
William S. Moses [Thu, 6 Jan 2022 01:34:01 +0000 (20:34 -0500)]
[MLIR][LLVM] Add simple folders for bitcast/addrspacecast/gep

Add 5 simple folders
* bitcast(x : T0, T0) -> x
* addrcast(x : T0, T0) -> x
* bitcast(bitcast(x : T0, T1), T0) -> x
* addrcast(addrcast(x : T0, T1), T0) -> x
* gep %x:T, 0 -> %x:T

Reviewed By: mehdi_amini

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

2 years ago[M68k][test][NFC] Fix no newline at end of file
Jim Lin [Thu, 6 Jan 2022 01:35:23 +0000 (09:35 +0800)]
[M68k][test][NFC] Fix no newline at end of file

2 years ago[mlir][ods] ODS ops get an `extraClassDefinition`
Mogball [Thu, 6 Jan 2022 01:42:12 +0000 (01:42 +0000)]
[mlir][ods] ODS ops get an `extraClassDefinition`

Extra definitions are placed in the generated source file for each op class. The substitution `$cppClass` is replaced by the op's C++ class name.

This is useful when declaring but not defining methods in TableGen base classes:

```
class BaseOp<string mnemonic>
    : Op<MyDialect, mnemonic, [DeclareOpInterfaceMethods<SomeInterface>] {
  let extraClassDeclaration = [{
    // ZOp is declared at at the bottom of the file and is incomplete here
    ZOp getParent();
  }];
  let extraClassDefinition = [{
    int $cppClass::someInterfaceMethod() {
      return someUtilityFunction(*this);
    }
    ZOp $cppClass::getParent() {
      return dyn_cast<ZOp>(this->getParentOp());
    }
  }];
}
```

Certain things may prevent defining these functions inline, in the declaration. In this example, `ZOp` in the same dialect is incomplete at the function declaration because ops classes are declared in alphabetical order. Alternatively, functions may be too big to be desired as inlined, or they may require dependencies that create cyclic includes, or they may be calling a templated utility function that one may not want to expose in a header. If the functions are not inlined, then inheriting from the base class N times means that each function will need to be defined N times. With `extraClassDefinitions`, they only need to be defined once.

Reviewed By: rriddle

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

2 years ago[LTO][codegen] Add TargetLibraryInfoWrapperPass initially
Craig Topper [Thu, 6 Jan 2022 00:59:40 +0000 (08:59 +0800)]
[LTO][codegen] Add TargetLibraryInfoWrapperPass initially

Many codegen pass require this pass with useful triple info. Legacy pass manager need to
add a TargetLibraryInfo with the module info before run passes. Or the TargetLibraryInfo
will be initialized too conservative.

Reviewed By: pengfei, aeubanks

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

2 years agoConsider CMAKE_{t}_LINKER_FLAGS_<CONFIG> when passing -gcodeview-ghash
Yuanfang Chen [Thu, 6 Jan 2022 01:21:46 +0000 (17:21 -0800)]
Consider CMAKE_{t}_LINKER_FLAGS_<CONFIG> when passing -gcodeview-ghash

CMake may add /Debug in the CONFIG-specific flag.

Reviewed By: rnk

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

2 years ago[OpenMP][Offloading] Fixed data race in libomptarget caused by async data movement
Shilei Tian [Thu, 6 Jan 2022 01:19:55 +0000 (20:19 -0500)]
[OpenMP][Offloading] Fixed data race in libomptarget caused by async data movement

The async data movement can cause data race if the target supports it.
Details can be found in [1]. This patch tries to fix this problem by attaching
an event to the entry of data mapping table. Here are the details.

For each issued data movement, a new event is generated and returned to `libomptarget`
by calling `createEvent`. The event will be attached to the corresponding mapping table
entry.

For each data mapping lookup, if there is no need for a data movement, the
attached event has to be inserted into the queue to gaurantee that all following
operations in the queue can only be executed if the event is fulfilled.

This design is to avoid synchronization on host side.

Note that we are using CUDA terminolofy here. Similar mechanism is assumped to
be supported by another targets. Even if the target doesn't support it, it can
be easily implemented in the following fall back way:
- `Event` can be any kind of flag that has at least two status, 0 and 1.
- `waitEvent` can directly busy loop if `Event` is still 0.

My local test shows that `bug49334.cpp` can pass.

Reference:
[1] https://bugs.llvm.org/show_bug.cgi?id=49940

Reviewed By: grokos, JonChesterfield, ye-luo

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

2 years ago[Clang] Extract availability mapping from VersionMap for watchOS/tvOS
Egor Zhdan [Tue, 4 Jan 2022 19:58:10 +0000 (19:58 +0000)]
[Clang] Extract availability mapping from VersionMap for watchOS/tvOS

This change makes it possible to extract iOS-to-another-platform version mappings from `VersionMap` in the `SDKSettings.json` file in Darwin SDKs, for example, `iOS_watchOS` and `iOS_tvOS`.

This code was originally authored by Alex Lorenz.

rdar://81491680

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

2 years ago[mlir][sparse] Strengthening first arguments of fromCOO/toCOO
wren romano [Wed, 5 Jan 2022 21:46:15 +0000 (13:46 -0800)]
[mlir][sparse] Strengthening first arguments of fromCOO/toCOO

Better capturing of invariants

Reviewed By: aartbik

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

2 years ago[mlir][sparse] Marking cursor parameters const
wren romano [Wed, 5 Jan 2022 21:13:04 +0000 (13:13 -0800)]
[mlir][sparse] Marking cursor parameters const

These parameters aren't modified, so we make that invariant explicit.

Reviewed By: aartbik

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

2 years agoIntroduce NewPM .dot printers for DomTree
Daniil Suchkov [Tue, 4 Jan 2022 02:38:56 +0000 (02:38 +0000)]
Introduce NewPM .dot printers for DomTree

This patch adds a couple of NewPM function passes (dot-dom and
dot-dom-only) that dump DomTree into .dot files.

Reviewed-By: aeubanks
Differential Revision: https://reviews.llvm.org/D116629

2 years ago[clang-tidy] Recognize transformer checks as providing fixits
Richard [Mon, 3 Jan 2022 17:16:38 +0000 (10:16 -0700)]
[clang-tidy] Recognize transformer checks as providing fixits

- Recognize older checks that might not end with Check.cpp
- Update list of checks based on improvements to add_new_check
- Fix spelling error in TransformerClangTidyCheck.h

Fixes #52962

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

2 years ago[DFSan] Add option for conditional callbacks.
Andrew Browne [Thu, 23 Dec 2021 07:54:26 +0000 (23:54 -0800)]
[DFSan] Add option for conditional callbacks.

This allows DFSan to find tainted values used to control program behavior.

Reviewed By: morehouse

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

2 years ago[lldb] Create a property to store the REPL language
Jonas Devlieghere [Wed, 5 Jan 2022 22:42:21 +0000 (14:42 -0800)]
[lldb] Create a property to store the REPL language

Until the introduction of the C++ REPL, there was always a single REPL
language. Several places relied on this assumption through
repl_languages.GetSingularLanguage. Now that this is no longer the case,
we need a way to specify a selected/preferred REPL language. This patch
does that with the help of a debugger property, taking inspiration from
how we store the scripting language.

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

2 years ago[Hexagon] Handle instruction selection for select(I1,Q,Q)
Ikhlas Ajbar [Thu, 16 Apr 2020 20:56:56 +0000 (15:56 -0500)]
[Hexagon] Handle instruction selection for select(I1,Q,Q)

Lower select(I1,Q,Q) by converting vector predicate Q to vector register V,
doing select(I1,V,V), and then converting the resulting V back to Q. Also,
try to avoid creating such situations in the first place.

2 years ago[ADCE][NFC] Batch DT updates together
Quentin Colombet [Wed, 5 Jan 2022 21:48:50 +0000 (13:48 -0800)]
[ADCE][NFC] Batch DT updates together

This patch delayed the updates of the dominator tree to the very end of
the pass instead of doing that in small increments after each basic
block.

This improves the runtime of the pass in particular in pathological
cases because now the updater sees the full extend of the updates and
can decide whether it is faster to apply the changes incrementally or
just recompute the full tree from scratch.

Put differently, thanks to this patch, we can take advantage of the
improvements that Chijun Sima <simachijun@gmail.com> made in the
dominator tree updater a while ago with commit 32fd196cbf4d: "Teach the
DominatorTree fallback to recalculation when applying updates to speedup
JT (PR37929)".

This change is NFC but can improve the runtime of the compiler
dramatically in some pathological cases (where the pass was pushing a
lot (several thousands) of small updates (less than 6)).

For instance on the motivating example we went from 300+ sec to less
than a second.

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

2 years ago[instcombine] Add test coverage for (x >>u y) pred x [part 2]
Philip Reames [Wed, 5 Jan 2022 21:37:17 +0000 (13:37 -0800)]
[instcombine] Add test coverage for (x >>u y) pred x [part 2]

2 years ago[instcombine] Add test coverage for (x >>u y) pred x
Philip Reames [Wed, 5 Jan 2022 21:30:19 +0000 (13:30 -0800)]
[instcombine] Add test coverage for (x >>u y) pred x

2 years ago[Hexagon] Replace isImmValidForOpcode() with isExtendable flag
Ikhlas Ajbar [Wed, 5 Jan 2022 21:15:14 +0000 (13:15 -0800)]
[Hexagon] Replace isImmValidForOpcode() with isExtendable flag

2 years ago[Hexagon] Handle L2_loadb[sz]w[24]_io in HII::isValidOffset
Krzysztof Parzyszek [Thu, 4 Mar 2021 18:08:11 +0000 (10:08 -0800)]
[Hexagon] Handle L2_loadb[sz]w[24]_io in HII::isValidOffset

2 years ago[Hexagon] Add missing memop instructions to HexagonInstrInfo
Sumanth Gundapaneni [Wed, 28 Oct 2020 17:06:38 +0000 (12:06 -0500)]
[Hexagon] Add missing memop instructions to HexagonInstrInfo

This patch updated HexagonInstrInfo API to deal with missing immediate
memop instructions that checks for the validity of the offset.

2 years ago[Hexagon] Update instruction info for missing .cur post-increment cases
Sumanth Gundapaneni [Fri, 12 Jul 2019 20:20:15 +0000 (15:20 -0500)]
[Hexagon] Update instruction info for missing .cur post-increment cases

2 years ago[PowerPC] Add support for ROP protection for 32 bit.
Stefan Pintilie [Tue, 4 Jan 2022 19:29:59 +0000 (13:29 -0600)]
[PowerPC] Add support for ROP protection for 32 bit.

Add support for Return Oriented Programming (ROP) protection for 32 bit.
This patch also adds a testing for AIX on both 64 and 32 bit.

Reviewed By: amyk

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

2 years agoInitialize SaveInfo in methods Output::preflightKey and Output::preflightElement.
Kevin Athey [Fri, 31 Dec 2021 00:40:00 +0000 (16:40 -0800)]
Initialize SaveInfo in methods Output::preflightKey and Output::preflightElement.

When enabling MSAN eager mode with noundef analysis these variables were found to not be initialized in unit tests.

Reviewed By: vitalybuka

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

2 years ago[clang] Fall back on Android triple w/o API level for runtimes search
Collin Baker [Wed, 5 Jan 2022 20:58:53 +0000 (15:58 -0500)]
[clang] Fall back on Android triple w/o API level for runtimes search

Clang searches for runtimes (e.g. libclang_rt*) first in a
subdirectory named for the target triple (corresponding to
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON), then if it's not found uses
.../lib/<os>/libclang_rt* with a suffix corresponding to the arch and
environment name.

Android triples optionally include an API level indicating the minimum
Android version to be run on
(e.g. aarch64-unknown-linux-android21). When compiler-rt is built with
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON this API level is part of the
output path.

Linking code built for a later API level against a runtime built for
an earlier one is safe. In projects with several API level targets
this is desireable to avoid re-building the same runtimes many
times. This is difficult with the current runtime search method: if
the API levels don't exactly match Clang gives up on the per-target
runtime directory path.

To enable this more simply, this change tries target triple without
the API level before falling back on the old layout.

Another option would be to try every API level in the triple,
e.g. check aarch-64-unknown-linux-android21, then ...20, then ...19,
etc.

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

2 years ago[mlir] Symbol DCE ignores unknown symbols
Mogball [Mon, 20 Dec 2021 16:48:00 +0000 (16:48 +0000)]
[mlir] Symbol DCE ignores unknown symbols

Instead of failing when it encounters a reference to an unknown symbol, Symbol DCE should ignore them. References to unknown symbols do not affect the overall function of Symbol DCE, so it should not need to fail when it encounters one.

In general, requiring that symbol references always be valid rather than only when necessary can be overly conservative.

Reviewed By: rriddle

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

2 years ago[SLP][NFC]Improved isAltShuffle by comparing instructions instead of
Alexey Bataev [Wed, 5 Jan 2022 20:30:13 +0000 (12:30 -0800)]
[SLP][NFC]Improved isAltShuffle by comparing instructions instead of
opcodes, NFC.

NFC part of D115955.

2 years ago[gn build] Port 68ac7b17016e
LLVM GN Syncbot [Wed, 5 Jan 2022 20:03:02 +0000 (20:03 +0000)]
[gn build] Port 68ac7b17016e

2 years ago[AArch64] Rename CPY to DUP. NFC
David Green [Wed, 5 Jan 2022 20:02:39 +0000 (20:02 +0000)]
[AArch64] Rename CPY to DUP. NFC

These instructions have nothing to do with the new MOP CPY instructions,
and are better named DUP to avoid confusion.

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

2 years ago[NFC][SimplifyCFG] Extract `performBlockTailMerging()` out of `tailMergeBlocksWithSim...
Roman Lebedev [Wed, 5 Jan 2022 19:58:35 +0000 (22:58 +0300)]
[NFC][SimplifyCFG] Extract `performBlockTailMerging()` out of `tailMergeBlocksWithSimilarFunctionTerminators()`

2 years agoPrecommit test for D116683
Philip Reames [Wed, 5 Jan 2022 19:53:08 +0000 (11:53 -0800)]
Precommit test for D116683

2 years ago[NFC][mlgo] Add feature declarations for the ML regalloc advisor
Mircea Trofin [Tue, 21 Dec 2021 04:50:55 +0000 (20:50 -0800)]
[NFC][mlgo] Add feature declarations for the ML regalloc advisor

This just adds feature declarations and some boilerplate.

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

2 years ago[CMake] Move the AIX archiver settings to a module
Petr Hosek [Tue, 7 Dec 2021 19:53:38 +0000 (11:53 -0800)]
[CMake] Move the AIX archiver settings to a module

This allows their reuse across projects. The name of the module
is intentionally generic because we would like to move more platform
checks there.

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

2 years ago[CodeGen] Initialize MaxBytesForAlignment in TargetLoweringBase::TargetLoweringBase.
David Green [Wed, 5 Jan 2022 19:34:27 +0000 (19:34 +0000)]
[CodeGen] Initialize MaxBytesForAlignment in TargetLoweringBase::TargetLoweringBase.

This appears to be missing from D114590, causing sanitizer errors.

2 years agoAdd test case from 356ada9
Philip Reames [Wed, 5 Jan 2022 19:16:03 +0000 (11:16 -0800)]
Add test case from 356ada9

2 years ago[llvm] Add support for DW_TAG_immutable_type
Luís Ferreira [Wed, 5 Jan 2022 18:48:41 +0000 (18:48 +0000)]
[llvm] Add support for DW_TAG_immutable_type

Added documentation about DW_TAG_immutable_type too.

Reviewed By: probinson

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

2 years agoFix accidental usage of cast<> instead of dyn_cast<> in 58a0e44
Philip Reames [Wed, 5 Jan 2022 19:00:01 +0000 (11:00 -0800)]
Fix accidental usage of cast<> instead of dyn_cast<> in 58a0e44

2 years ago[lld/tests] Stop setting the "asserts" and "debug" features
Nico Weber [Fri, 17 Dec 2021 15:04:30 +0000 (10:04 -0500)]
[lld/tests] Stop setting the "asserts" and "debug" features

The last use of `REQUIRES: debug` was removed in 2013 in 72c5d3d7c in favor of
`REQUIRES: asserts`.

The last use of `REQUIRES: asserts` was removed in 2015 in 251b0e268 when the
old COFF linker was removed.

lld's test suite currently has no behavior difference with respect to
assertions or debug builds (and hasn't had it for 6 years). Let's keep it that
way :)

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

2 years ago[instcombine] Allow sinking of calls with known writes to uses
Philip Reames [Wed, 5 Jan 2022 16:53:33 +0000 (08:53 -0800)]
[instcombine] Allow sinking of calls with known writes to uses

If we have a call whose only side effect is a write to a location which is known to be dead, we can sink said call to the users of the call's result value. This is analogous to the recent changes to delete said calls if unused, but framed as a sinking transform instead.

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

2 years agogithub: Add action for automated issue notification
Tom Stellard [Wed, 5 Jan 2022 18:30:30 +0000 (10:30 -0800)]
github: Add action for automated issue notification

This adds a github action that will mention a team called issue-subscribers-$LABEL
whenever a label is added to a bug.  Mentioning the team will automatically
subscribe all team members to the bug.

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

2 years ago[ELF] Demote all lazy symbols. NFC
Fangrui Song [Wed, 5 Jan 2022 18:24:29 +0000 (10:24 -0800)]
[ELF] Demote all lazy symbols. NFC

This complements D111365.

D111365 did not demote isUsedInRegularObj lazy symbols just to work around
a --symbol-ordering-file diagnostic quirk.

The quirk was dropped by 00dd2d15a40b0fe9916bb55a48f264498d8fe910,
so we can demote all lazy symbols now, not just the isUsedInRegularObj ones.

2 years agoRevert "Revert D109159 "[amdgpu] Enable selection of `s_cselect_b64`.""
Nico Weber [Wed, 5 Jan 2022 18:09:25 +0000 (13:09 -0500)]
Revert "Revert D109159 "[amdgpu] Enable selection of `s_cselect_b64`.""

This reverts commit 859ebca744e634dcc89a2294ffa41574f947bd62.
The change contained many unrelated changes and e.g. restored
unit test failes for the old lld port.

2 years ago[MLIR] Add clearAndCopyFrom to IntegerPolyhedron
Groverkss [Wed, 5 Jan 2022 17:49:36 +0000 (23:19 +0530)]
[MLIR] Add clearAndCopyFrom to IntegerPolyhedron

This patch adds clearAndCopyFrom to IntegerPolyhedron. This requires moving
LLVM-style RTTI from FlatAffineConstraints to IntegerPolyhedron.

This patch is part of a series of patches to move presburger math to Presburger
directory.

Reviewed By: arjunp

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

2 years ago[InstCombine] remove trunc user restriction for match of bswap
Sanjay Patel [Wed, 5 Jan 2022 16:53:59 +0000 (11:53 -0500)]
[InstCombine] remove trunc user restriction for match of bswap

This does not appear to cause any problems, and it
fixes #50910

Extra tests with a trunc user were added with:
3a239379
...but they don't match either way, so there's an
opportunity to improve the matching further.

2 years ago[mlir] Align LLVM_Type ODS constraint on type verifiers
Alex Zinenko [Wed, 5 Jan 2022 17:38:10 +0000 (18:38 +0100)]
[mlir] Align LLVM_Type ODS constraint on type verifiers

Verify only the outer type being LLVM-compatible, the elemental types if
present are already checked by the type verifiers. This makes some LLVM dialect
operations compatible with mixed-dialect types that appear during progressive
lowering.

Reviewed By: wsmoses

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

2 years agoRevert D109159 "[amdgpu] Enable selection of `s_cselect_b64`."
David Salinas [Thu, 23 Dec 2021 17:32:31 +0000 (17:32 +0000)]
Revert D109159 "[amdgpu] Enable selection of `s_cselect_b64`."

This reverts commit 640beb38e7710b939b3cfb3f4c54accc694b1d30.

That commit caused performance degradtion in Quicksilver test QS:sGPU and a functional test failure in (rocPRIM rocprim.device_segmented_radix_sort).
Reverting until we have a better solution to s_cselect_b64 codegen cleanup

Change-Id: Ibf8e397df94001f248fba609f072088a46abae08

Reviewed By: kzhuravl

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

Change-Id: Id169459ce4dfffa857d5645a0af50b0063ce1105

2 years ago[gn build] "port" 027ffb173a68
Nico Weber [Wed, 5 Jan 2022 17:57:10 +0000 (12:57 -0500)]
[gn build] "port" 027ffb173a68

2 years ago[MLIR] Simplex::normalizeRow: early exit when gcd is one
Arjun P [Wed, 5 Jan 2022 17:51:45 +0000 (23:21 +0530)]
[MLIR] Simplex::normalizeRow: early exit when gcd is one

Reviewed By: bondhugula

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

2 years ago[mlir] Fix a compiler warning
Kazu Hirata [Wed, 5 Jan 2022 17:42:03 +0000 (09:42 -0800)]
[mlir] Fix a compiler warning

This patch fixes:

  mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp:635:23:
  error: comparison of integers of different signs: 'int' and 'size_t'
  (aka 'unsigned long') [-Werror,-Wsign-compare]

2 years agoAdd codegen for allocate directive's 'align' clause
David Pagan [Wed, 5 Jan 2022 17:40:58 +0000 (12:40 -0500)]
Add codegen for allocate directive's 'align' clause

2 years ago[ASan] Moved optimized callbacks into a separate library.
Kirill Stoimenov [Wed, 5 Jan 2022 17:14:40 +0000 (17:14 +0000)]
[ASan] Moved optimized callbacks into a separate library.

This will allow linking in the callbacks directly instead of using PLT.

Reviewed By: vitalybuka

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

2 years ago[AMDGPU] Regenerate test checks in collapse-endcf.mir. NFC
Christudasan Devadasan [Wed, 5 Jan 2022 16:41:51 +0000 (11:41 -0500)]
[AMDGPU] Regenerate test checks in collapse-endcf.mir. NFC

2 years ago[LegalizeTypes] Remove IsVP argument from type legalization methods. NFC
Craig Topper [Wed, 5 Jan 2022 16:52:53 +0000 (08:52 -0800)]
[LegalizeTypes] Remove IsVP argument from type legalization methods. NFC

We can either check the opcode or number of operands or use
ISD::isVPOpcode inside the methods.

In some places I've used number of operands figuring that it is
cheaper than isVPOpcode. I've included isVPOpcode in an assert to
verify.

Reviewed By: frasercrmck

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

2 years ago[RISCV] Use macros to reduce repetive switch cases. NFC
Craig Topper [Wed, 5 Jan 2022 16:52:41 +0000 (08:52 -0800)]
[RISCV] Use macros to reduce repetive switch cases. NFC

These 3 switches map LMUL enum to instruction names. These follow
a regular pattern. Use a macro to reduce the number of source code
lines.

Reviewed By: arcbbb

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

2 years ago[clang][#52782] Bail on incomplete parameter type in stdcall name mangling
Markus Böck [Fri, 24 Dec 2021 20:55:07 +0000 (21:55 +0100)]
[clang][#52782] Bail on incomplete parameter type in stdcall name mangling

stdcall name mangling requires a suffix with the number equal to the sum of the byte count of all parameter types. In the case of a function prototype that has a parameter type of an incomplete type it is impossible to get the size of the type. While such a function is not callable or able to be defined in the TU, it may still be mangled when generating debug info, which would previously lead to a crash.
This patch fixes that by simply bailing out of the loop and using the so far accumulated byte count. This matches GCCs behaviour as well: https://github.com/gcc-mirror/gcc/blob/bc8d6c60137f8bbf173b86ddf31b15d7ba2a33dd/gcc/config/i386/winnt.c#L203

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

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

2 years agoRename doesNotReadMemory to onlyWritesMemory globally [NFC]
Philip Reames [Wed, 5 Jan 2022 16:20:53 +0000 (08:20 -0800)]
Rename doesNotReadMemory to onlyWritesMemory globally [NFC]

The naming has come up as a source of confusion in several recent reviews.  onlyWritesMemory is consist with onlyReadsMemory which we use for the corresponding readonly case as well.

2 years ago[lld-link] Consistently print all /verbose output to stderr
Nico Weber [Wed, 5 Jan 2022 16:24:44 +0000 (11:24 -0500)]
[lld-link] Consistently print all /verbose output to stderr

lld-link used to consistently print all /verbose output to stdout, and that was
an intentional decision: https://reviews.llvm.org/rG4bce7bcc88f3

https://reviews.llvm.org/rGe6e206d4b4814 added message() and log(),
and back then `log()` morally was just `if (verbose) message(...)`
and message() wrote to stdout.

So that change moved most /verbose-induced writes to outs() to
log(). Except for the one in printDiscardedMessage(), since
the check for `verbose` for that one is in the caller, in
Writer::createSections():

    if (config->verbose)
      sc->printDiscardedMessage();

Later, https://reviews.llvm.org/D41033 changed log() to write to
stderr. That moved lld-link from writing all its /verbose output
to stdout to writing almost all of its /verbose output to stderr --
except for printDiscardedMessage() output.

This change moves printDiscardedMessage() to call log() as well,
so that all /verbose output once again consistently goes to the same
stream.

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

2 years ago[Hexagon] Extend OptAddrMode pass to vgather
Shubham Pawar [Wed, 19 Jun 2019 16:38:06 +0000 (11:38 -0500)]
[Hexagon] Extend OptAddrMode pass to vgather

This change extends the addressing mode optimization
pass to HVX vgather. This is specifically intended to
resolve compiler not generating indexed addresses for
vgather stores to vtcm. Changed the vgather pseudo
instructions to accept an immediate operand and handled
addition of appropriate immediate operand in addressing
mode optimization pass.

2 years ago[libc++][format] Improve an exception message.
Mark de Wever [Sun, 2 Jan 2022 16:03:58 +0000 (17:03 +0100)]
[libc++][format] Improve an exception message.

The fix in D116381 makes an existing exception message wrong. This
improves the message and fixes the associated unit tests.

Note other message can be also be improved, but that will be done later.
Changing these messages may cause merge conflicts with other patches
that are under review or WIP.

Depends on D116381

Reviewed By: #libc, Quuxplusone, ldionne

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

2 years ago[libc++][format] Fix precision parser conformance.
Mark de Wever [Wed, 29 Dec 2021 18:50:38 +0000 (19:50 +0100)]
[libc++][format] Fix precision parser conformance.

@CaseyCarter reported that the tests for the std-format-spec rejects leading
zeroes for precision, which the Standard does not require. The Standard allows
them. Only for precision, not for the width or an arg-id.

Fixes the precision parser and adds some test for the arg-id since they
were missing.

Reviewed By: ldionne, #libc

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

2 years ago[mlir] Fix for 9a7d111f4fb65ad7343dcbd4f35ee608100634e8
Nicolas Vasilache [Wed, 5 Jan 2022 16:40:46 +0000 (11:40 -0500)]
[mlir] Fix for 9a7d111f4fb65ad7343dcbd4f35ee608100634e8

2 years ago[clang-format][NFC] Fix typo in comment
Jino Park [Wed, 5 Jan 2022 16:30:26 +0000 (17:30 +0100)]
[clang-format][NFC] Fix typo in comment

Fix typo (leftt -> left)

Reviewed By: curdeius

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

2 years ago[mlir][Linalg] NFC - Modernize transformation APIs.
Nicolas Vasilache [Wed, 5 Jan 2022 15:51:42 +0000 (10:51 -0500)]
[mlir][Linalg] NFC - Modernize transformation APIs.

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

2 years ago[Hexagon] Add setting hvx-qfloat in HexagonMCSubtargetInfo
Joshua Herrera [Tue, 28 Dec 2021 19:21:47 +0000 (11:21 -0800)]
[Hexagon] Add setting hvx-qfloat in HexagonMCSubtargetInfo

2 years ago[clangd] Don't index __reserved_names in headers.
Sam McCall [Tue, 7 Dec 2021 23:52:15 +0000 (00:52 +0100)]
[clangd] Don't index __reserved_names in headers.

Main use of these is in the standard library, where they generally clutter up
the index.

Certain macros are also common, we don't touch indexing of macros in this patch.

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

2 years ago[mlir][linalg][bufferize][NFC] Simplify bufferization of CallOps
Matthias Springer [Wed, 5 Jan 2022 15:22:38 +0000 (00:22 +0900)]
[mlir][linalg][bufferize][NFC] Simplify bufferization of CallOps

There is no need to inspect the ReturnOp of the called function.

This change also refactors the bufferization of CallOps in such a way that `lookupBuffer` is called only a single time. This is important for a later change that fixes CallOp bufferization. (There is currently a TODO among the test cases.)

Note: This change modifies a test case but is marked as NFC. There is no change of functionality, but FuncOps with empty bodies are now reported with a different error message.

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

2 years ago[mlir] Introduce Python bindings for the quantization dialect
Alex Zinenko [Tue, 4 Jan 2022 16:43:44 +0000 (17:43 +0100)]
[mlir] Introduce Python bindings for the quantization dialect

So far, only the custom dialect types are exposed.

The build and packaging is same as for Linalg and SparseTensor, and in
need of refactoring that is beyond the scope of this patch.

Reviewed By: stellaraccident

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

2 years ago[AIX][z/OS][Support] Provide alternate no-op mapped_file_region::dontNeedImpl impleme...
David Tenty [Tue, 4 Jan 2022 16:42:18 +0000 (10:42 -0600)]
[AIX][z/OS][Support] Provide alternate no-op mapped_file_region::dontNeedImpl implementation

mapped_file_region::dontNeedImpl added in D116366 calls madvise, which
causes problems for z/OS and AIX.

For z/OS, we don't have either madvise, so treat this as a no-op, same
as Windows does.

For AIX, it doesn't have any effect, doesn't have a standardized
signature, and it needs certain feature test macros (i.e. _ALL_SOURCE)
we don't set by default for LLVM on AIX, so just make it a no-op too.

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

2 years ago[mlir] Introduce C API for the Quantization dialect types
Alex Zinenko [Mon, 3 Jan 2022 18:01:07 +0000 (19:01 +0100)]
[mlir] Introduce C API for the Quantization dialect types

Reviewed By: nicolasvasilache

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

2 years ago[mlir][linalg][bufferize] Fix CallOps with non-tensor operands
Matthias Springer [Wed, 5 Jan 2022 15:13:55 +0000 (00:13 +0900)]
[mlir][linalg][bufferize] Fix CallOps with non-tensor operands

Such CallOps were not handled properly. When computing the new result types (and replacement values) of a CallOp, non-tensor return values were not accounted for.

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

2 years ago[mlir] Use public PybindAdaptors in Linalg dialect bindings
Alex Zinenko [Wed, 5 Jan 2022 12:06:45 +0000 (13:06 +0100)]
[mlir] Use public PybindAdaptors in Linalg dialect bindings

Previously, the Python bindings for the Linalg dialect relied on the internal
implementation of core bindings. Most of that functionality was moved, and the
remaining one does not need access to the implementation: it used to accept a
dialect pointer as argument, but it can always be extracted from the operation
that it also accepts; operations are available through PybindAdaptors in an
opaque way. Change the bindings in that direction.

This enables the decoupling of the Linalg dialect Python extension from the
core IR Python extension.

Reviewed By: nicolasvasilache

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

2 years ago[AArch64] Regenerate some mir tests to new format. NFC
David Green [Wed, 5 Jan 2022 15:12:22 +0000 (15:12 +0000)]
[AArch64] Regenerate some mir tests to new format. NFC

2 years ago[mlir][linalg][bufferize][NFC] Remove RewriterBase from BufferizationState
Matthias Springer [Wed, 5 Jan 2022 12:17:53 +0000 (21:17 +0900)]
[mlir][linalg][bufferize][NFC] Remove RewriterBase from BufferizationState

This change simplifies BufferizationState. Having `rewriter` in BufferizationState could be confusing to users because a rewriter is also passed to each `bufferize` function and it is not obvious (by looking at the API) that these two rewriters are the same.

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

2 years ago[clangd] Refine comment on declarator ranges
Sam McCall [Wed, 5 Jan 2022 15:00:13 +0000 (16:00 +0100)]
[clangd] Refine comment on declarator ranges

2 years ago[clangd] Fix typos in the SelectionTree comment.
Haojian Wu [Wed, 5 Jan 2022 14:50:07 +0000 (15:50 +0100)]
[clangd] Fix typos in the SelectionTree comment.

2 years ago[AArch64] Adding "armv8.8-a" memcpy/memset support.
Simon Tatham [Thu, 11 Feb 2021 11:41:20 +0000 (11:41 +0000)]
[AArch64] Adding "armv8.8-a" memcpy/memset support.

This family of instructions includes CPYF (copy forward), CPYB (copy
backward), SET (memset) and SETG (memset + initialise MTE tags), with
some sub-variants to indicate whether address translation is done in a
privileged or unprivileged way. For the copy instructions, you can
separately specify the read and write translations (so that kernels
can safely use these instructions in syscall handlers, to memcpy
between the calling process's user-space memory map and the kernel's
own privileged one).

The unusual thing about these instructions is that they write back to
multiple registers, because they perform an implementation-defined
amount of copying each time they run, and write back to _all_ the
address and size registers to indicate how much remains to be done
(and the code is expected to loop on them until the size register
becomes zero). But this is no problem in LLVM - you just define each
instruction to have multiple outputs, multiple inputs, and a set of
constraints tying their register numbers together appropriately.

This commit introduces a special subtarget feature called MOPS (after
the name the spec gives to the CPU id field), which is a dependency of
the top-level 8.8-A feature, and uses that to enable most of the new
instructions. The SETMG instructions also depend on MTE (and the test
checks that).

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

2 years ago[llvm-strings] Remove use of hard coded executable name
gbreynoo [Wed, 5 Jan 2022 14:34:45 +0000 (14:34 +0000)]
[llvm-strings] Remove use of hard coded executable name

Other tools take their tool name from argv[0] for use in output
messages. This change makes llvm-strings consistent with other tools
rather than using a hard coded value.

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

2 years ago[clangd] Handle declarators more consistently in Selection.
Sam McCall [Tue, 4 Jan 2022 21:46:25 +0000 (22:46 +0100)]
[clangd] Handle declarators more consistently in Selection.

Because declarators nest inside-out, we logically need to claim tokens for
parent declarators logically before child ones.
This is the ultimate reason we had problems with DeclaratorDecl, ArrayType etc.

However actually changing the order of traversal is hard, especially for nodes
that have both declarator and non-declarator children.
Since there's only a few TypeLocs corresponding to declarators, we just
have them claim the exact tokens rather than rely on nesting.

This fixes handling of complex declarators, like
`int (*Fun(OuterT^ype))(InnerType);`.

This avoids the need for the DeclaratorDecl early-claim hack, which is
removed.
Unfortunately the DeclaratorDecl early-claims were covering up an AST
anomaly around CXXConstructExpr, so we need to fix that up too.

Based on D116623 and D116618

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

2 years ago[mlir] Fix missing check on nested op values in LICM
Nicolas Vasilache [Wed, 5 Jan 2022 13:19:32 +0000 (08:19 -0500)]
[mlir] Fix missing check on nested op values in LICM

LICM checks that nested ops depend only on values defined outside
before performing hoisting.
However, it specifically omits to check for terminators which can
lead to SSA violations.
This revision fixes the incorrect behavior.

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