platform/upstream/llvm.git
15 months agoFix invalid op result access in SparseTensorCodegen
Frederik Gossen [Mon, 10 Apr 2023 16:30:27 +0000 (12:30 -0400)]
Fix invalid op result access in SparseTensorCodegen

This trigges an assertion introduced in https://reviews.llvm.org/D147883

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

15 months ago[AMDGPU] Fix AddedComplexity for s_buffer_load patterns. NFCI.
Jay Foad [Mon, 6 Mar 2023 16:33:49 +0000 (16:33 +0000)]
[AMDGPU] Fix AddedComplexity for s_buffer_load patterns. NFCI.

We set AddedComplexity = 100 for s_load patterns to prefer them over
global loads, but for s_buffer_load patterns there is no need to do
this and it was quietly overriding the AddedComplexity of each
individual GCNPat that is defined inside SMLoad_Pattern (but in practice
that did not appear to make any difference).

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

15 months agoChange dyn_cast to cast
Bing1 Yu [Mon, 10 Apr 2023 16:14:04 +0000 (00:14 +0800)]
Change dyn_cast to cast

Reviewed By: pengfei

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

15 months ago[mlir][tosa] Lowering of tosa.gather operations with dynamic dimensions
Spenser Bauman [Mon, 10 Apr 2023 15:55:54 +0000 (15:55 +0000)]
[mlir][tosa] Lowering of tosa.gather operations with dynamic dimensions

The existing TOSA->Linalg lowering of tosa.gather only supports gathers
with either a static shape or a single dynamic batch dimension.
This change extends support to arbitrary number of dynamic dimensions on
both the values and indices of the gather operation.

Reviewed By: rsuderman

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

15 months ago[flang][NFC] Extract TypeConverter from header file
Valentin Clement [Mon, 10 Apr 2023 15:33:52 +0000 (08:33 -0700)]
[flang][NFC] Extract TypeConverter from header file

Extract the type converter definitions into its own .cpp
file so the type converter can be used by passes.

Reviewed By: PeteSteinfeld

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

15 months ago[Clang] Check type-constraints applied to placeholder types
Corentin Jabot [Mon, 10 Apr 2023 09:52:30 +0000 (11:52 +0200)]
[Clang] Check type-constraints applied to placeholder types

(and deduced return types)

Previously, only type constraints applied to type parameter
were semantically checked.

A diagnostic would still be emitted on instantiation, but it was
too late, lacked clarity, and was inconsistent with type parameters.

Reviewed By: erichkeane

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

15 months ago[asan][test] Fix two test cases on Windows
Alvin Wong [Sun, 2 Apr 2023 18:26:30 +0000 (02:26 +0800)]
[asan][test] Fix two test cases on Windows

Fixes global-location-nodebug and heavy_uar_test for both MSVC and MinGW
targets.

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

15 months ago[sanitizer][win] Fix `Atexit()` on MinGW asan_dynamic runtime
Alvin Wong [Sun, 2 Apr 2023 15:19:23 +0000 (23:19 +0800)]
[sanitizer][win] Fix `Atexit()` on MinGW asan_dynamic runtime

Some functions of asan depends on `Atexit()` handlers. On Windows, this
is implemented in ad3ec82bb1c7217b0187a1e16bb22642e194ce94 to queue the
handlers in a vector then register them with `atexit()` only after the
CRT is fully initialized. However, this is broken on MinGW with
asan_dynamic runtime due to different initialization order. This change
fixes the issue by making sure that `Atexit()` can call `atexit()`
directly past the pre-initialization phase.

This fixes two asan test cases on MinGW.

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

15 months ago[clang-tidy] Added IgnoreVirtual option to misc-unused-parameters
Piotr Zegar [Mon, 10 Apr 2023 14:41:32 +0000 (14:41 +0000)]
[clang-tidy] Added IgnoreVirtual option to misc-unused-parameters

Added option to ignore virtual methods in this check.
This allows to quickly get rid of big number of
potentialy false-positive issues without inserting
not-needed comments.

Fixes #55665.

Reviewed By: njames93

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

15 months ago[LoopPredication] Fix where we generate widened condition. PR61963
Anna Thomas [Thu, 6 Apr 2023 18:42:14 +0000 (14:42 -0400)]
[LoopPredication] Fix where we generate widened condition. PR61963

Loop predication's predicateLoopExit pass does two incorrect things:

It sinks the widenable call into the loop, thereby converting an invariant condition to a variant one
It widens the widenable call at a branch thereby converting the branch into a loop-varying one.

The latter is problematic when the branch may have been loop-invariant
and prior optimizations (such as indvars) may have relied on this
fact, and updated the deopt state accordingly.

Now, when we widen this with a loop-varying condition, the deopt state
is no longer correct.
https://github.com/llvm/llvm-project/issues/61963 fixed.

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

15 months agoSimplify test with deopt state in D147662. NFC
Anna Thomas [Mon, 10 Apr 2023 14:28:19 +0000 (10:28 -0400)]
Simplify test with deopt state in D147662. NFC

15 months ago[NFC][tests] Disable new gmodules-preferred-name-* tests on AIX and z/OS
Jake Egan [Mon, 10 Apr 2023 13:43:31 +0000 (09:43 -0400)]
[NFC][tests] Disable new gmodules-preferred-name-* tests on AIX and z/OS

Objective-C is not supported on AIX and z/OS. Precedent here: D109060

15 months ago[AMDGPU][NFC] Regenerate test checks for merge-tbuffer.mir
skc7 [Mon, 10 Apr 2023 13:07:17 +0000 (18:37 +0530)]
[AMDGPU][NFC] Regenerate test checks for merge-tbuffer.mir

15 months agoFix the buildbots after 636dd1e8a1782e22f9bdee640428ed5c50a4a4f2
Aaron Ballman [Mon, 10 Apr 2023 12:45:56 +0000 (08:45 -0400)]
Fix the buildbots after 636dd1e8a1782e22f9bdee640428ed5c50a4a4f2

This addresses issues found by:
http://45.33.8.238/linux/103908/step_4.txt
https://lab.llvm.org/buildbot/#/builders/216/builds/19607
and others

15 months ago[clang-tidy][NFC] Remove trailing spaces from ReleaseNotes.rst
Piotr Zegar [Mon, 10 Apr 2023 12:42:24 +0000 (12:42 +0000)]
[clang-tidy][NFC] Remove trailing spaces from ReleaseNotes.rst

Cleanup some trailing whitespaces from ReleaseNotes.rst

15 months agoMake explicit the single-argument constructors of AttributeCommonInfo; NFC
Aaron Ballman [Mon, 10 Apr 2023 12:29:21 +0000 (08:29 -0400)]
Make explicit the single-argument constructors of AttributeCommonInfo; NFC

The single-argument constructors of this class were not marked explicit
and that led to some incorrect uses that slipped under the radar (see
changes in SemaDeclAttr.cpp). This makes the constructors explicit,
changes the benignly incorrect uses, and updates the tablegen code to
emit the correct support code to call the explicit constructors.

While this does correct a misuse, that incorrect usage could not be
observed except via a debugger and so no additional tests are added.

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

15 months ago[TableGen] Fix compile fail when compiling llvm with MSVC due to typo in 931418667063
Shengchen Kan [Mon, 10 Apr 2023 12:21:06 +0000 (20:21 +0800)]
[TableGen] Fix compile fail when compiling llvm with MSVC due to typo in 931418667063

15 months ago[VPlan] Use VPLiveOut to update FOR live-out users.
Florian Hahn [Mon, 10 Apr 2023 12:02:44 +0000 (13:02 +0100)]
[VPlan] Use VPLiveOut to update FOR live-out users.

Instead of iterating over all LCSSA phis in the exit block, collect all
LiveOut users of the FOR splice VPInstruction and only update those
users.

Building on top of D147471, this removes an access to the cost model
after VPlan execution.

Depends on D147471.

Reviewed By: Ayal, michaelmaitland

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

15 months ago[clang-tidy] avoid colon in namespace cause false positve
Congcong Cai [Mon, 10 Apr 2023 11:42:32 +0000 (13:42 +0200)]
[clang-tidy] avoid colon in namespace cause false positve

Refactor the Namespaces with NamespaceDecl[][].
First level stores non nested namepsace.
Second level stores nested namespace.

Reviewed By: PiotrZSL

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

15 months ago[AMDGPU] Extend tbuffer_load_format merge
mmarjano [Fri, 7 Apr 2023 11:27:27 +0000 (13:27 +0200)]
[AMDGPU] Extend tbuffer_load_format merge

Add support for merging _IDXEN and _BOTHEN variants of
TBUFFER_LOAD_FORMAT instruction.

15 months ago[clang] Mark CWG536 as N/A
Vlad Serebrennikov [Mon, 10 Apr 2023 10:17:04 +0000 (13:17 +0300)]
[clang] Mark CWG536 as N/A

[[https://wg21.link/p1787 | P1787]]: CWG536 (long partially resolved) is resolved by specifying that unqualified lookup occurs for any kind of unqualified-id as an id-expression.
Wording: An unqualified name is a name that <...>. Unless otherwise specified, such a name undergoes unqualified name lookup from the point where it appears. ([basic.lookup.unqual]/4)

Reviewed By: #clang-language-wg, aaron.ballman

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

15 months ago[clang-tidy][NFC] Rename test files for simplify-boolean-expr to match check name
Piotr Zegar [Mon, 10 Apr 2023 09:50:00 +0000 (09:50 +0000)]
[clang-tidy][NFC] Rename test files for simplify-boolean-expr to match check name

Change simplify-bool-expr -> simplify-boolean-expr

15 months ago[SCEV] Improve AddRecs' range computation in Expensive Range Sharpening mode
Max Kazantsev [Mon, 10 Apr 2023 09:37:10 +0000 (16:37 +0700)]
[SCEV] Improve AddRecs' range computation in Expensive Range Sharpening mode

Apply loop guards to AddRec's start in range computation for
non-self-wrapping AddRecs.

According to CT measurements, this has a wide negative compile time impact,
so we hold it in expensive range sharpening mode where it's not so critical.
However, we need to find a way to share benefits of this mode with default mode.

Patch by Aleksandr Popov!

Differential Revision: https://reviews.llvm.org/D147557
Reviewed By: mkazantsev

15 months ago[Coverity] avoid array overflow when use -1 as index.
Luo, Yuanke [Mon, 10 Apr 2023 07:37:05 +0000 (15:37 +0800)]
[Coverity] avoid array overflow when use -1 as index.

15 months ago[TableGen] Pass size to std::vector constructor instead of using resize. NFC
Craig Topper [Mon, 10 Apr 2023 06:13:51 +0000 (23:13 -0700)]
[TableGen] Pass size to std::vector constructor instead of using resize. NFC

15 months ago[TableGen] Make TreePatternNode::InlinePatternFragments a static method. NFC
Craig Topper [Mon, 10 Apr 2023 04:39:57 +0000 (21:39 -0700)]
[TableGen] Make TreePatternNode::InlinePatternFragments a static method. NFC

Previously we were passing 'this' and the std::shared_ptr version
of 'this'. This replaces all uses of 'this' with the shared_ptr and
makes the method static.

15 months ago[TableGen] Move vectors into DAGInstruction instead of copying them. NFC
Craig Topper [Mon, 10 Apr 2023 03:53:45 +0000 (20:53 -0700)]
[TableGen] Move vectors into DAGInstruction instead of copying them. NFC

15 months ago[NFC][IRCE] Do not store latch exit count
Max Kazantsev [Mon, 10 Apr 2023 06:57:51 +0000 (13:57 +0700)]
[NFC][IRCE] Do not store latch exit count

It is not actually used for any computations. Its only purpose is to
check that the loop is finite and find out the type of computed exit
count. Refactor code so that we only store this type.

15 months ago[AMDGPU] Introduce SIInstrWorklist to process instructions in moveToVALU
skc7 [Tue, 28 Mar 2023 18:05:02 +0000 (23:35 +0530)]
[AMDGPU] Introduce SIInstrWorklist to process instructions in moveToVALU

Reviewed By: arsenm

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

15 months ago[X86] Add inst fixup for `unpckps` -> `unpckdq`.
Noah Goldstein [Mon, 10 Apr 2023 00:23:30 +0000 (19:23 -0500)]
[X86] Add inst fixup for `unpckps` -> `unpckdq`.

`unpckps` has the same performance as `unpckpd` (only port5) wereas
`unpckdq` can run on p15 on some newer architectures.

`unpckdq` is in the integer domain, so only do the transform if the
target has no bypass delay on shuffles (SKL+).

Reviewed By: RKSimon

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

15 months ago[X86] Add inst fixup for `unpckpd` -> `unpckqdq`.
Noah Goldstein [Mon, 10 Apr 2023 00:23:26 +0000 (19:23 -0500)]
[X86] Add inst fixup for `unpckpd` -> `unpckqdq`.

`unpckqdq` seems to be treated as a shuffle from bypass delay
perspective (which makes sense it appears to have shared shuffle units
for all micro-arch).

`unpckqdq` is slightly preferable to `shufpd` as it saves 1-byte of
code size and can be used to replace the micro-fused `rm` version. So,
if the target has no bypass delay, we should do `unpckpd` ->
`unpckqdq` instead of `shufpd.

Reviewed By: pengfei

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

15 months ago[X86] Fix perf bug in `permilps` -> `shufd` in X86FixupInstTuning.
Noah Goldstein [Mon, 10 Apr 2023 00:23:23 +0000 (19:23 -0500)]
[X86] Fix perf bug in `permilps` -> `shufd` in X86FixupInstTuning.

We shouldn't do the transformation if we either have bypass delay OR
the new opcode has worse performance. Previous code was incorrectly
using AND.

Reviewed By: RKSimon

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

15 months ago[X86] Improve inst tuning tests for X86FixupInstTuning Pass; NFC
Noah Goldstein [Mon, 10 Apr 2023 00:23:19 +0000 (19:23 -0500)]
[X86] Improve inst tuning tests for X86FixupInstTuning Pass; NFC

1) Add tests for `unpckps`.
2) Add explicit test for fast shuffles (ICX+) but WITH bypass delay.

Reviewed By: RKSimon

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

15 months ago[GlobalISelEmitter] add case for D141247, NFC.
Chen Zheng [Mon, 10 Apr 2023 05:11:26 +0000 (01:11 -0400)]
[GlobalISelEmitter] add case for D141247, NFC.

15 months agoRevert "[MLIR] Add an assert in Operation::getOpResultImpl for out of range result"
Mehdi Amini [Mon, 10 Apr 2023 04:21:56 +0000 (21:21 -0700)]
Revert "[MLIR] Add an assert in Operation::getOpResultImpl for out of range result"

This reverts commit 13b21971fbf5cd47dc3acb0c593aae8ae980c8d8.
Multiple bots are broken.

15 months ago[mlir][affine] Fix crash on -affine-loop-invariant-code-motion pass with affine.prefe...
Anoop J S [Mon, 10 Apr 2023 03:40:49 +0000 (09:10 +0530)]
[mlir][affine] Fix crash on -affine-loop-invariant-code-motion pass with affine.prefetch Op

Affine Prefetch Op impelements AffineMapAccessInterface but does not implement
AffineReadOpInterface or AffineWriteOpInterface. Prefetch Op was cast to
AffineWriteOpinterface causing the crash.

Reviewed By: bondhugula

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

15 months ago[RISCV] Support assembler and dis-assembler for VCIX extension.
Nelson Chu [Fri, 15 Apr 2022 04:25:36 +0000 (21:25 -0700)]
[RISCV] Support assembler and dis-assembler for VCIX extension.

Spec: https://sifive.cdn.prismic.io/sifive/c3829e36-8552-41f0-a841-79945784241b_vcix-spec-software.pdf

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

15 months ago[AVR][NFC] Fix errors in commit 6e57f68e41c92936b9ef3a4e6fb286e8805a9fbc
Ben Shi [Mon, 10 Apr 2023 03:13:07 +0000 (11:13 +0800)]
[AVR][NFC] Fix errors in commit 6e57f68e41c92936b9ef3a4e6fb286e8805a9fbc

15 months ago[MachineOutliner] Add IsOutlined to MachineFunction
wangpc [Mon, 10 Apr 2023 02:57:00 +0000 (10:57 +0800)]
[MachineOutliner] Add IsOutlined to MachineFunction

We add a field `IsOutlined` to indicate whether a MachineFunction
is outlined and set it true for outlined functions in MachineOutliner.

Reviewed By: paquette

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

15 months ago[AVR] Reject invalid LDD instruction with explicit error
Ben Shi [Sun, 9 Apr 2023 09:37:32 +0000 (17:37 +0800)]
[AVR] Reject invalid LDD instruction with explicit error

We should reject "ldd Rn, X" with explicit error message
rather than "llvm_unreachable" in llvm's release build.

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

Reviewed By: Miss_Grape

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

15 months ago[AMDGPU][Global-ISel] reuse extension related patterns in td file
Chen Zheng [Fri, 7 Apr 2023 10:22:31 +0000 (10:22 +0000)]
[AMDGPU][Global-ISel] reuse extension related patterns in td file

However the imported rules can not be used for now because Global ISel
selectImpl() seems has some bug/limitation to create a illegl COPY
from VGPR to SGPR. So currently workaround this by not auto selecting these
patterns.

Fixes #61468

Reviewed By: arsenm

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

15 months ago[X86] Add an additional ReadAfterLoad to EVEX FMA instructions.
Craig Topper [Mon, 10 Apr 2023 00:12:27 +0000 (17:12 -0700)]
[X86] Add an additional ReadAfterLoad to EVEX FMA instructions.

These instructions have 3 sources. 2 of them are registers when
the load is folded. So we need 2 ReadAfterLoad SchedReads.

15 months ago[X86] Correct the scheduling information for AVX-VNNI and AVX512-VNNI instructons.
Craig Topper [Sun, 9 Apr 2023 23:33:47 +0000 (16:33 -0700)]
[X86] Correct the scheduling information for AVX-VNNI and AVX512-VNNI instructons.

The AVXVNNI load instructions weren't using the Folded load write
class and they had no ReadAdvance.
The YMM versions were using the XMM schedule class.

The AVX512VNNI instructions had the right classes, but not enough
ReadAdvances to account for the 2 sources.

Noticed while investigating #62026.

Reviewed By: pengfei

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

15 months ago[TableGen] Use map::try_emplace to construction DAGInstruction in the Instructions...
Craig Topper [Sun, 9 Apr 2023 23:32:54 +0000 (16:32 -0700)]
[TableGen] Use map::try_emplace to construction DAGInstruction in the Instructions map. NFC

We add entries to the map in two places. One already used
std::piecewise_construct with map::emplace. The other was using
map::insert. Change both to map::try_emplace.

15 months ago[MLIR] Add an assert in Operation::getOpResultImpl for out of range result
Shivam Gupta [Sun, 9 Apr 2023 12:57:07 +0000 (18:27 +0530)]
[MLIR] Add an assert in Operation::getOpResultImpl for out of range result

This fix https://github.com/llvm/llvm-project/issues/61962.

Calling op->getResult(0) on a function like operation with no results
returned a garbage pointer.

This patch add assert to check number is in range.

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

15 months ago[VPlan] Don't assign slots for external defs (NFCI).
Florian Hahn [Sun, 9 Apr 2023 20:01:10 +0000 (21:01 +0100)]
[VPlan] Don't assign slots for external defs (NFCI).

External defs are VPValues wrapping an IR value and hence will get
printed as ir<>. We don't need to assign a slot for a VPValue number.

15 months ago[clang][AST] Fix `-Wuninitialized`. NFC
Michael Liao [Sun, 9 Apr 2023 19:55:38 +0000 (15:55 -0400)]
[clang][AST] Fix `-Wuninitialized`. NFC

- Adjust the declaration order as non-static member are initialized in
  order of declaration in the class definition.

15 months ago[LV] Update tests checking VPlans to use patterns for VPValues.
Florian Hahn [Sun, 9 Apr 2023 19:32:09 +0000 (20:32 +0100)]
[LV] Update tests checking VPlans to use patterns for VPValues.

This makes the tests more robust to changes in value numbering for
VPValues.

15 months ago[TableGen] Remove TypeSetByHwMode::isDefaultOnly(). Use InfoByHwMode<T>::isSimple...
Craig Topper [Sun, 9 Apr 2023 17:56:06 +0000 (10:56 -0700)]
[TableGen] Remove TypeSetByHwMode::isDefaultOnly(). Use InfoByHwMode<T>::isSimple(). NFC

InfoByHwMode is the base class of TypeSetByHwMode. The two methods
did the same thing. No reason to have two ways to do it.

Also use the getSimple() access instead of Map.begin()->second.

15 months ago[gn build] Port e8cfbfd05a95
LLVM GN Syncbot [Sun, 9 Apr 2023 15:57:26 +0000 (15:57 +0000)]
[gn build] Port e8cfbfd05a95

15 months ago[libc++] Granularize system_error.
Mark de Wever [Sat, 8 Apr 2023 15:29:31 +0000 (17:29 +0200)]
[libc++] Granularize system_error.

Reviewed By: #libc, philnik

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

15 months ago[clang-tidy] fix false positve for namespace with attrs in modernize-concat-nested...
Congcong Cai [Sun, 9 Apr 2023 14:23:28 +0000 (16:23 +0200)]
[clang-tidy] fix false positve for namespace with attrs in modernize-concat-nested-namespaces

Fixed https://github.com/llvm/llvm-project/issues/57530
Add pre check to avoid false positive for namespace with attributes like
```
namespace [[deprecated]] ns {}
```

Reviewed By: PiotrZSL

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

15 months ago[libc++] Implements isblank.
Mark de Wever [Sat, 8 Apr 2023 12:59:09 +0000 (14:59 +0200)]
[libc++] Implements isblank.

This omission seems to be there for a long time, it's in the initial
libc++ import. This was discovered while working on the std modules.

Reviewed By: #libc, philnik

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

15 months ago[libc++][format] Addresses LWG3720.
Mark de Wever [Fri, 17 Feb 2023 20:27:08 +0000 (21:27 +0100)]
[libc++][format] Addresses LWG3720.

  LWG3720 Restrict the valid types of arg-id for width and precision in
  std-format-spec

Depends on D144325

Reviewed By: #libc, ldionne

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

15 months ago[libc++][format] range-default-formatter for strings.
Mark de Wever [Thu, 5 May 2022 16:57:32 +0000 (18:57 +0200)]
[libc++][format] range-default-formatter for strings.

Implements the range-default-formatter specialization range_format::string
and range_format::debug_string.

Implements parts of
- P2286R8 Formatting Ranges
- P2585R0 Improving default container formatting

Depends on D145847

Reviewed By: ldionne, #libc

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

15 months agoRevert (3) "[Assignment Tracking] Enable by default"
OCHyams [Sun, 9 Apr 2023 10:21:55 +0000 (11:21 +0100)]
Revert (3) "[Assignment Tracking] Enable by default"

Revert D146987.

This reverts commit f11e1475c97c1ba6b418838f3592de930677c3d0 which
reapplies D146987.

Buildbot: https://lab.llvm.org/buildbot/#/builders/70/builds/36103

15 months agoReapply (2) "[Assignment Tracking] Enable by default"
OCHyams [Sun, 9 Apr 2023 08:59:26 +0000 (09:59 +0100)]
Reapply (2) "[Assignment Tracking] Enable by default"

Re-land D146987.

This reverts commit 64fba207a683a355d9059cd57adb8a139c2f5dda
which reverts D146987.

15 months ago[Assignment Tracking] Fix fragments for assignments to variables smaller than the...
OCHyams [Sun, 9 Apr 2023 08:47:09 +0000 (09:47 +0100)]
[Assignment Tracking] Fix fragments for assignments to variables smaller than the alloca

Prior to this patch the trackAssignments function would attribute all stores to
an alloca to all variables linked to the alloca. This is wrong in the case
where the alloca contains variables which are smaller than the alloca, and
caused erroneous fragment information to be generated.

Now stores outside the variable bounds are discarded, and we check whether a
fragment is needed based on whether the store covers the entire variable as
opposed to whether it covers the entire alloca (except for variables of unknown
size).

Note that trackAssignments doesn't yet understand whole variables sitting at
anything other than offset 0 in an alloca - those variables are still tracked
using dbg.declares.

Fixes https://lab.llvm.org/buildbot/#/builders/70/builds/36007

Reviewed By: jmorse

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

15 months ago[clang-tidy] Fix AST Library documentation link
Jorge Pinto Sousa [Sun, 9 Apr 2023 08:45:07 +0000 (08:45 +0000)]
[clang-tidy] Fix AST Library documentation link

The link was pointing to the 'Lexer and Preprocessor Library'
instead.

Reviewed By: PiotrZSL

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

15 months ago[VPlan] Don't add live-outs if scalar epilogue is required.
Florian Hahn [Sun, 9 Apr 2023 08:15:42 +0000 (09:15 +0100)]
[VPlan] Don't add live-outs if scalar epilogue is required.

Instead of clearing live outs when a scalar epilogue is required late,
don't add live outs during VPlan construction if a scalar epilogue is
required.

This enables more VPlan-based DCE (if the live out would be the only
user in the plan) and is a step towards removing an access of the cost
model in fixedVectorizedLoop (which is after VPlan execution).

Depends on D147468.

Reviewed By: Ayal

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

15 months ago[TableGen] Reorder some checks in TreePatternNode::isIsomorphicTo to speedup -gen...
Craig Topper [Sun, 9 Apr 2023 07:42:35 +0000 (00:42 -0700)]
[TableGen] Reorder some checks in TreePatternNode::isIsomorphicTo to speedup -gen-dag-isel for RISC-V.

Comparing types is quite expensive when hardware modes are being
used. Checking the operator first can let us detect mismatches
earlier without checking types.

15 months ago[libc++][spaceship] Implement `operator<=>` for `time_point`
Hristo Hristov [Sat, 1 Apr 2023 08:51:03 +0000 (11:51 +0300)]
[libc++][spaceship] Implement `operator<=>` for `time_point`

Depends on D145881

Implements parts of **P1614R2**: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html
Implements `operator<=>` for `time_point`

Reviewed By: #libc, Mordante

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

15 months ago[TableGen] Slightly improve the efficiency of InfoByHwMode::get.
Craig Topper [Sun, 9 Apr 2023 01:54:56 +0000 (18:54 -0700)]
[TableGen] Slightly improve the efficiency of InfoByHwMode::get.

This avoids some double map lookups. Also use Map.begin() to find
the default mode instead of going through find.

15 months ago[X86][mem-fold][NFC] Simplify code by transform A != 0 - > A
Shengchen Kan [Sun, 9 Apr 2023 01:29:41 +0000 (09:29 +0800)]
[X86][mem-fold][NFC] Simplify code by transform A != 0 - > A

15 months ago[libc++] Remove <cstdlib> includes
Nikolas Klauser [Sun, 8 Jan 2023 15:47:53 +0000 (16:47 +0100)]
[libc++] Remove <cstdlib> includes

We changed the `abort` calls when trying to throw exceptions in `-fno-exceptions` mode to `__verbose_abort` calls, which removes the dependency in most files.

Reviewed By: ldionne, #libc

Spies: dim, emaste, mikhail.ramalho, smeenai, libcxx-commits

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

15 months ago[ORC][MachO] Remove unused variables.
Lang Hames [Sat, 8 Apr 2023 23:48:13 +0000 (16:48 -0700)]
[ORC][MachO] Remove unused variables.

15 months ago[CodeGen] Use range-based for loops (NFC)
Kazu Hirata [Sat, 8 Apr 2023 23:22:39 +0000 (16:22 -0700)]
[CodeGen] Use range-based for loops (NFC)

15 months ago[ORC] Fix reference to struct member in f448d44663a.
Lang Hames [Sat, 8 Apr 2023 23:09:45 +0000 (16:09 -0700)]
[ORC] Fix reference to struct member in f448d44663a.

A map value was converted from a tuple to a struct during development, but I
missed a use in an assert.

15 months ago[SCEV][NFC] Fix `Do not use 'else' after 'return'`
Joshua Cao [Sat, 8 Apr 2023 22:55:21 +0000 (15:55 -0700)]
[SCEV][NFC] Fix `Do not use 'else' after 'return'`

Follow LLVM coding standards and make clangd emit less warnings.

15 months ago[ORC][ORC-RT][MachO] Use _objc_(map|load)_images for ObjC & Swift registration.
Lang Hames [Fri, 7 Apr 2023 21:40:05 +0000 (14:40 -0700)]
[ORC][ORC-RT][MachO] Use _objc_(map|load)_images for ObjC & Swift registration.

This patch drops the individual registration calls to the ObjC and Swift
runtimes (for selectors, classes, etc.), and instead creates a Mach header and
load commands that can be passed to _objc_map_images and _objc_load_images to
trigger registration and execution of +load methods. This approach supports
categories (for which there is no current registration API), and more closely
follows dyld's ObjC & Swift registration path.

15 months ago[mlir] Use DenseMap::contains (NFC)
Kazu Hirata [Sat, 8 Apr 2023 22:44:18 +0000 (15:44 -0700)]
[mlir] Use DenseMap::contains (NFC)

15 months ago[SCEV] Add test for huge trip multiples
Joshua Cao [Sat, 8 Apr 2023 22:14:12 +0000 (15:14 -0700)]
[SCEV] Add test for huge trip multiples

15 months ago[AMDGPU] Update mcp-overlap-after-propagation.mir test
Sergei Barannikov [Sat, 8 Apr 2023 22:08:41 +0000 (01:08 +0300)]
[AMDGPU] Update mcp-overlap-after-propagation.mir test

The test was added in D69953, but since D67794 landed a bit later it no
longer catches the bug. Update the test to be representative again.

Reviewed By: arsenm

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

15 months ago[ORC][LLJIT] Improve debugging output, tighten assertion.
Lang Hames [Sat, 8 Apr 2023 17:38:52 +0000 (10:38 -0700)]
[ORC][LLJIT] Improve debugging output, tighten assertion.

Clients can provide an ExecutionSession or an ExecutorProcessControl object to
LLJITBuilder, but should not provide both.

15 months ago[TableGen] Reimplement union_modes for InfoByHwMode to be avoid a secondary set.
Craig Topper [Sat, 8 Apr 2023 19:46:15 +0000 (12:46 -0700)]
[TableGen] Reimplement union_modes for InfoByHwMode to be avoid a secondary set.

Previously we collected both modes in a set and iterated over that set.

Instead, iterate over the two maps in parallel and detect the differences
as we go.

15 months ago[TableGen] Use InfoByHwMode::getSimple() in place of *InfoByHwMode::begin(). NFC
Craig Topper [Sat, 8 Apr 2023 18:55:55 +0000 (11:55 -0700)]
[TableGen] Use InfoByHwMode::getSimple() in place of *InfoByHwMode::begin(). NFC

15 months ago[clang-tidy] fix hint use correct range to replace last NamespaceDecl
Congcong Cai [Sat, 8 Apr 2023 19:03:58 +0000 (21:03 +0200)]
[clang-tidy] fix hint use correct range to replace last NamespaceDecl

range of replacing last namespace decl should be from last non nested namespace to last namespace

Reviewed By: PiotrZSL

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

15 months ago[libc++][NFC] Only run the preprocessor in transitive_includes.sh.cpp
Nikolas Klauser [Fri, 31 Mar 2023 12:47:33 +0000 (14:47 +0200)]
[libc++][NFC] Only run the preprocessor in transitive_includes.sh.cpp

This cuts the time it takes to run the test in half.

Reviewed By: Mordante, #libc

Spies: libcxx-commits

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

15 months ago[M68k] Basic FP register files and FMOVE implementations
Min-Yih Hsu [Fri, 7 Apr 2023 17:57:32 +0000 (10:57 -0700)]
[M68k] Basic FP register files and FMOVE implementations

  - FP registers and register classes definitions
  - MC support for FP registers
  - MC support for the FPDR -> FPDR variant of FMOVE/FSMOVE/FDSMOVE

Note that we don't implement 32/64-bit FP registers with subregisters since
f32/f64 values will be converted to f80 upon storing into a register,
rather than occupying part of the register.
So we only use register classes with different value types to distinguish
them.

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

15 months ago[clang-tidy] Fix extern fixes in readability-redundant-declaration
Piotr Zegar [Sat, 8 Apr 2023 17:17:12 +0000 (17:17 +0000)]
[clang-tidy] Fix extern fixes in readability-redundant-declaration

Currently check does not look into LinkageSpecDecl
when removing redundant variable re-declarations.
This were leaving code in non-compiling state.
Fix patch fixes this and adds removal also of 'extern C'.

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

Reviewed By: carlosgalvezp

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

15 months ago[libc++][format] Implements formatter thread::id.
Mark de Wever [Sat, 18 Feb 2023 17:30:56 +0000 (18:30 +0100)]
[libc++][format] Implements formatter thread::id.

Since stacktrace header is WIP and it's not sure that will be done
before LLVM17 update the documentation. When the header is implemented
implementing the formatter is trivial, so that can be done quickly
afterwards.

Implements parts of:
 - P2693R1 Formatting thread::id and stacktrace

Reviewed By: #libc, ldionne

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

15 months ago[clang][Interp] Add missing static_assert message
Timm Bäder [Sat, 8 Apr 2023 13:44:11 +0000 (15:44 +0200)]
[clang][Interp] Add missing static_assert message

15 months ago[clang][Interp][NFC] Add test for e7f55bb
Timm Bäder [Sat, 8 Apr 2023 13:26:46 +0000 (15:26 +0200)]
[clang][Interp][NFC] Add test for e7f55bb

15 months ago[clang][Interp] Fix a crash when calling invalid constexpr functions
Timm Bäder [Sat, 8 Apr 2023 09:59:59 +0000 (11:59 +0200)]
[clang][Interp] Fix a crash when calling invalid constexpr functions

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

15 months ago[libc++][chrono] Add sys_time formatter.
Mark de Wever [Sun, 20 Mar 2022 12:40:02 +0000 (13:40 +0100)]
[libc++][chrono] Add sys_time formatter.

Partially implements:
- P1361 Integration of chrono with text formatting
- P2372 Fixing locale handling in chrono formatters

Reviewed By: ldionne, #libc

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

15 months ago[libc++][format] Implements LWG3892.
Mark de Wever [Fri, 3 Mar 2023 19:23:51 +0000 (20:23 +0100)]
[libc++][format] Implements LWG3892.

This LWG issue is based on the discussion regarding

  P2733R3 Fix handling of empty specifiers in std::format

This paper was disussed and changed a few times in LEWG during the
Issaquah meeting. The paper was not voted in, instead LEWG asked for
a DR against C++26.

This LWG issue contains the direction voted by LEWG. This issue has not
been voted in yet. However it fixes some of the defencies on the
container based formatting. Without this fix the range-default-formatter
for strings looks bad when used in containers.

The changes of this issue match the intended changes of P27333.

type                      fmt     before     after (if changed)
---------------------------------------------------------------
char                      {}      a
char                      {:?}    'a'
array<char, 1>            {}      ['a']
array<char, 1>            {::}    [a]
array<char, 1>            {::c}   [a]
array<char, 1>            {::?}   ['a']
map<char, char>           {}      {a: a}     -> {'a': 'a'}
map<char, char>           {::}    {'a': 'a'}
set<char>                 {}      {'a'}
set<char>                 {::}    {a}
set<char>                 {::c}   {a}
set<char>                 {::?}   {'a'}
tuple<char>               {}      ('a')
stack<char>               {}      ['a']
stack<char>               {::}    [a]
stack<char>               {::c}   [a]
stack<char>               {::?}   ['a']
array<array<char, 1>, 1>  {}      [[a]]      -> {'a': 'a'}
array<array<char, 1>, 1>  {::}    [['a']]
array<array<char, 1>, 1>  {:::}   [[a]]
array<array<char, 1>, 1>  {:::c}  [[a]]
array<array<char, 1>, 1>  {:::?}  [['a']]
array<tuple<char>, 1>     {}      [(a)]      -> [('a')]
tuple<tuple<char>>        {}      ((a))      -> (('a'))
tuple<array<char, 1>>     {}      ([a])      -> (['a'])

Note the optimization text as mentioned in the tuple formatter can't be
done. The call to parse may affect the formatter so its state needs to
be preserved.

Reviewed By: ldionne, #libc, EricWF

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

15 months ago[VPlan] Require VFRange.End to be a power-of-2. (NFCI)
Florian Hahn [Sat, 8 Apr 2023 12:04:08 +0000 (13:04 +0100)]
[VPlan] Require VFRange.End to be a power-of-2. (NFCI)

This removes the need to convert the end of the range to the next
power-of-2 for the end iterator after 4bd3fda5124962 and was suggested
as follow-up TODO in D147468.

15 months agoAMDGPU: Add baseline test for issue 61083
Matt Arsenault [Sun, 5 Mar 2023 19:53:06 +0000 (15:53 -0400)]
AMDGPU: Add baseline test for issue 61083

15 months agollvm-reduce: Actually change to the temporary directory in test
Matt Arsenault [Sat, 8 Apr 2023 11:07:29 +0000 (07:07 -0400)]
llvm-reduce: Actually change to the temporary directory in test

Hopefully fixes issue #61132

15 months agoAMDGPU: Fix LiveVariables verifier error for values defined before SI_END_CF
Matt Arsenault [Sun, 5 Mar 2023 11:07:23 +0000 (07:07 -0400)]
AMDGPU: Fix LiveVariables verifier error for values defined before SI_END_CF

GlobalISel happens to insert some constant materializes before SI_END_CF
in one test. These need to be excluded from AliveBlocks since they
are defined in the original block and used in the split block,
so they aren't fully alive through either block.

The case where the value defined in the first block which was originally used
in a later block is still broken.

Avoids a verifier error in a future patch.

15 months agoAMDGPU: Fix missing MIR serialization for PSInputAddr/PSInputEnable
Matt Arsenault [Sun, 5 Mar 2023 01:14:08 +0000 (21:14 -0400)]
AMDGPU: Fix missing MIR serialization for PSInputAddr/PSInputEnable

Resuming any mir test for a pixel shader would assert in the AsmPrinter.

15 months ago[VPlan] Add VFRange::begin() and end() iterators. (NFCI)
Florian Hahn [Sat, 8 Apr 2023 09:19:56 +0000 (10:19 +0100)]
[VPlan] Add VFRange::begin() and end() iterators. (NFCI)

Add an iterator to iterate over all VFs in VFRange. This simplifies some
existing code and allows using all_of,any_of and none_of on a VFRange.

Reviewed By: Ayal

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

15 months ago[Docs][llvm-remarkutil] Fix dangling reference in documentation
Aiden Grossman [Sat, 8 Apr 2023 07:45:55 +0000 (07:45 +0000)]
[Docs][llvm-remarkutil] Fix dangling reference in documentation

D147710 introduced a new annotation-count subcommand to llvm-remarkutil
and added in documentation. However, the reference added under the
subcommands list never actually pointed to anything. This patch adds a
marker for the reference to point to so that the link works and the
sphinx build finishes without any errors.

15 months ago[AMDGPU] Fix a case of updating LiveIntervals in SIOptimizeExecMaskingPreRA
Jay Foad [Thu, 6 Apr 2023 16:26:05 +0000 (17:26 +0100)]
[AMDGPU] Fix a case of updating LiveIntervals in SIOptimizeExecMaskingPreRA

This was causing two test failures when I applied D129208 to enable
extra verification of LiveIntervals:

  LLVM :: CodeGen/AMDGPU/optimize-negated-cond-exec-masking-wave32.mir
  LLVM :: CodeGen/AMDGPU/optimize-negated-cond-exec-masking.mir

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

15 months ago[TableGen] Simplify TypeInfer::expandOverloads. NFC
Craig Topper [Sat, 8 Apr 2023 06:38:04 +0000 (23:38 -0700)]
[TableGen] Simplify TypeInfer::expandOverloads. NFC

Directly test the 5 overloaded types instead of doing extra
set creation and iteration.

15 months ago[clang][Sema][NFC] Save token name instead of the full token
Timm Bäder [Wed, 5 Apr 2023 11:46:11 +0000 (13:46 +0200)]
[clang][Sema][NFC] Save token name instead of the full token

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

15 months ago[clang][Interp][NFCI] Call* ops don't modify the PC
Timm Bäder [Fri, 3 Feb 2023 11:20:15 +0000 (12:20 +0100)]
[clang][Interp][NFCI] Call* ops don't modify the PC

This caused the reported errors from the Call*() handlers to report the
wrong source location.

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

15 months ago[Outliner] Add an option to only enable outlining of patterns above a certain threshold
Nathan Lanza [Sat, 8 Apr 2023 06:10:27 +0000 (02:10 -0400)]
[Outliner] Add an option to only enable outlining of patterns above a certain threshold

Outlining isn't always a win when the saved instruction count is >= 1.
The overhead of representing a new function in the binary depends on
exception metadata and alignment. So parameterize this for local tuning.

Reviewed By: paquette

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

15 months ago[clang-tidy] fix concat-nest-namespace fix hint remove the macro
Congcong Cai [Sat, 8 Apr 2023 04:24:25 +0000 (06:24 +0200)]
[clang-tidy] fix concat-nest-namespace fix hint remove the macro

Partially fixed [#60035](https://github.com/llvm/llvm-project/issues/60035)
This patch refactor the FixHint for concat-nest-namespace.
1. remove each namespace except the last non-nest namespace.
2. replace the last non-nest namespace with the new name.

It can remain the comment / pragma / macro between namespace and update the close comment.

Reviewed By: PiotrZSL

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

15 months ago[ORC] Drop tests for OrcV2CBindingsReflectProcessSymbols after 231107a8b5b.
Lang Hames [Sat, 8 Apr 2023 03:00:49 +0000 (03:00 +0000)]
[ORC] Drop tests for OrcV2CBindingsReflectProcessSymbols after 231107a8b5b.

This test was removed as LLJIT now reflects process symbols by default.