platform/upstream/llvm.git
2 years ago[VPlan] Initial modeling of middle block in VPlan.
Florian Hahn [Wed, 20 Apr 2022 18:34:41 +0000 (19:34 +0100)]
[VPlan] Initial modeling of middle block in VPlan.

This patch extends the scope of VPlan to also include the exit (aka
middle) block.

For now, the exit block remains empty, but handling of exit values will
subsequently be moved to VPlan, by adding recipes to model exit values
in the exit block.

As a first step, this will allow fixing #51366.

Reviewed By: Ayal

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

2 years agoLook through calls to std::addressof to compute pointer alignment.
Eli Friedman [Mon, 18 Apr 2022 17:19:57 +0000 (10:19 -0700)]
Look through calls to std::addressof to compute pointer alignment.

This is sort of a followup to D37310; that basically fixed the same
issue, but then the libstdc++ implementation of <atomic> changed. Re-fix
the the issue in essentially the same way: look through the addressof
operation to find the alignment of the underlying object.

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

2 years ago[safestack] Support safestack in stack size diagnostics
Paul Kirth [Tue, 19 Apr 2022 16:34:23 +0000 (16:34 +0000)]
[safestack] Support safestack in stack size diagnostics

Current stack size diagnostics ignore the size of the unsafe stack.
This patch attaches the size of the static portion of the unsafe stack
to the function as metadata, which can be used by the backend to emit
diagnostics regarding stack usage.

Reviewed By: phosek, mcgrathr

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

2 years agoRevert "[clang][lex] NFCI: Use DirectoryEntryRef in HeaderSearch::load*()"
Jan Svoboda [Wed, 20 Apr 2022 18:09:04 +0000 (20:09 +0200)]
Revert "[clang][lex] NFCI: Use DirectoryEntryRef in HeaderSearch::load*()"

This reverts commit 1d3ba05e4a288b49287fe997763e90234b8c62db which caused failures of the VFS/real-path-found-first.m test on Windows build bots.

2 years ago[clang][lex] NFCI: Use FileEntryRef in ModuleMap::diagnoseHeaderInclusion()
Jan Svoboda [Wed, 20 Apr 2022 17:02:03 +0000 (19:02 +0200)]
[clang][lex] NFCI: Use FileEntryRef in ModuleMap::diagnoseHeaderInclusion()

This patch removes uses of the deprecated `DirectoryEntry::getName()` from the `ModuleMap::diagnoseHeaderInclusion()` function by using `{File,Directory}EntryRef` instead.

Reviewed By: bnbarham

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

2 years ago[COFF, ARM64] Add __break intrinsic
Pengxuan Zheng [Fri, 15 Apr 2022 21:57:40 +0000 (14:57 -0700)]
[COFF, ARM64] Add __break intrinsic

https://docs.microsoft.com/en-us/cpp/intrinsics/arm64-intrinsics?view=msvc-170

Reviewed By: rnk, mstorsjo

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

2 years agoRevert D119136 "[clang] Implement Change scope of lambda trailing-return-type" and...
Fangrui Song [Wed, 20 Apr 2022 17:57:12 +0000 (10:57 -0700)]
Revert D119136 "[clang] Implement Change scope of lambda trailing-return-type" and its follow-up

This reverts commit 69dd89fdcbd846375a45e2fe3a88710887236d7a.
This reverts commit 04000c2f928a7adc32138a664d167f01b642bef3.

The current states breaks libstdc++ usage (https://reviews.llvm.org/D119136#3455423).
The fixup has been reverted as it caused other valid code to be disallowed.
I think we should start from the clean state by reverting all relevant commits.

2 years ago[NFC] Avoid unnecessary duplication of code generating diagnostic.
Dan Liew [Tue, 19 Apr 2022 23:28:33 +0000 (16:28 -0700)]
[NFC] Avoid unnecessary duplication of code generating diagnostic.

The previous code unneccessarily duplicated the creation of a diagnostic
where the only difference was the `AssignmentAction` being passed.

rdar://88664722

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

2 years ago[LICM] Add additional writeonly tests, check attributes.
Florian Hahn [Wed, 20 Apr 2022 17:49:37 +0000 (18:49 +0100)]
[LICM] Add additional writeonly tests, check attributes.

Add additional test coverage for D123473.

2 years ago[ELF] Shrink binding and type in Symbol
Shoaib Meenai [Tue, 19 Apr 2022 20:46:04 +0000 (13:46 -0700)]
[ELF] Shrink binding and type in Symbol

STB_HIPROC and STT_HIPROC are both 15, so we can fit the symbol binding
and type in 4 bits. This gives us an additional byte to use for Symbol
flags (without increasing the type's size), which I'll be making use of
in the next diff.

Reorder type and binding based on a suggestion from @MaskRay, to
optimize st_info computation on little-endian systems (see
https://godbolt.org/z/nMn8Yar43).

Reviewed By: MaskRay

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

2 years ago[ELF] Assert on invalid GOT or PLT relocations
Shoaib Meenai [Tue, 19 Apr 2022 06:24:46 +0000 (23:24 -0700)]
[ELF] Assert on invalid GOT or PLT relocations

Because of https://llvm.org/PR50675, we can end up producing a PLT
relocation referencing a symbol that's dropped from the dynamic symbol
table, which in turn causes a crash at runtime. We ran into this again
recently, resulting in crashes for our users. A subsequent diff will fix
that issue, but add an assert to catch it if it happens again.

Reviewed By: MaskRay

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

2 years agoSpeculatively fix build bot
Aaron Ballman [Wed, 20 Apr 2022 17:39:15 +0000 (13:39 -0400)]
Speculatively fix build bot

This should fix the issue found by:
https://lab.llvm.org/buildbot/#/builders/37/builds/12606

2 years ago[AMDGPU] Regenerate lit test pattern (NFC).
Christudasan Devadasan [Tue, 19 Apr 2022 14:42:05 +0000 (20:12 +0530)]
[AMDGPU] Regenerate lit test pattern (NFC).

2 years ago[LLDB][NativePDB] Fix the case when S_DEFRANGE_SUBFIELD_REGISTERs are out of order.
Zequan Wu [Wed, 20 Apr 2022 03:11:44 +0000 (20:11 -0700)]
[LLDB][NativePDB] Fix the case when S_DEFRANGE_SUBFIELD_REGISTERs are out of order.

Previously, I was assuming that S_DEFRANGE_SUBFIELD_REGISTERs are always in the
increasing order of offset_in_parent until I saw a counter example.

Using `std::map` so that they are sorted by offset_in_parent.

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

2 years agoRevert D123909 "[Clang] Use of decltype(capture) in parameter-declaration-clause"
Fangrui Song [Wed, 20 Apr 2022 17:32:41 +0000 (10:32 -0700)]
Revert D123909 "[Clang] Use of decltype(capture) in parameter-declaration-clause"

This reverts commit daa6d7b250edb81ffef7770a71049d7af211698b.

It breaks valid code like https://reviews.llvm.org/D123909#3461716

2 years ago[C2x] Disallow functions without prototypes/functions with identifier lists
Aaron Ballman [Wed, 20 Apr 2022 17:26:38 +0000 (13:26 -0400)]
[C2x] Disallow functions without prototypes/functions with identifier lists

WG14 has elected to remove support for K&R C functions in C2x. The
feature was introduced into C89 already deprecated, so after this long
of a deprecation period, the committee has made an empty parameter list
mean the same thing in C as it means in C++: the function accepts no
arguments exactly as if the function were written with (void) as the
parameter list.

This patch implements WG14 N2841 No function declarators without
prototypes (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2841.htm)
and WG14 N2432 Remove support for function definitions with identifier
lists (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2432.pdf).

It also adds The -fno-knr-functions command line option to opt into
this behavior in other language modes.

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

2 years agoReland "[Clang][Sema] Fix invalid redefinition error in if/switch/for statement"
Jun Zhang [Wed, 20 Apr 2022 17:17:47 +0000 (01:17 +0800)]
Reland "[Clang][Sema] Fix invalid redefinition error in if/switch/for statement"

This reverts commit 9f075c3d84fb359efb6496535ab397a6f09609e2.
The broken build has alreasy been fixed in D124012, so reland it now.
Signed-off-by: Jun Zhang <jun@junz.org>
2 years ago[flang] Set LBOUND() folding for (x) expression as ones
Mike Kashkarov [Wed, 20 Apr 2022 16:53:09 +0000 (19:53 +0300)]
[flang] Set LBOUND() folding for (x) expression as ones

Set LBOUND() constant folding for parentheses expr. as ones

Array bounds should not propagate throught omitted bounds specifications or
temporary variables - fix constant folding in case of Parentheses<T> expression
by explicitly returning array of ones (or scalar in case of DIM=).

Add set of tests for (x) bounds checks (w/ and w/o 'parameter' arrays)

Reviewed By: jeanPerier

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

2 years ago[flang] Fix LBOUND() folding for constant arrays
Mike Kashkarov [Wed, 20 Apr 2022 16:47:21 +0000 (19:47 +0300)]
[flang] Fix LBOUND() folding for constant arrays

Previously constant folding uses 'dim' without checks which leads to ICE if we
do not have DIM= parameter. And for inputs without DIM= we need to form an
array of rank size with computed bounds instead of single value.

Add additional PackageConstant function to simplify 'if (dim)' handling since we
need to distinguish between scalar initialization in case of DIM= argument and
rank=1 array.

Also add a few more tests with 'parameter' type to verify folding for constant
arrays.

Reviewed By: jeanPerier

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

2 years ago[clang][dataflow] Ensure well-formed flow conditions.
Yitzhak Mandelbaum [Mon, 11 Apr 2022 19:41:42 +0000 (19:41 +0000)]
[clang][dataflow] Ensure well-formed flow conditions.

Ensure that the expressions associated with terminators are associated with a
value. Otherwise, we can generate degenerate flow conditions, where both
branches share the same condition.

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

2 years ago[clang][lex] NFCI: Use DirectoryEntryRef in FrameworkCacheEntry
Jan Svoboda [Wed, 20 Apr 2022 16:55:58 +0000 (18:55 +0200)]
[clang][lex] NFCI: Use DirectoryEntryRef in FrameworkCacheEntry

This patch changes the member of `FrameworkCacheEntry` from `const DirectoryEntry *` to `Optional<DirectoryEntryRef>` in order to remove uses of the deprecated `DirectoryEntry::getName()`.

Reviewed By: bnbarham

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

2 years ago[clang] NFCI: Use DirectoryEntryRef in FrontendAction::BeginSourceFile()
Jan Svoboda [Wed, 20 Apr 2022 16:54:36 +0000 (18:54 +0200)]
[clang] NFCI: Use DirectoryEntryRef in FrontendAction::BeginSourceFile()

This patch removes use of the deprecated `DirectoryEntry::getName()` from `FrontendAction::BeginSourceFile()`.

Reviewed By: bnbarham

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

2 years ago[clang][lex] NFCI: Use DirectoryEntryRef in HeaderSearch::load*()
Jan Svoboda [Wed, 20 Apr 2022 16:52:24 +0000 (18:52 +0200)]
[clang][lex] NFCI: Use DirectoryEntryRef in HeaderSearch::load*()

This patch removes uses of the deprecated `DirectoryEntry::getName()` from `HeaderSearch::load*()` functions by using `DirectoryEntryRef` instead.

Note that we bail out in one case and use the also deprecated `FileEntry::getLastRef()`. That's to prevent this patch from growing, and is addressed in a follow-up.

Reviewed By: bnbarham

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

2 years ago[DAG]Introduce llvm::processShuffleMasks and use it for shuffles in DAG Type Legalizer.
Alexey Bataev [Mon, 13 Dec 2021 18:38:28 +0000 (10:38 -0800)]
[DAG]Introduce llvm::processShuffleMasks and use it for shuffles in DAG Type Legalizer.

We can process the long shuffles (working across several actual
vector registers) in the best way if we take the actual register
represantion into account. We can build more correct representation of
register shuffles, improve number of recognised buildvector sequences.
Also, same function can be used to improve the cost model for the
shuffles. in future patches.

Part of D100486

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

2 years agoSpeculatively fix build bot
Aaron Ballman [Wed, 20 Apr 2022 16:32:14 +0000 (12:32 -0400)]
Speculatively fix build bot

This should address the issue in:
https://lab.llvm.org/buildbot/#/builders/77/builds/16683

2 years ago[InstCombine] Don't look through bitcast from vector in collectInsertionElements.
Craig Topper [Wed, 20 Apr 2022 16:05:35 +0000 (09:05 -0700)]
[InstCombine] Don't look through bitcast from vector in collectInsertionElements.

We're making a recursive call here and everything in the function
assumes we're looking at scalars. This would be violated if we
looked through a bitcast from vectors.

Reviewed By: spatel

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

2 years ago[InstCombine] Pre-commit test for D124015
Craig Topper [Wed, 20 Apr 2022 16:05:28 +0000 (09:05 -0700)]
[InstCombine] Pre-commit test for D124015

Reviewed By: spatel

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

2 years ago[InstCombine] Fold mul nuw+lshr to a single multiplication when the latter is a factor
chenglin.bi [Wed, 20 Apr 2022 15:51:34 +0000 (23:51 +0800)]
[InstCombine] Fold mul nuw+lshr to a single multiplication when the latter is a factor

if c is divisible by (1 << ShAmtC), we can fold this pattern:
lshr (mul nuw x, c), ShAmtC -> mul nuw x, (c >> ShAmtC)

https://alive2.llvm.org/ce/z/ox4wAt

Fix https://github.com/llvm/llvm-project/issues/54824

Reviewed By: spatel, lebedev.ri, craig.topper

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

2 years agoSpeculatively fix build bots
Aaron Ballman [Wed, 20 Apr 2022 16:05:33 +0000 (12:05 -0400)]
Speculatively fix build bots

This should address the issue found in:
https://lab.llvm.org/buildbot/#/builders/215/builds/4610

2 years agoSpeculatively fix build bots
Aaron Ballman [Wed, 20 Apr 2022 16:02:16 +0000 (12:02 -0400)]
Speculatively fix build bots

This should address the issues found by:
https://lab.llvm.org/buildbot/#/builders/105/builds/24292

2 years agoRemoving some ancient, unused testing functionality
Aaron Ballman [Wed, 20 Apr 2022 15:55:27 +0000 (11:55 -0400)]
Removing some ancient, unused testing functionality

This was last touched 13 years ago in
https://github.com/llvm/llvm-project/commit/7a1095f243e393d40ed9b9cee17fd091a13f2947
and is no longer being maintained.

2 years ago[PS5][NFC] Fix a test with a misplaced -x option
Paul Robinson [Wed, 20 Apr 2022 15:56:38 +0000 (08:56 -0700)]
[PS5][NFC] Fix a test with a misplaced -x option

2 years agoSpeculatively fix build bots
Aaron Ballman [Wed, 20 Apr 2022 15:46:35 +0000 (11:46 -0400)]
Speculatively fix build bots

This should address build failures found in:

https://lab.llvm.org/buildbot/#/builders/217/builds/3610
https://lab.llvm.org/buildbot/#/builders/215/builds/4609
https://lab.llvm.org/buildbot/#/builders/68/builds/31012

2 years agoRevert "[Clang][Sema] Fix invalid redefinition error in if/switch/for statement"
Jun Zhang [Wed, 20 Apr 2022 15:43:21 +0000 (23:43 +0800)]
Revert "[Clang][Sema] Fix invalid redefinition error in if/switch/for statement"

This reverts commit be0905a333d6f7c4d7f5c70c18211463e53473cd.
This patch broke build addressed in https://github.com/llvm/llvm-project/issues/54968
Signed-off-by: Jun Zhang <jun@junz.org>
2 years ago[clang-format] Don't skip PP lines if original line was a PP line when trying to...
Arthur Eubanks [Tue, 19 Apr 2022 20:02:54 +0000 (13:02 -0700)]
[clang-format] Don't skip PP lines if original line was a PP line when trying to merge lines

Fixes a crash introduced in D123737 where LastNonComment would be null.

Reviewed By: curdeius

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

2 years ago[libc] Add GNU extention functions fread_unlocked and fwrite_unlocked.
Siva Chandra Reddy [Tue, 19 Apr 2022 07:36:43 +0000 (07:36 +0000)]
[libc] Add GNU extention functions fread_unlocked and fwrite_unlocked.

POSIX locking and unlocking functions flockfile and funlockfile have
also been added. The locking is not recursive yet. A future patch will
make the underlying lock a recursive lock.

Reviewed By: lntue

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

2 years agoUpdate the developer policy to mention release notes
Aaron Ballman [Wed, 20 Apr 2022 15:34:05 +0000 (11:34 -0400)]
Update the developer policy to mention release notes

As a project, Clang has gotten negative public feedback about our lack
of communicating changes to users. There are comments on places like
Hacker News or Reddit where users have (rightfully) been confused as to
what changes happen in a given release, leading to misinformation like
Clang not adding support for C++20 features:
https://news.ycombinator.com/item?id=28761464.

This documents the expectation that changes which impact users should
have release notes, and it's normal for code reviewers to ask an author
to add a release note for a given change.

This addresses: https://github.com/llvm/llvm-project/issues/54965

RFC: https://discourse.llvm.org/t/rfc-update-developer-policy-on-release-notes/61856

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

2 years ago[PS4][NFC] Rename classes to align with prevailing practice
Paul Robinson [Wed, 20 Apr 2022 15:35:17 +0000 (08:35 -0700)]
[PS4][NFC] Rename classes to align with prevailing practice

Rename classes Assemble -> Assembler, Link -> Linker,
for consistency with names other toolchains use.

2 years ago[libc][docs] Update the fuzzing doc to better reflect the current state.
Siva Chandra Reddy [Mon, 18 Apr 2022 07:29:17 +0000 (07:29 +0000)]
[libc][docs] Update the fuzzing doc to better reflect the current state.

Reviewed By: lntue

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

2 years ago[C11/C2x] Change the behavior of the implicit function declaration warning
Aaron Ballman [Wed, 20 Apr 2022 15:25:35 +0000 (11:25 -0400)]
[C11/C2x] Change the behavior of the implicit function declaration warning

C89 had a questionable feature where the compiler would implicitly
declare a function that the user called but was never previously
declared. The resulting function would be globally declared as
extern int func(); -- a function without a prototype which accepts zero
or more arguments.

C99 removed support for this questionable feature due to severe
security concerns. However, there was no deprecation period; C89 had
the feature, C99 didn't. So Clang (and GCC) both supported the
functionality as an extension in C99 and later modes.

C2x no longer supports that function signature as it now requires all
functions to have a prototype, and given the known security issues with
the feature, continuing to support it as an extension is not tenable.

This patch changes the diagnostic behavior for the
-Wimplicit-function-declaration warning group depending on the language
mode in effect. We continue to warn by default in C89 mode (due to the
feature being dangerous to use). However, because this feature will not
be supported in C2x mode, we've diagnosed it as being invalid for so
long, the security concerns with the feature, and the trivial
workaround for users (declare the function), we now default the
extension warning to an error in C99-C17 mode. This still gives users
an easy workaround if they are extensively using the extension in those
modes (they can disable the warning or use -Wno-error to downgrade the
error), but the new diagnostic makes it more clear that this feature is
not supported and should be avoided. In C2x mode, we no longer allow an
implicit function to be defined and treat the situation the same as any
other lookup failure.

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

2 years ago[InstCombine] remove likely redundant ValueTracking-based folds for shifts
Sanjay Patel [Wed, 20 Apr 2022 15:10:21 +0000 (11:10 -0400)]
[InstCombine] remove likely redundant ValueTracking-based folds for shifts

This is not expected to have a functional difference as discussed in the
post-commit comments for 8a9c70fc01e6. All of the motivating tests for
the older fold still optimize as expected because other code can infer
the 'nuw'.

2 years agoMachineModuleInfo: Move AddrLabelSymbols to AsmPrinter
Matt Arsenault [Sun, 17 Apr 2022 21:11:48 +0000 (17:11 -0400)]
MachineModuleInfo: Move AddrLabelSymbols to AsmPrinter

This was tracking global state only used by the AsmPrinter, which can
store its own module global state.

2 years ago[clang-tidy] Reduce false positives for `bugprone-infinite-loop` with dependent expre...
Fabian Wolff [Wed, 20 Apr 2022 15:15:19 +0000 (17:15 +0200)]
[clang-tidy] Reduce false positives for `bugprone-infinite-loop` with dependent expressions

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

Reviewed By: aaron.ballman

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

2 years agoMachineModuleInfo: Remove UsesMorestackAddr
Matt Arsenault [Sun, 17 Apr 2022 19:45:20 +0000 (15:45 -0400)]
MachineModuleInfo: Remove UsesMorestackAddr

This is x86 specific, and adds statefulness to
MachineModuleInfo. Instead of explicitly tracking this, infer if we
need to declare the symbol based on the reference previously inserted.

This produces a small change in the output due to the move from
AsmPrinter::doFinalization to X86's emitEndOfAsmFile. This will now be
moved relative to other end of file fields, which I'm assuming doesn't
matter (e.g. the __morestack_addr declaration is now after the
.note.GNU-split-stack part)

This also produces another small change in code if the module happened
to define/declare __morestack_addr, but I assume that's invalid and
doesn't really matter.

2 years ago[clang-tidy] Fix `readability-container-size-empty` check for smart pointers
Fabian Wolff [Wed, 20 Apr 2022 15:03:30 +0000 (17:03 +0200)]
[clang-tidy] Fix `readability-container-size-empty` check for smart pointers

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

Reviewed By: Sockke

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

2 years ago[clang-tidy] Fix `altera-struct-pack-align` check for empty structs
Fabian Wolff [Wed, 20 Apr 2022 14:52:23 +0000 (16:52 +0200)]
[clang-tidy] Fix `altera-struct-pack-align` check for empty structs

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

Reviewed By: whisperity, aaron.ballman

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

2 years agoMachineModuleInfo: Move HasSplitStack handling to AsmPrinter
Matt Arsenault [Sun, 17 Apr 2022 14:47:38 +0000 (10:47 -0400)]
MachineModuleInfo: Move HasSplitStack handling to AsmPrinter

This is used to emit one field in doFinalization for the module. We
can accumulate this when emitting all individual functions directly in
the AsmPrinter, rather than accumulating additional state in
MachineModuleInfo.

Move the special case behavior predicate into MachineFrameInfo to
share it. This now promotes it to generic behavior. I'm assuming this
is fine because no other target implements adjustForSegmentedStacks,
or has tests using the split-stack attribute.

2 years ago[mlir][tensor] Promote extract(from_elements(...)) to folding pattern
Matthias Springer [Wed, 20 Apr 2022 14:42:33 +0000 (23:42 +0900)]
[mlir][tensor] Promote extract(from_elements(...)) to folding pattern

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

2 years ago[bazel] Port f26c41e8dd28
Benjamin Kramer [Wed, 20 Apr 2022 14:15:09 +0000 (16:15 +0200)]
[bazel] Port f26c41e8dd28

2 years ago[X86][AVX512] Rename avx512popcntdq intrinsics tests files to match *-builtins.c...
Simon Pilgrim [Wed, 20 Apr 2022 14:12:05 +0000 (15:12 +0100)]
[X86][AVX512] Rename avx512popcntdq intrinsics tests files to match *-builtins.c naming convention

2 years ago[X86][AVX] Add i386 test coverage to avx2 intrinsic tests
Simon Pilgrim [Wed, 20 Apr 2022 14:08:29 +0000 (15:08 +0100)]
[X86][AVX] Add i386 test coverage to avx2 intrinsic tests

2 years ago[X86][AVX] Add i386 test coverage to avx-vnni intrinsic tests
Simon Pilgrim [Wed, 20 Apr 2022 13:52:27 +0000 (14:52 +0100)]
[X86][AVX] Add i386 test coverage to avx-vnni intrinsic tests

2 years ago[X86][AVX] Add i386 test coverage to avx intrinsic tests
Simon Pilgrim [Wed, 20 Apr 2022 13:52:00 +0000 (14:52 +0100)]
[X86][AVX] Add i386 test coverage to avx intrinsic tests

2 years ago[SimplifyCFG] Remove one-use limitation in FoldCondBranchOnPHI()
Nikita Popov [Wed, 20 Apr 2022 13:54:56 +0000 (15:54 +0200)]
[SimplifyCFG] Remove one-use limitation in FoldCondBranchOnPHI()

BlockIsSimpleEnoughToThreadThrough() already checks that the phi
(and all other instructions) are not used outside the block, so
this one-use check is not necessary for legality. I also don't
see any reason why it would be necessary for profitability (in
fact, those extra uses will be replaced with constants, which
should be generally profitable).

2 years agollvm-reduce: Clone properties of blocks
Matt Arsenault [Thu, 14 Apr 2022 15:29:01 +0000 (11:29 -0400)]
llvm-reduce: Clone properties of blocks

getSuccProbability was private for some reason, saying to go through
MachineBranchProbabilityInfo. There doesn't seem to be much point to
that, as that wrapper directly calls this.

Like other areas, some of these fields aren't handled by the MIR
printer/parser so aren't tested.

2 years ago[AMDGPU] Fix crash in SIOptimizeExecMaskingPreRA
Jay Foad [Wed, 30 Mar 2022 15:26:47 +0000 (16:26 +0100)]
[AMDGPU] Fix crash in SIOptimizeExecMaskingPreRA

When folding a COPY of exec into another COPY, the call to
TII->isOperandLegal would crash because COPYs don't have defined
register classes for their operands.

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

2 years ago[clang][Sema] Fix typo in checkBuiltinArgument helper
Alex Bradbury [Wed, 20 Apr 2022 13:28:42 +0000 (14:28 +0100)]
[clang][Sema] Fix typo in checkBuiltinArgument helper

The checkBuiltinArgument helper takes an integer ArgIndex and is
documented as performing normal type-checking on that argument. However,
it mistakenly hardcodes the argument index to zero when retrieving the
argument from the call expression.

This hadn't been noticed previously as all in-tree uses typecheck the
0th argument anyway.

2 years ago[clangd] Handle the new Using TemplateName.
Haojian Wu [Wed, 6 Apr 2022 11:03:21 +0000 (13:03 +0200)]
[clangd] Handle the new Using TemplateName.

Add supports in FindTarget and IncludeCleaner. This would
improve AST-based features on a tempalte which is found via a using
declaration. For example, go-to-def on `vect^or<int> v;` gives us the
location of `using std::vector`, which was not previously.

Base on https://reviews.llvm.org/D123127

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

2 years ago[SimplifyCFG] Add additional threading tests (NFC)
Nikita Popov [Wed, 20 Apr 2022 12:15:01 +0000 (14:15 +0200)]
[SimplifyCFG] Add additional threading tests (NFC)

2 years agoRevert "[DAG]Introduce llvm::processShuffleMasks and use it for shuffles in DAG Type...
Alexey Bataev [Wed, 20 Apr 2022 13:18:52 +0000 (06:18 -0700)]
Revert "[DAG]Introduce llvm::processShuffleMasks and use it for shuffles in DAG Type Legalizer."

This reverts commit 2f49163b3365e5dc046b03e422a048dd45aee3f0 to fix
a buildbot failure. Reported in https://lab.llvm.org/buildbot#builders/105/builds/24284

2 years ago[Clang] Fix references to captured variables in dependant context.
Corentin Jabot [Tue, 19 Apr 2022 13:16:51 +0000 (15:16 +0200)]
[Clang] Fix references to captured variables in dependant context.

D119136 changed how captures are handled in a lambda call operator
declaration, but did not properly handled dependant context,
which led to crash when refering to init-captures in
a trailing return type.

We fix that bug by making transformations more symetric with parsing,
ie. we first create the call operator, then transform the capture,
then compute the type of the lambda call operaror.

This ensures captures exist and have the right type when
we parse a trailing requires-clause / return type.

Reviewed By: aaron.ballman

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

2 years agoLocalStackSlotAllocation: Combine debug printing statements
Matt Arsenault [Wed, 20 Apr 2022 13:15:23 +0000 (09:15 -0400)]
LocalStackSlotAllocation: Combine debug printing statements

2 years agoLocalStackSlotAllocation: Stop creating unused virtual register
Matt Arsenault [Wed, 20 Apr 2022 13:13:43 +0000 (09:13 -0400)]
LocalStackSlotAllocation: Stop creating unused virtual register

2 years agollvm-reduce: Fix sources with executable permission
Matt Arsenault [Wed, 20 Apr 2022 02:55:02 +0000 (22:55 -0400)]
llvm-reduce: Fix sources with executable permission

2 years ago[gn build] (manually) port f26c41e8dd28 (lib/clang/Support)
Nico Weber [Wed, 20 Apr 2022 13:28:04 +0000 (09:28 -0400)]
[gn build] (manually) port f26c41e8dd28 (lib/clang/Support)

2 years ago[compiler-rt][sanitizers] build ubsan, asan etc libraries with Mac Catalyst support
Nico Weber [Wed, 20 Apr 2022 02:45:16 +0000 (22:45 -0400)]
[compiler-rt][sanitizers] build ubsan, asan etc libraries with Mac Catalyst support

Like D118875, but for ubsan, asan, etc.

With this, I can successfully run:

    bin/clang++ -target x86_64-apple-ios14.0-macabi foo.cc \
        -isysroot $(xcrun -show-sdk-path) -fsanitize=undefined

with a locally built libclang_rt.ubsan_osx_dynamic.dylib.

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

2 years ago[X86] Add multiuse all_of test case for D123652
Simon Pilgrim [Wed, 20 Apr 2022 13:18:46 +0000 (14:18 +0100)]
[X86] Add multiuse all_of test case for D123652

2 years ago[mlir][linalg] Add ods-gen helper to simplify the build methods.
gysit [Wed, 20 Apr 2022 13:13:30 +0000 (13:13 +0000)]
[mlir][linalg] Add ods-gen helper to simplify the build methods.

Add a helper used to implement the build methods generated by ods-gen. The change reduces code size and compilation time since all structured op builders use the same build method. The change reduces the LinalgOps.cpp compilation time from 10.2s to 9.8s (debug build).

Depends On D123987

Reviewed By: nicolasvasilache

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

2 years ago[RISCV] Moving RVV intrinsic type related util to clang/Support
Kito Cheng [Thu, 14 Apr 2022 09:35:58 +0000 (17:35 +0800)]
[RISCV] Moving RVV intrinsic type related util to clang/Support

We add a new clang library called `clangSupport` for putting those utils which can be used in clang table-gen and other clang component.

We tried to put that into `llvm/Support`, but actually those stuffs only used in clang* and clang-tblgen, so I think that might be better to create `clang/Support`

* clang will used that in https://reviews.llvm.org/D111617.

Reviewed By: khchen, MaskRay, aaron.ballman

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

2 years ago[mlir][linalg] Avoid template methods for parsing and printing.
gysit [Wed, 20 Apr 2022 13:05:47 +0000 (13:05 +0000)]
[mlir][linalg] Avoid template methods for parsing and printing.

The revision avoids template methods for parsing and printing that are replicated for every named operation. Instead, the new methods take a regionBuilder argument. The revision reduces the compile time of LinalgOps.cpp from 11.2 to 10.2 seconds (debug build).

Reviewed By: nicolasvasilache

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

2 years ago[DAG]Introduce llvm::processShuffleMasks and use it for shuffles in DAG Type Legalizer.
Alexey Bataev [Mon, 13 Dec 2021 18:38:28 +0000 (10:38 -0800)]
[DAG]Introduce llvm::processShuffleMasks and use it for shuffles in DAG Type Legalizer.

We can process the long shuffles (working across several actual
vector registers) in the best way if we take the actual register
represantion into account. We can build more correct representation of
register shuffles, improve number of recognised buildvector sequences.
Also, same function can be used to improve the cost model for the
shuffles. in future patches.

Part of D100486

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

2 years ago[MLIR] NFC. Drop trailing white space in GPU async ops print
Uday Bondhugula [Wed, 20 Apr 2022 12:26:35 +0000 (17:56 +0530)]
[MLIR] NFC. Drop trailing white space in GPU async ops print

NFC. Drop trailing end of line white space in GPU async ops' printer
whenever the list of async deps is empty.

Reviewed By: mehdi_amini, rriddle

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

2 years ago[OpenMP] Add triple to the linker wrapper job
Joseph Huber [Wed, 20 Apr 2022 12:23:07 +0000 (08:23 -0400)]
[OpenMP] Add triple to the linker wrapper job

Summary:
I forgot to add the triple to the linker wrapper job, so we were still
generating code for the unintended platforms.

2 years agoAdd RegionBranchOpInterface on affine.for op
Uday Bondhugula [Wed, 20 Apr 2022 11:17:12 +0000 (16:47 +0530)]
Add RegionBranchOpInterface on affine.for op

Add RegionBranchOpInterface on affine.for op so that transforms relying
on RegionBranchOpInterface can support affine.for. E.g.:
buffer-deallocation pass.

Reviewed By: herhut

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

2 years ago[AMDGPU] Simplify calls to getDefSrcRegIgnoringCopies. NFC.
Jay Foad [Wed, 20 Apr 2022 11:37:02 +0000 (12:37 +0100)]
[AMDGPU] Simplify calls to getDefSrcRegIgnoringCopies. NFC.

getDefSrcRegIgnoringCopies never returns None on valid MIR.

2 years ago[Testing] Drop clangTesting from clang's public library interface
Sam McCall [Tue, 12 Apr 2022 14:27:11 +0000 (16:27 +0200)]
[Testing] Drop clangTesting from clang's public library interface

This was probably not particularly intended to be public, and disallows deps
on gtest which are useful in test helpers.

https://discourse.llvm.org/t/stop-exporting-clangtesting-library/61672

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

2 years ago[OpenMP] Add explicit triple to linker wrapper test
Joseph Huber [Wed, 20 Apr 2022 11:24:51 +0000 (07:24 -0400)]
[OpenMP] Add explicit triple to linker wrapper test

Summary:
Some platforms like Mach-O require different handling of section names.
This is not supported on Mac-OS or Windows yet so we shouldn't be
testing the compilation there. Add an explicit triple to the tests.

2 years ago[AMDGPU] Add GlobalISel checks for flat scratch SVS addressing
Jay Foad [Wed, 20 Apr 2022 11:03:44 +0000 (12:03 +0100)]
[AMDGPU] Add GlobalISel checks for flat scratch SVS addressing

Note that GlobalISel does not actually use the SVS addressing mode
for these cases yet because it chooses the VGPR bank for
G_FRAME_INDEX; see the TODO comment in
AMDGPURegisterBankInfo::getInstrMapping.

2 years ago[X86][SSE] Add i386 test coverage to sse2 intrinsic tests
Simon Pilgrim [Wed, 20 Apr 2022 11:05:05 +0000 (12:05 +0100)]
[X86][SSE] Add i386 test coverage to sse2 intrinsic tests

2 years ago[AMDGPU][GlobalISel] Force return atomic selection for now
Abinav Puthan Purayil [Tue, 19 Apr 2022 17:44:43 +0000 (23:14 +0530)]
[AMDGPU][GlobalISel] Force return atomic selection for now

2 years ago[Support] Remove unused LLVM_PTR_SIZE macro
Nikita Popov [Wed, 20 Apr 2022 10:25:41 +0000 (12:25 +0200)]
[Support] Remove unused LLVM_PTR_SIZE macro

This was used for LLVM_ALIGNAS() arguments in the past, but has
since been superseded by plain alignas() which also accepts a type.

2 years ago[Support] Remove LLVM_ATTRIBUTE_DEPRECATED
Nikita Popov [Wed, 20 Apr 2022 10:16:41 +0000 (12:16 +0200)]
[Support] Remove LLVM_ATTRIBUTE_DEPRECATED

The guidance since D94219 is to use [[deprecated]] directly. Now
that all historical uses of the macro have been removed, drop the
macro itself.

2 years ago[DomTreeUpdater] Remove deprecated methods
Nikita Popov [Wed, 20 Apr 2022 10:13:22 +0000 (12:13 +0200)]
[DomTreeUpdater] Remove deprecated methods

Remove the insertEdge(), insertEdgeRelaxed(), deleteEdge() and
deleteEdgeRelaxed() methods, which have been deprecated three
years ago.

2 years ago[X86][FMA4] Add i386 test coverage to fma4 intrinsic tests
Simon Pilgrim [Wed, 20 Apr 2022 10:13:44 +0000 (11:13 +0100)]
[X86][FMA4] Add i386 test coverage to fma4 intrinsic tests

2 years ago[IRBuilder] Remove deprecated CreateShuffleVector() method
Nikita Popov [Wed, 20 Apr 2022 10:08:40 +0000 (12:08 +0200)]
[IRBuilder] Remove deprecated CreateShuffleVector() method

This method has been deprecated for two years.

2 years ago[X86][SSE] Add i386 test coverage to sse42 intrinsic tests
Simon Pilgrim [Wed, 20 Apr 2022 10:05:55 +0000 (11:05 +0100)]
[X86][SSE] Add i386 test coverage to sse42 intrinsic tests

2 years ago[X86][SSE] Add i386 test coverage to sse41 intrinsic tests
Simon Pilgrim [Wed, 20 Apr 2022 10:05:34 +0000 (11:05 +0100)]
[X86][SSE] Add i386 test coverage to sse41 intrinsic tests

2 years ago[OpenCL] Add missing __opencl_c_atomic_scope_device guards
Sven van Haastregt [Wed, 20 Apr 2022 10:02:50 +0000 (11:02 +0100)]
[OpenCL] Add missing __opencl_c_atomic_scope_device guards

Update opencl-c.h after the specification clarification in
https://github.com/KhronosGroup/OpenCL-Docs/pull/775

2 years ago[IR] Deprecate Type::getPointerElementType() (NFC)
Nikita Popov [Wed, 20 Apr 2022 09:55:40 +0000 (11:55 +0200)]
[IR] Deprecate Type::getPointerElementType() (NFC)

There are no more in-tree users of this method, outside the
experimental SPIRV backend.

2 years ago[ScopBuilder] Avoid pointer element type access
Nikita Popov [Wed, 20 Apr 2022 09:50:58 +0000 (11:50 +0200)]
[ScopBuilder] Avoid pointer element type access

Rather than checking the bitcast pointer element types, compare
the element type of the access and the GEP result type.

The entire code is dubious due to the inspection of GEP structure,
but this at least preserves the spirit of the existing code.

2 years ago[mlir][bufferize] Fix missing copies when writing to a buffer in a loop
Matthias Springer [Wed, 20 Apr 2022 09:43:49 +0000 (18:43 +0900)]
[mlir][bufferize] Fix missing copies when writing to a buffer in a loop

Writes into tensors that are definied outside of a repetitive region, but with the write happening inside of the repetitive region were previously not considered conflicts. This was incorrect.

E.g.:
```
%0 = ... : tensor<?xf32>
scf.for ... {
  "reading_op"(%0) : tensor<?xf32>
  %1 = "writing_op"(%0) : tensor<?xf32> -> tensor<?xf32>
  ...
}
```

In the above example, "writing_op" should be out-of-place.

This commit fixes the bufferization for any op that declares its repetitive semantics via RegionBranchOpInterface.

2 years ago[X86][SSE] Add i386 test coverage to sse4a intrinsic tests
Simon Pilgrim [Wed, 20 Apr 2022 09:48:47 +0000 (10:48 +0100)]
[X86][SSE] Add i386 test coverage to sse4a intrinsic tests

2 years ago[X86][SSE] Add i386 test coverage to ssse3 intrinsic tests
Simon Pilgrim [Wed, 20 Apr 2022 09:41:39 +0000 (10:41 +0100)]
[X86][SSE] Add i386 test coverage to ssse3 intrinsic tests

2 years ago[X86][SSE] Add i386 test coverage to sse3 intrinsic tests
Simon Pilgrim [Wed, 20 Apr 2022 09:41:09 +0000 (10:41 +0100)]
[X86][SSE] Add i386 test coverage to sse3 intrinsic tests

2 years ago[XOP] Add i386 test coverage to xop intrinsic tests
Simon Pilgrim [Wed, 20 Apr 2022 09:39:53 +0000 (10:39 +0100)]
[XOP] Add i386 test coverage to xop intrinsic tests

2 years ago[mlir][docs] Add missing parentheses in example code on walkers.
Ingo Müller [Tue, 19 Apr 2022 13:21:16 +0000 (13:21 +0000)]
[mlir][docs] Add missing parentheses in example code on walkers.

`getFunction` was missing parentheses.

Reviewed By: ftynse, mehdi_amini

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

2 years ago[PowerPC] add XLC compat builtin __abs
Chen Zheng [Wed, 20 Apr 2022 09:14:22 +0000 (05:14 -0400)]
[PowerPC] add XLC compat builtin __abs

Reviewed By: jsji

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

2 years ago[Test] One more test with potentially malformed phis
Max Kazantsev [Wed, 20 Apr 2022 08:49:54 +0000 (15:49 +0700)]
[Test] One more test with potentially malformed phis

2 years ago[NFC] Return correct PreservedAnalysis for CoroEarly
Chuanqi Xu [Wed, 20 Apr 2022 08:29:52 +0000 (16:29 +0800)]
[NFC] Return correct PreservedAnalysis for CoroEarly

This is a fix for previous typo. It makes no sense to return
PreservedAnalyses::all() if anything is change. This change simplify
codes further.

2 years ago[RISCV][Clang][NFC] Update vid intrinsic tests.
Zakk Chen [Wed, 20 Apr 2022 03:20:09 +0000 (20:20 -0700)]
[RISCV][Clang][NFC] Update vid intrinsic tests.

Re-run the update_cc_test_checks.py to update expected result.
I'm not sure why those tests are passed before.

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