platform/upstream/llvm.git
2 years ago[InstCombine] add tests for shift-of-add with constants; NFC
Sanjay Patel [Tue, 19 Apr 2022 18:48:51 +0000 (14:48 -0400)]
[InstCombine] add tests for shift-of-add with constants; NFC

2 years ago[ASan] Removed checks if the tested functions were emitted.
Kirill Stoimenov [Tue, 19 Apr 2022 19:00:41 +0000 (19:00 +0000)]
[ASan] Removed checks if the tested functions were emitted.

Reviewed By: eugenis

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

2 years ago[NFC][SLP] Improved description of getShallowScore() and getScoreAtLevelRec()
Vasileios Porpodas [Tue, 19 Apr 2022 17:59:55 +0000 (10:59 -0700)]
[NFC][SLP] Improved description of getShallowScore() and getScoreAtLevelRec()

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

2 years ago[CUDA][HIP] Fix delete operator for -fopenmp
Yaxun (Sam) Liu [Tue, 19 Apr 2022 02:21:47 +0000 (22:21 -0400)]
[CUDA][HIP] Fix delete operator for -fopenmp

When new operator is called in OpenMP parallel region,
delete operator is resolved and checked. Due to similar
issue fixed by https://reviews.llvm.org/D121765,
when resolving delete operator, the caller was not
determined correctly, which results in error as
shown in https://godbolt.org/z/jKhd8qKos.

This patch fixes the issue in a similar way as
https://reviews.llvm.org/D121765

Reviewed by: Artem Belevich

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

2 years ago[IRSim] Ignore debug instructions when creating canonical numbering
Andrew Litteken [Sat, 16 Apr 2022 21:11:39 +0000 (16:11 -0500)]
[IRSim] Ignore debug instructions when creating canonical numbering

When constructing canonical relationships between two regions, the first instruction of a basic block from the first region is used to find the corresponding basic block from the second region. However, debug instructions are not included in similarity matching, and therefore do not have a canonical numbering. This patch makes sure to ignore the debug instructions when finding the first instruction in a basic block.

Reviewer: paquette

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

2 years ago[Go] Remove PopulateLTOPassManager binding after D123882
Fangrui Song [Tue, 19 Apr 2022 18:16:27 +0000 (11:16 -0700)]
[Go] Remove PopulateLTOPassManager binding after D123882

2 years ago[compiler-rt] Use ld64 flag -lto_library instead of DYLD_LIBRARY_PATH
Nico Weber [Tue, 19 Apr 2022 17:29:44 +0000 (13:29 -0400)]
[compiler-rt] Use ld64 flag -lto_library instead of DYLD_LIBRARY_PATH

Makes

 bin/llvm-lit \
  projects/compiler-rt/test/profile/Profile-arm64/instrprof-darwin-dead-strip.c

pass on my machine.

Without this change, ld64 complains that the bitcode was generated by LLVM 15
while the reader is 13.1 -- the version of Xcode on my machine. Looks like the
DYLD_LIBRARY_PATH technique isn't working.

-lto_library was added back in ld64-136, which was in Xcode 4.6, which was
released over 10 years ago. So relying on it should be safe by now.

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

2 years agoPrint custom assembly on pass failure by default
Mehdi Amini [Tue, 19 Apr 2022 17:26:33 +0000 (17:26 +0000)]
Print custom assembly on pass failure by default

The printer is now resilient to invalid IR and will already automatically
fallback to the generic form on invalid IR. Using the generic printer on
pass failure was a conservative option before the printer was made
failsafe.

Reviewed By: lattner, rriddle, jpienaar, bondhugula

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

2 years ago[clangd] Dont include version string in update tasks
Kadir Cetinkaya [Tue, 19 Apr 2022 16:21:03 +0000 (18:21 +0200)]
[clangd] Dont include version string in update tasks

This increases cardinality of span latency metrics. Currently this was
being shown to the user via file status updates as `Running Update (x)` after
this change we'll only display `Running Update`. This also affects logs in case
of a crash, but contents and version number for inputs are printed separately in
that case already.

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

2 years agoApply clang-tidy fixes for llvm-qualified-auto in OpenMPToLLVMIRTranslation.cpp ...
Mehdi Amini [Sat, 16 Apr 2022 08:20:41 +0000 (08:20 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in OpenMPToLLVMIRTranslation.cpp (NFC)

2 years agoApply clang-tidy fixes for performance-unnecessary-value-param in ControlFlowInterfac...
Mehdi Amini [Sat, 16 Apr 2022 08:06:25 +0000 (08:06 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in ControlFlowInterfaces.cpp (NFC)

2 years ago[InstCombine] add tests for freeze of partial undef vector constants; NFC
Sanjay Patel [Mon, 18 Apr 2022 20:45:25 +0000 (16:45 -0400)]
[InstCombine] add tests for freeze of partial undef vector constants; NFC

2 years ago[OCaml] Fix pass builder test
Nikita Popov [Tue, 19 Apr 2022 16:34:31 +0000 (18:34 +0200)]
[OCaml] Fix pass builder test

The LTO API has been removed.

2 years ago[Test] Add more tests showing duplicate PHIs generated by RS4GC (NFC)
Dmitry Makogon [Tue, 19 Apr 2022 15:53:57 +0000 (22:53 +0700)]
[Test] Add more tests showing duplicate PHIs generated by RS4GC (NFC)

This adds more tests with derived pointers.

2 years ago[PPCGCodeGeneration] Look for function instead of function pointer type
Nikita Popov [Tue, 19 Apr 2022 15:59:34 +0000 (17:59 +0200)]
[PPCGCodeGeneration] Look for function instead of function pointer type

What this code is actually interested in are references to functions.
Use of a function pointer type is being used as an imprecise proxy
for that.

2 years ago[PPCGCodeGeneration] Avoid another pointer element type access
Nikita Popov [Tue, 19 Apr 2022 15:25:47 +0000 (17:25 +0200)]
[PPCGCodeGeneration] Avoid another pointer element type access

Use an API that returns both the address and the element type,
and use that for the load type.

2 years ago[PerfectShuffle] Remove unused variables from D123386. NFC
David Green [Tue, 19 Apr 2022 15:22:04 +0000 (16:22 +0100)]
[PerfectShuffle] Remove unused variables from D123386. NFC

2 years ago[VPlan] Remove unused SCEV forward declaration (NFC).
Florian Hahn [Tue, 19 Apr 2022 15:16:17 +0000 (17:16 +0200)]
[VPlan] Remove unused SCEV forward declaration (NFC).

2 years ago[PPCGCodeGeneration] Avoid pointer element type access
Nikita Popov [Tue, 19 Apr 2022 15:09:11 +0000 (17:09 +0200)]
[PPCGCodeGeneration] Avoid pointer element type access

Pass through the ArrayTy instead.

2 years ago[ASan] Fixed a reporting bug in (load|store)N functions which would print unknown...
Kirill Stoimenov [Mon, 18 Apr 2022 23:36:06 +0000 (23:36 +0000)]
[ASan] Fixed a reporting bug in (load|store)N functions which would print unknown-crash instead of the proper error message when a the data access is unaligned.

Reviewed By: kda, eugenis

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

2 years ago[SystemZ] Handle SystemZ specific inline assembly address operands.
Jonas Paulsson [Tue, 22 Mar 2022 09:40:18 +0000 (10:40 +0100)]
[SystemZ] Handle SystemZ specific inline assembly address operands.

Handle ZQ, ZR, ZS and ZT inline assembly operand constraints.

Review: Ulrich Weigand

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

2 years ago[analyzer] Expose Taint.h to plugins
Tom Ritter [Tue, 19 Apr 2022 14:55:01 +0000 (16:55 +0200)]
[analyzer] Expose Taint.h to plugins

Reviewed By: NoQ, xazax.hun, steakhal

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

2 years ago[llvm-ar][test] Rename two tests and use correct thin command
gbreynoo [Tue, 19 Apr 2022 14:10:51 +0000 (15:10 +0100)]
[llvm-ar][test] Rename two tests and use correct thin command

Two tests used the term "full archive" rather than "regular", these have
been updated including the test names. They now also use --thin rather
than the deprecated T. This change was made in preparation of D123142.

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

2 years ago[clang] Adding Platform/Architecture Specific Resource Header Installation Targets
Qiongsi Wu [Tue, 19 Apr 2022 14:08:57 +0000 (10:08 -0400)]
[clang] Adding Platform/Architecture Specific Resource Header Installation Targets

The goal of this patch is to improve distribution build's flexibility to include only applicable header files.

Currently, the clang-resource-headers target contains nearly all the files in clang/lib/Headers. Most of these files are platform specific (e.g. immintrin.h is x86 specific). A distribution build will have to either include all the headers for all the platforms, or not include any headers. For example, if a distribution build for powerpc includes the clang-resource-headers target, it will include all the x86 specific headers, even-though the x86 specific headers cannot be used.

This patch breaks up the clang-resource-headers list to a core list and platform specific lists. With the patch, a distribution build can now include the ppc-resource-headers to include the headers applicable to the powerpc platform.

Specifically, one can now have

cmake ... LLVM_DISTRIBUTION_COMPONENTS="clang;ppc-resource-headers" ... ../llvm
ninja install-distribution then installs the powerpc headers.

Similarly, one can do

cmake ... LLVM_DISTRIBUTION_COMPONENTS="clang;x86-resource-headers" ... ../llvm
to include headers applicable to the x86 platform in a distribution installation.

To implement this behaviour, the patch does two things:
* It breaks up the long files header file list to a core list and platform specific lists.
* It adds numerous platform specific installation targets.

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

2 years ago[clang][AArch64] Remove BTI after setjmp from release notes
David Spickett [Tue, 19 Apr 2022 13:48:26 +0000 (13:48 +0000)]
[clang][AArch64] Remove BTI after setjmp from release notes

This is now going into 14.0.2 as
571c7d8f6dae1a8797ae3271c0c09fc648b1940b so will not be
new in clang-15.

2 years ago[AArch64] Add lane moves to PerfectShuffle tables
David Green [Tue, 19 Apr 2022 13:49:50 +0000 (14:49 +0100)]
[AArch64] Add lane moves to PerfectShuffle tables

This teaches the perfect shuffle tables about lane inserts, that can
help reduce the cost of many entries. Many of the shuffle masks are
one-away from being correct, and a simple lane move can be a lot simpler
than trying to use ext/zip/etc. Because they are not exactly like the
other masks handled in the perfect shuffle tables, they require special
casing to generate them, with a special InsOp Operator.

The lane to insert into is encoded as the RHSID, and the move from is
grabbed from the original mask. This helps reduce the maximum perfect
shuffle entry cost to 3, with many more shuffles being generatable in a
single instruction.

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

2 years ago[SLP][NFC]Add a test for reducing same values, NFC.
Alexey Bataev [Tue, 19 Apr 2022 13:48:21 +0000 (06:48 -0700)]
[SLP][NFC]Add a test for reducing same values, NFC.

2 years agoRevert "[SLP]Improve reductions analysis and emission, part 1."
Alexey Bataev [Tue, 19 Apr 2022 12:36:23 +0000 (05:36 -0700)]
Revert "[SLP]Improve reductions analysis and emission, part 1."

This reverts commit 0e1f4d4d3cb08ff84df5adc4f5e41d0a2cebc53d to fix
a crash reported in PR54976

2 years ago[clangd] IncludeCleaner: Add filtering mechanism
Kirill Bobyrev [Tue, 19 Apr 2022 12:56:21 +0000 (14:56 +0200)]
[clangd] IncludeCleaner: Add filtering mechanism

This introduces filtering out inclusions based on the resolved path. This
mechanism will be important for disabling warnings for headers that we can not
diagnose correctly yet.

Reviewed By: sammccall

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

2 years ago[OpenMP][Docs] Remove old 14.0 release information
Joseph Huber [Tue, 19 Apr 2022 12:45:51 +0000 (08:45 -0400)]
[OpenMP][Docs] Remove old 14.0 release information

Summary:
This patch removes the OpenMP sections in the release notes. These will
be filled once the release is close and implementations are finalized.

2 years ago[OpenMP] Make Xopenmp-target args compile-only to silence warnings
Joseph Huber [Tue, 19 Apr 2022 11:47:33 +0000 (07:47 -0400)]
[OpenMP] Make Xopenmp-target args compile-only to silence warnings

Summary:
Previously we needed the `Xopenmp-target=` option during the linking
phase so the old offloading driver knew which items to extract and link
for the device. Now that the new driver has become the default this is
no longer necessary and will cause a warning to be emitted for the
unused argument. This should be silenced to avoid noise.

2 years ago[MLIR][GPU] Add canonicalizer for gpu.memcpy
Arnab Dutta [Tue, 19 Apr 2022 11:08:06 +0000 (16:38 +0530)]
[MLIR][GPU] Add canonicalizer for gpu.memcpy

Fold away gpu.memcpy op when only uses of dest are
the memcpy op in question, its allocation and deallocation
ops.

Reviewed By: bondhugula

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

2 years ago[AArch64] Only mark cost 1 perfect shuffles as legal
David Green [Tue, 19 Apr 2022 11:58:55 +0000 (12:58 +0100)]
[AArch64] Only mark cost 1 perfect shuffles as legal

The perfect shuffle tables encode a cost of either 0 (a nop-copy) or 1
(a single instruction) with a cost encoding of 0 in the upper 2 bits.
All perfect shuffles with any cost are then marked as legal shuffles
though (the maximum encoded cost is 3), which can confuse the DAG
combiner into thinking the shuffles are cheaper than the should be.

Limiting legal shuffles to single instructions seems to do better in
most case, producing less instructions for complex shuffles. There are
some cases that now become tbl, which may be better or worse depending
on whether the instruction is in a loop and the tbl load can be hoisted
out.

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

2 years agoRevert "[Concepts] Fix overload resolution bug with constrained candidates"
Roy Jacobson [Tue, 19 Apr 2022 11:51:21 +0000 (07:51 -0400)]
Revert "[Concepts] Fix overload resolution bug with constrained candidates"

This reverts commit 454d1df9423c95e54c3a2f5cb58d864096032d09.

2 years ago[VPlan] Expand induction step in VPlan pre-header.
Florian Hahn [Tue, 19 Apr 2022 11:06:39 +0000 (13:06 +0200)]
[VPlan] Expand induction step in VPlan pre-header.

This patch moves SCEV expansion of steps used by
VPWidenIntOrFpInductionRecipes to the pre-header using
VPExpandSCEVRecipe. This ensures that those steps are expanded while the
CFG is in a valid state. Previously, SCEV expansion may happen during
vector body code-generation, during which the CFG may be invalid,
causing issues with SCEV expansion.

Depends on D122095.

Reviewed By: Ayal

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

2 years ago[AArch64] Cost all perfect shuffles entries as cost 1
David Green [Tue, 19 Apr 2022 11:05:05 +0000 (12:05 +0100)]
[AArch64] Cost all perfect shuffles entries as cost 1

A brief introduction to perfect shuffles - AArch64 NEON has a number of
shuffle operations - dups, zips, exts, movs etc that can in some way
shuffle around the lanes of a vector. Given a shuffle of size 4 with 2
inputs, some shuffle masks can be easily codegen'd to a single
instruction. A <0,0,1,1> mask for example is a zip LHS, LHS. This is
great, but some masks are not so simple, like a <0,0,1,2>. It turns out
we can generate that from zip LHS, <0,2,0,2>, having generated
<0,2,0,2> from uzp LHS, LHS, producing the result in 2 instructions.

It is not obvious from a given mask how to get there though. So we have
a simple program (PerfectShuffle.cpp in the util folder) that can scan
through all combinations of 4-element vectors and generate the perfect
combination of results needed for each shuffle mask (for some definition
of perfect). This is run offline to generate a table that is queried for
generating shuffle instructions. (Because the table could get quite big,
it is limited to 4 element vectors).

In the perfect shuffle tables zip, unz and trn shuffles were being cost
as 2, which is higher than needed and skews the perfect shuffle tables
to create inefficient combinations. This sets them to 1 and regenerates
the tables. The codegen will usually be better and the costs should be
more precise (but it can get less second-order re-use of values from
multiple shuffles, these cases should be fixed up in subsequent patches.

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

2 years agoFix SLP score for out of order contiguous loads
Alban Bridonneau [Tue, 19 Apr 2022 10:23:44 +0000 (11:23 +0100)]
Fix SLP score for out of order contiguous loads

SLP uses the distance between pointers to optimize
the getShallowScore. However the current code misses
the case where we are trying to vectorize for VF=4, and the distance
between pointers is 2. In that case the returned score
reflects the case of contiguous loads, when it's not actually
contiguous.

The attached unit tests have 5 loads, where the program order
is not the same as the offset order in the GEPs. So, the choice
of which 4 loads to bundle together matters. If we pick the
first 4, then we can vectorize with VF=4. If we pick the
last 4, then we can only vectorize with VF=2.

This patch makes a more conservative choice, to consider
all distances>1 to not be a case of contiguous load, and
give those cases a lower score.

Reviewed By: ABataev

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

2 years ago[AMDGPU][MC] Corrected error message "image data size does not match dmask and tfe"
Dmitry Preobrazhensky [Tue, 19 Apr 2022 10:52:58 +0000 (13:52 +0300)]
[AMDGPU][MC] Corrected error message "image data size does not match dmask and tfe"

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

2 years ago[analyzer] Remove HasAlphaDocumentation tablegen enum value
Balazs Benics [Tue, 19 Apr 2022 10:14:27 +0000 (12:14 +0200)]
[analyzer] Remove HasAlphaDocumentation tablegen enum value

D121387 simplified the doc url generation process, so we no longer need
the HasAlphaDocumentation enum entry. This patch removes that.

Reviewed By: martong

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

2 years ago[analyzer] ClangSA should tablegen doc urls refering to the main doc page
Balazs Benics [Tue, 19 Apr 2022 10:14:27 +0000 (12:14 +0200)]
[analyzer] ClangSA should tablegen doc urls refering to the main doc page

AFAIK we should prefer
https://clang.llvm.org/docs/analyzer/checkers.html to
https://clang-analyzer.llvm.org/{available_checks,alpha_checks}.html

This patch will ensure that the doc urls produced by tablegen for the
ClangSA, will use the new url. Nothing else will be changed.

Reviewed By: martong, Szelethus, ASDenysPetrov

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

2 years ago[analyzer] Turn missing tablegen doc entry of a checker into fatal error
Balazs Benics [Tue, 19 Apr 2022 10:14:27 +0000 (12:14 +0200)]
[analyzer] Turn missing tablegen doc entry of a checker into fatal error

It turns out all checkers explicitly mention the `Documentation<>`.
It makes sense to demand this, so emit a fatal tablegen error if such
happens.

Reviewed By: martong, Szelethus

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

2 years ago[analyzer][NFC] Introduce the checker package separator character
Balazs Benics [Tue, 19 Apr 2022 10:14:27 +0000 (12:14 +0200)]
[analyzer][NFC] Introduce the checker package separator character

Reviewed By: martong, ASDenysPetrov

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

2 years ago[lldb] Handle empty search string in "memory find"
David Spickett [Thu, 14 Apr 2022 14:06:27 +0000 (14:06 +0000)]
[lldb] Handle empty search string in "memory find"

Given that you'd never find empty string, just error.

Also add a test that an invalid expr generates an error.

Reviewed By: JDevlieghere

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

2 years ago[OpenCL] opencl-c.h: Add const to get_image_num_samples
Sven van Haastregt [Tue, 19 Apr 2022 09:16:44 +0000 (10:16 +0100)]
[OpenCL] opencl-c.h: Add const to get_image_num_samples

Align with the `-fdeclare-opencl-builtins` option and other
get_image_* builtins which have the const attribute.

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

2 years ago[mlir][emitc] Add test for invalid type
Marius Brehler [Mon, 11 Apr 2022 13:09:21 +0000 (13:09 +0000)]
[mlir][emitc] Add test for invalid type

Reviewed By: jpienaar

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

2 years ago[Concepts] Fix overload resolution bug with constrained candidates
Roy Jacobson [Fri, 15 Apr 2022 15:58:11 +0000 (11:58 -0400)]
[Concepts] Fix overload resolution bug with constrained candidates

When doing overload resolution, we have to check that candidates' parameter types are equal before trying to find a better candidate through checking which candidate is more constrained.
This revision adds this missing check and makes us diagnose those cases as ambiguous calls when the types are not equal.

Fixes GitHub issue https://github.com/llvm/llvm-project/issues/53640

Reviewed By: erichkeane

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

2 years ago[AMDGPU] Select d16 stores even when sramecc is enabled
Jay Foad [Tue, 22 Jun 2021 12:06:02 +0000 (13:06 +0100)]
[AMDGPU] Select d16 stores even when sramecc is enabled

The sramecc feature changes the behaviour of d16 loads so they do not
preserve the unused 16 bits of the result register, but it has no impact
on d16 stores, so we should make use of them even when the feature is
enabled.

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

2 years ago[clang][lexer] Allow u8 character literal prefixes in C2x
Timm Bäder [Tue, 8 Feb 2022 09:13:11 +0000 (10:13 +0100)]
[clang][lexer] Allow u8 character literal prefixes in C2x

Implement N2418 for C2x.

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

2 years ago[Support] Optimize (.*) regex matches
Nikita Popov [Thu, 14 Apr 2022 09:49:35 +0000 (11:49 +0200)]
[Support] Optimize (.*) regex matches

If capturing groups are used, the regex matcher handles something
like `(.*)suffix` by first doing a maximal match of `.*`, trying to
match `suffix` afterward, and then reducing the maximal stop
position one by one until this finally succeeds. This makes the
match quadratic in the length of the line (with large constant factors).

This is particularly problematic because regexes of this form are
ubiquitous in FileCheck (something like `[[VAR:%.*]] = ...` falls
in this category), making FileCheck executions much slower than
they have any right to be.

This implements a very crude optimization that checks if suffix
starts with a fixed character, and steps back to the last occurrence
of that character, instead of stepping back by one character at a
time. This drops FileCheck time on
clang/test/CodeGen/RISCV/rvv-intrinsics/vloxseg_mask.c from
7.3 seconds to 2.7 seconds.

An obvious further improvement would be to check more than one
character (once again, this is particularly relevant for FileCheck,
because the next character is usually a space, which happens to
have many occurrences).

This should help with https://github.com/llvm/llvm-project/issues/54821.

2 years ago[mlir][interfaces] Fix infinite loop in insideMutuallyExclusiveRegions
Matthias Springer [Tue, 19 Apr 2022 07:21:08 +0000 (16:21 +0900)]
[mlir][interfaces] Fix infinite loop in insideMutuallyExclusiveRegions

This function was missing a termination condition.

2 years agoApply clang-tidy fixes for performance-unnecessary-value-param in JitRunner.cpp ...
Mehdi Amini [Sat, 16 Apr 2022 08:04:56 +0000 (08:04 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in JitRunner.cpp (NFC)

2 years agoApply clang-tidy fixes for performance-for-range-copy in MemRefOps.cpp (NFC)
Mehdi Amini [Sat, 16 Apr 2022 07:43:24 +0000 (07:43 +0000)]
Apply clang-tidy fixes for performance-for-range-copy in MemRefOps.cpp (NFC)

2 years ago[NFC] Remove unused variable
Chuanqi Xu [Tue, 19 Apr 2022 07:12:44 +0000 (15:12 +0800)]
[NFC] Remove unused variable

2 years ago[mlir][interfaces] Add helpers for detecting recursive regions
Matthias Springer [Tue, 19 Apr 2022 07:12:40 +0000 (16:12 +0900)]
[mlir][interfaces] Add helpers for detecting recursive regions

Add helper functions to check if an op may be executed multiple times based on RegionBranchOpInterface.

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

2 years ago[RISCV] Fix lowering of BUILD_VECTORs as VID sequences
Fraser Cormack [Thu, 14 Apr 2022 12:09:09 +0000 (13:09 +0100)]
[RISCV] Fix lowering of BUILD_VECTORs as VID sequences

This patch fixes a bug when lowering BUILD_VECTOR via VID sequences.
After adding support for fractional steps in D106533, elements with zero
steps may be skipped if no step has yet been computed. This allowed
certain sequences to slip through the cracks, being identified as VID
sequences when in fact they are not.

The fix for this is to perform a second loop over the BUILD_VECTOR to
validate the entire sequence once the step has been computed. This isn't
the most efficient, but on balance the code is more readable and
maintainable than doing back-validation during the first loop.

Fixes the tests introduced in D123785.

Reviewed By: craig.topper

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

2 years ago[RISCV] Add tests showing incorrect BUILD_VECTOR lowering
Fraser Cormack [Thu, 14 Apr 2022 12:03:56 +0000 (13:03 +0100)]
[RISCV] Add tests showing incorrect BUILD_VECTOR lowering

These tests both use vector constants misidentified as VID sequences.
Because the initial run of elements has a zero step, the elements are
skipped until such a step can be identified. The bug is that the skipped
elements are never validated, even though the computed step is
incompatible across the entire sequence.

A fix will follow in a subseqeuent patch.

Reviewed By: craig.topper

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

2 years agoRevert "[AMDGPU] Omit unnecessary waitcnt before barriers"
Austin Kerbow [Tue, 19 Apr 2022 04:24:08 +0000 (21:24 -0700)]
Revert "[AMDGPU] Omit unnecessary waitcnt before barriers"

This reverts commit 8d0c34fd4fb66ea0d19563154a59658e4b7f35d4.

2 years ago[libc++][NFC] Reindent `take_view` in accordance with the style guide.
Konstantin Varlamov [Tue, 19 Apr 2022 03:54:50 +0000 (20:54 -0700)]
[libc++][NFC] Reindent `take_view` in accordance with the style guide.

2 years ago[CUDA][HIP] Fix gpu.used.external
Yaxun (Sam) Liu [Mon, 18 Apr 2022 15:08:50 +0000 (11:08 -0400)]
[CUDA][HIP] Fix gpu.used.external

Rename gpu.used.external as __clang_gpu_used_external as ptxas does not
allow . in global variable name.

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

Reviewed by: Joseph Huber, Artem Belevich

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

2 years ago[Libomptarget] Fix test using old unsupported lit string
Joseph Huber [Tue, 19 Apr 2022 03:07:01 +0000 (23:07 -0400)]
[Libomptarget] Fix test using old unsupported lit string

Summary:
One test had an old "unsupported" string that used the old `newDriver`
string which was removed. This test should be updated to use the
`oldDriver` one instead.

2 years ago[Pipelines] Hoist CoroEarly as a module pass
Chuanqi Xu [Wed, 13 Apr 2022 09:03:13 +0000 (17:03 +0800)]
[Pipelines] Hoist CoroEarly as a module pass

This change could reduce the time we call `declaresCoroEarlyIntrinsics`.
And it is helpful for future changes.

Reviewed By: aeubanks

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

2 years agoReapply "[OpenMP] Refactor OMPScheduleType enum."
Michael Kruse [Tue, 19 Apr 2022 02:30:17 +0000 (21:30 -0500)]
Reapply "[OpenMP] Refactor OMPScheduleType enum."

This reverts commit af0285122f306573d9bcc4c4ad7f904cfdd4d869.

The test "libomp::loop_dispatch.c" on builder
openmp-gcc-x86_64-linux-debian fails from time-to-time.
See #54969. This patch is unrelated.

2 years ago[RISCV] Add rvv codegen support for vp.fptrunc.
jacquesguan [Fri, 15 Apr 2022 06:54:27 +0000 (06:54 +0000)]
[RISCV] Add rvv codegen support for vp.fptrunc.

This patch adds rvv codegen support for vp.fptrunc. The lowering of fp_round and vp.fptrunc share most code so use a common lowering function to handle those two, similar to vp.trunc.

Reviewed By: craig.topper

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

2 years agoApply clang-tidy fixes for performance-unnecessary-copy-initialization in MathOps...
Mehdi Amini [Sat, 16 Apr 2022 07:41:39 +0000 (07:41 +0000)]
Apply clang-tidy fixes for performance-unnecessary-copy-initialization in MathOps.cpp (NFC)

2 years agoApply clang-tidy fixes for performance-for-range-copy in ElementwiseOpFusion.cpp...
Mehdi Amini [Sat, 16 Apr 2022 07:33:20 +0000 (07:33 +0000)]
Apply clang-tidy fixes for performance-for-range-copy in ElementwiseOpFusion.cpp (NFC)

2 years agoRevert "[ASan] Fixed a reporting bug in (load|store)N functions which would print...
Kirill Stoimenov [Mon, 18 Apr 2022 23:31:46 +0000 (23:31 +0000)]
Revert "[ASan] Fixed a reporting bug in (load|store)N functions which would print unknown-crash instead of the proper error message when a the data access is unaligned."

This reverts commit d81d317999b350f9ba41e214149899ccd62eb998.

Reviewed By: kstoimenov

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

2 years agoRecommit "[SLP] Support internal users of splat loads"
Vasileios Porpodas [Mon, 18 Apr 2022 19:14:21 +0000 (12:14 -0700)]
Recommit "[SLP] Support internal users of splat loads"

Code review: https://reviews.llvm.org/D121940

This reverts commit 359dbb0d3daa8295848a09ddd083c79f6851888e.

2 years ago[ASan] Fixed a reporting bug in (load|store)N functions which would print unknown...
Kirill Stoimenov [Tue, 12 Apr 2022 23:18:02 +0000 (23:18 +0000)]
[ASan] Fixed a reporting bug in (load|store)N functions which would print unknown-crash instead of the proper error message when a the data access is unaligned.

Reviewed By: kda, eugenis

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

2 years ago[AMDGPU] Fix comment type in the DSInstructions.td. NFC.
Stanislav Mekhanoshin [Mon, 18 Apr 2022 21:28:12 +0000 (14:28 -0700)]
[AMDGPU] Fix comment type in the DSInstructions.td. NFC.

2 years ago[llvm-objcopy] Make llvm-strip --only-keep-debug suppress default --strip-all
John McIver [Mon, 18 Apr 2022 21:16:10 +0000 (14:16 -0700)]
[llvm-objcopy] Make llvm-strip --only-keep-debug suppress default --strip-all

Fixes #54417

Reviewed By: MaskRay

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

2 years ago[MLIR][Presburger] Remove inheritence in MultiAffineFunction
Groverkss [Mon, 18 Apr 2022 19:44:18 +0000 (01:14 +0530)]
[MLIR][Presburger] Remove inheritence in MultiAffineFunction

This patch removes inheritence of MultiAffineFunction from IntegerPolyhedron
and instead makes IntegerPolyhedron as a member.

This patch removes virtualization in MultiAffineFunction and also removes
unnecessary functions inherited from IntegerPolyhedron.

Reviewed By: ftynse

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

2 years ago[NFC][PowerPC] Move the Regsiter Operands for PowerPC into PPCRegisterInfo.td
Stefan Pintilie [Mon, 18 Apr 2022 14:23:44 +0000 (09:23 -0500)]
[NFC][PowerPC] Move the Regsiter Operands for PowerPC into PPCRegisterInfo.td

Currently the regsiter operand definitions are found in three separate files.
This patch moves all of the definitions into PPCRegisterInfo.td.

Reviewed By: amyk

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

2 years agoRevert "[OpenMP] Refactor OMPScheduleType enum."
Michael Kruse [Mon, 18 Apr 2022 19:35:53 +0000 (14:35 -0500)]
Revert "[OpenMP] Refactor OMPScheduleType enum."

This reverts commit 9ec501da76fc1559cadd6d6dac32766bf4376a3d.

It may have caused the openmp-gcc-x86_64-linux-debian buildbot to fail.
https://lab.llvm.org/buildbot/#/builders/4/builds/20377

2 years ago[InstCombine] reduce code for freeze of undef
Sanjay Patel [Mon, 18 Apr 2022 19:03:10 +0000 (15:03 -0400)]
[InstCombine] reduce code for freeze of undef

The description was ambiguous about the behavior
when boths select arms are constant or both arms
are not constant. I don't think there's any
evidence to support either way, but this matches
the code with a more specified description.

We can extend this to deal with vector constants
with undef/poison elements. Currently, those don't
get folded anywhere.

2 years ago[InstCombine] add tests for select with frozen condition; NFC
Sanjay Patel [Mon, 18 Apr 2022 18:45:18 +0000 (14:45 -0400)]
[InstCombine] add tests for select with frozen condition; NFC

2 years agoRevert "[SLP] Support internal users of splat loads"
Vasileios Porpodas [Mon, 18 Apr 2022 19:12:34 +0000 (12:12 -0700)]
Revert "[SLP] Support internal users of splat loads"

This reverts commit f8e1337115623cb879f734940fd9dfeb29a611e7.

2 years ago[Clang][Docs] Update information on the new driver now that it's default
Joseph Huber [Mon, 18 Apr 2022 19:01:55 +0000 (15:01 -0400)]
[Clang][Docs] Update information on the new driver now that it's default

Summary:
This patch updates some of the documentation on the new driver now that
it's the default. Also the ABI for embedding these images changed.

2 years ago[OpenMP] Make the new offloading driver the default
Joseph Huber [Thu, 31 Mar 2022 15:42:13 +0000 (11:42 -0400)]
[OpenMP] Make the new offloading driver the default

Previously an opt-in flag `-fopenmp-new-driver` was used to enable the
new offloading driver. After passing tests for a few months it should be
sufficiently mature to flip the switch and make it the default. The new
offloading driver is now enabled if there is OpenMP and OpenMP
offloading present and the new `-fno-openmp-new-driver` is not present.

The new offloading driver has three main benefits over the old method:
- Static library support
- Device-side LTO
- Unified clang driver stages

Depends on D122683

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

2 years ago[OpenMP] Refactor OMPScheduleType enum.
Michael Kruse [Mon, 18 Apr 2022 15:58:53 +0000 (10:58 -0500)]
[OpenMP] Refactor OMPScheduleType enum.

The OMPScheduleType enum stores the constants from libomp's internal sched_type in kmp.h and are used by several kmp API functions. The enum values have an internal structure, namely each scheduling algorithm (e.g.) exists in four variants: unordered, orderend, normerge unordered, and nomerge ordered.

This patch (basically a followup to D114940) splits the "ordered" and "nomerge" bits into separate flags, as was already done for the "monotonic" and "nonmonotonic", so we can apply bit flags operations on them. It also now contains all possible combinations according to kmp's sched_type. Deriving of the OMPScheduleType enum from clause parameters has been moved form MLIR's OpenMPToLLVMIRTranslation.cpp to OpenMPIRBuilder to make available for clang as well. Since the primary purpose of the flag is the binary interface to libomp, it has been made more private to LLVMFrontend. The primary interface for generating worksharing-loop using OpenMPIRBuilder code becomes `applyWorkshareLoop` which derives the OMPScheduleType automatically and calls the appropriate emitter function.

While this is mostly a NFC refactor, it still applies the following functional changes:
 * The logic from OpenMPToLLVMIRTranslation to derive the OMPScheduleType also applies to clang. Most notably, it now applies the nonmonotonic flag for non-static schedules by default.
 * In OpenMPToLLVMIRTranslation, the nonmonotonic default flag was previously not applied if the simd modifier was used. I assume this was a bug, since the effect was due to `loop.schedule_modifier()` returning `mlir::omp::ScheduleModifier::none` instead of `llvm::Optional::None`.
 * In OpenMPToLLVMIRTranslation, the nonmonotonic default flag was set even if ordered was specified, in breach to what the comment before citing the OpenMP specification says. I assume this was an oversight.

The ordered flag with parameter was not considered in this patch. Changes will need to be made (e.g. adding/modifying function parameters) when support for it is added. The lengthy names of the enum values can be discussed, for the moment this is avoiding reusing previously existing enum value names such as `StaticChunked` to avoid confusion.

Reviewed By: peixin

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

2 years ago[mlir:NFC] Remove the forward declaration of FuncOp in the mlir namespace
River Riddle [Mon, 18 Apr 2022 18:53:47 +0000 (11:53 -0700)]
[mlir:NFC] Remove the forward declaration of FuncOp in the mlir namespace

FuncOp has been moved to the `func` namespace for a little over a month, the
using directive can be dropped now.

2 years ago[SLP] Support internal users of splat loads
Vasileios Porpodas [Mon, 18 Apr 2022 14:49:26 +0000 (07:49 -0700)]
[SLP] Support internal users of splat loads

Until now we would only accept a broadcast load pattern if it is only used
by a single vector of instructions.

This patch relaxes this, and allows for the broadcast to have more than one
user vector, as long as all of its uses are internal to the SLP graph and
vectorized.

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

2 years ago[Arch64][SelectionDAG] Add target-specific implementation of srem
chenglin.bi [Mon, 18 Apr 2022 03:19:06 +0000 (11:19 +0800)]
[Arch64][SelectionDAG] Add target-specific implementation of srem

1. X%C to the equivalent of X-X/C*C is not always fastest path if there is no SDIV pair exist. So check target have faster for srem only first.
2. Add AArch64 faster path for SREM only pow2 case.

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

Reviewed By: efriedma

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

2 years agoImprove terminator doc in MLIR LangRef
Mehdi Amini [Mon, 18 Apr 2022 18:43:25 +0000 (18:43 +0000)]
Improve terminator doc in MLIR LangRef

Reviewed By: rriddle, bondhugula

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

2 years ago[NFC][PowerPC] Style and ordering changes for PPCInstrP10.td
Stefan Pintilie [Mon, 18 Apr 2022 18:09:21 +0000 (13:09 -0500)]
[NFC][PowerPC] Style and ordering changes for PPCInstrP10.td

Renamed the two classes 8LS_DForm_R_SI34_RTA5 and 8LS_DForm_R_SI34_XT6_RA5 to
8LS_DForm_R_SI34_RTA5_MEM and 8LS_DForm_R_SI34_XT6_RA5_MEM because the
instructions that use the classes use memory reads/writes.

Moved the instruction defs up closer to the classes.
Removed unnecessary whitespace.

2 years agoApply clang-tidy fixes for readability-identifier-naming in GPUDialect.cpp (NFC)
Mehdi Amini [Sat, 16 Apr 2022 07:27:24 +0000 (07:27 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in GPUDialect.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-simplify-boolean-expr in TypeConverter.cpp...
Mehdi Amini [Sat, 16 Apr 2022 07:05:42 +0000 (07:05 +0000)]
Apply clang-tidy fixes for readability-simplify-boolean-expr in TypeConverter.cpp (NFC)

2 years agoDon't treat 'T &forward(T&&)' as builtin.
Richard Smith [Mon, 18 Apr 2022 18:07:10 +0000 (11:07 -0700)]
Don't treat 'T &forward(T&&)' as builtin.

This allows the standard library to diagnose it properly. Suppress
warning in libc++ testsuite for unused result of call to std::forward.

2 years ago[flang] Fix regression with recent work on intrinsic/generic interactions
Peter Klausler [Sat, 16 Apr 2022 03:59:13 +0000 (20:59 -0700)]
[flang] Fix regression with recent work on intrinsic/generic interactions

When resolving a procedure reference, do not allow a successful
intrinsic procedure probe result to override an existing
symbol.

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

2 years ago[Libomptarget] Fix LIBOMPTARGET_INFO test
Joseph Huber [Mon, 18 Apr 2022 18:08:16 +0000 (14:08 -0400)]
[Libomptarget] Fix LIBOMPTARGET_INFO test

Summary:
A patch added a new line to one of the info outputs without updating
this test. This patch adds the new text to the existing test.

2 years agoFix llvm-profgen breakage
Wenlei He [Mon, 18 Apr 2022 18:01:49 +0000 (11:01 -0700)]
Fix llvm-profgen breakage

2 years ago[ocaml bindings] Remove LTO bindings
Arthur Eubanks [Mon, 18 Apr 2022 17:22:26 +0000 (10:22 -0700)]
[ocaml bindings] Remove LTO bindings

Followup to D123882.

2 years ago[LegacyPM] Remove ThinLTO/LTO pipelines
Arthur Eubanks [Fri, 15 Apr 2022 23:03:48 +0000 (16:03 -0700)]
[LegacyPM] Remove ThinLTO/LTO pipelines

Using the legacy PM for the optimization pipeline was deprecated in 13.0.0.
Following recent changes to remove non-core features of the legacy
PM/optimization pipeline, remove the (Thin)LTO pipelines.

Reviewed By: MaskRay

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

2 years ago[CallPrinter] Port CallPrinter passes to new pass manager
Arthur Eubanks [Mon, 18 Apr 2022 16:58:11 +0000 (09:58 -0700)]
[CallPrinter] Port CallPrinter passes to new pass manager

Port the legacy CallGraphViewer and CallGraphDOTPrinter to work with the new pass manager.

Addresses issue https://github.com/llvm/llvm-project/issues/54323
Adds back related tests that were removed in commits d53a4e7b4a87 and 9e9d9aba1475

Reviewed By: aeubanks

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

2 years ago[llvm-profgen] Add process filter for perf reader
Wenlei He [Fri, 15 Apr 2022 19:27:46 +0000 (12:27 -0700)]
[llvm-profgen] Add process filter for perf reader

For profile generation, we need to filter raw perf samples for binary of interest. Sometimes binary name along isn't enough as we can have binary of the same name running in the system. This change adds a process id filter to allow users to further disambiguiate the input raw samples.

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

2 years ago[mlir] Fix two AttributeParser aborts
Jacques Pienaar [Mon, 18 Apr 2022 16:30:35 +0000 (09:30 -0700)]
[mlir] Fix two AttributeParser aborts

Reproducers that resulted in triggering the following asserts

mlir::NamedAttribute::NamedAttribute(mlir::StringAttr, mlir::Attribute)
mlir/lib/IR/Attributes.cpp:29:3
consumeToken
mlir/lib/Parser/Parser.h:126

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

2 years agoFormat fix in recent change. Removed whitespace. [NFC]
Blue Gaston [Mon, 18 Apr 2022 16:23:01 +0000 (09:23 -0700)]
Format fix in recent change. Removed whitespace. [NFC]

2 years ago[llvm][IPO] Inclusive language: Rename mergefunc-sanity to mergefunc-verify and remov...
Zarko Todorovski [Mon, 18 Apr 2022 15:49:54 +0000 (11:49 -0400)]
[llvm][IPO] Inclusive language: Rename mergefunc-sanity to mergefunc-verify and remove other instances of sanity in MergeFunctions.cpp

This patch renames the mergefunc-sanity to mergefunc-verify and renames the related functions to use more
inclusive language

Reviewed By: cebowleratibm

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

2 years agoForce GHashCell to be 8-byte-aligned.
Eli Friedman [Fri, 15 Apr 2022 20:03:39 +0000 (13:03 -0700)]
Force GHashCell to be 8-byte-aligned.

Otherwise, with recent versions of libstdc++, clang can't tell that the
atomic operations are properly aligned, and generates calls to
libatomic.  (Actually, because of the use of reinterpret_cast, it wasn't
guaranteed to be aligned, but I think it ended up being aligned in
practice.)

Fixes https://github.com/llvm/llvm-project/issues/54790 , the part where
LLVM failed to build.

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

2 years ago[Clang] Use of decltype(capture) in parameter-declaration-clause
Corentin Jabot [Sun, 17 Apr 2022 12:29:22 +0000 (14:29 +0200)]
[Clang] Use of decltype(capture) in parameter-declaration-clause

Partially implement the proposed resolution to CWG2569.

D119136 broke some libstdc++ code, as P2036R3, implemented as a DR to
C++11 made ill-formed some previously valid and innocuous code.

We resolve this issue to allow decltype(x) - but not decltype((x)
to appear in the parameter list of a lambda that capture x by copy.

Unlike CWG2569, we do not extend that special treatment to
sizeof/noexcept yet, as the resolution has not been approved yet
and keeping the review small allows a quicker fix of impacted code.

Reviewed By: aaron.ballman

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

2 years agoSilence a "not all control paths return a value" warning; NFC
Aaron Ballman [Mon, 18 Apr 2022 12:54:08 +0000 (08:54 -0400)]
Silence a "not all control paths return a value" warning; NFC