platform/upstream/llvm.git
22 months ago[mlir][sparse] fix bufferizableOpInterface for InsertOp
Peiming Liu [Fri, 21 Oct 2022 23:21:53 +0000 (23:21 +0000)]
[mlir][sparse] fix bufferizableOpInterface for InsertOp

Address comments in D136372

Reviewed By: aartbik, springerm

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

22 months ago[lldb-tests] Force use of system stdlib for Objective-C test
Felipe de Azevedo Piovezan [Mon, 24 Oct 2022 14:27:46 +0000 (10:27 -0400)]
[lldb-tests] Force use of system stdlib for Objective-C test

The test TestObjCDirectMethods loads the Objective C runtime, which
doesn't work well with custom a libcxx, resulting in two copies of the
standard library being loaded at runtime.

Like what was done for `TestObjCExceptions`, this commit forces the
usage of the system's library instead. The minimum required Clang
version is set to the oldest Clang that can compile the libraries
available in the lldb-matrix bots.

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

22 months ago[lldb-tests] Remove libstdc++ requirement from test
Felipe de Azevedo Piovezan [Mon, 24 Oct 2022 15:02:26 +0000 (15:02 +0000)]
[lldb-tests] Remove libstdc++ requirement from test

This requirement dates back to ten years ago and the test seems to work
nowadays with either libc++ or libstdc++.

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

22 months ago[flang] Fix building against LLVM dylib
Michał Górny [Mon, 24 Oct 2022 14:45:23 +0000 (16:45 +0200)]
[flang] Fix building against LLVM dylib

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

22 months ago[Clang] Implement P2513
Corentin Jabot [Fri, 21 Oct 2022 12:33:26 +0000 (14:33 +0200)]
[Clang] Implement P2513

Implement P2513

This change allows initializing an array of unsigned char,
or char from u8 string literals.
This was done both to support legacy code and for compatibility
with C where char8_t will be typedef to unsigned char.

This is backported to C++20 as per WG21 guidance.

Reviewed By: aaron.ballman

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

22 months ago[StrictFP][IPSCCP] Constant fold intrinsics with metadata arguments
Kevin P. Neal [Mon, 24 Oct 2022 15:33:05 +0000 (11:33 -0400)]
[StrictFP][IPSCCP] Constant fold intrinsics with metadata arguments

This teaches the SCCP Solver how to constant fold more intrinsics. Constant
folding appears to be just as good as D115737 but much, much lower in code
change impact as suggested by nikic.

The constrained floating-point intrinsics all take at least one metadata
argument and were the motivation for the change.

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

22 months ago[AArch64][PAC] Select XPAC for ptrauth.strip intrinsic.
Ahmed Bougacha [Mon, 24 Oct 2022 15:12:24 +0000 (08:12 -0700)]
[AArch64][PAC] Select XPAC for ptrauth.strip intrinsic.

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

22 months ago[AArch64][PAC] Add helper enum/functions to handle PAC keys/ops.
Ahmed Bougacha [Mon, 24 Oct 2022 15:08:33 +0000 (08:08 -0700)]
[AArch64][PAC] Add helper enum/functions to handle PAC keys/ops.

22 months ago[IncludeCleaner] Add public API
Kadir Cetinkaya [Wed, 19 Oct 2022 21:16:38 +0000 (23:16 +0200)]
[IncludeCleaner] Add public API

Introduces walkUsed, a very simple version of the public API to enable
incremental development on rest of the pieces.

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

22 months ago[InstCombine] Combine ptrauth sign/resign + auth/resign intrinsics.
Ahmed Bougacha [Mon, 24 Oct 2022 15:02:11 +0000 (08:02 -0700)]
[InstCombine] Combine ptrauth sign/resign + auth/resign intrinsics.

(sign|resign) + (auth|resign) can be folded by omitting the middle
sign+auth component if the key and discriminator match.

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

22 months ago[PowerPC] Fix invalid cast for vector shuffles when lowering to the xxsplti32dx instr...
Amy Kwan [Sat, 22 Oct 2022 22:33:14 +0000 (17:33 -0500)]
[PowerPC] Fix invalid cast for vector shuffles when lowering to the xxsplti32dx instruction.

When lowering vector shuffles into the xxsplti32dx instruction on Power10, we
canonicalize the right operand to be a BUILD_VECTOR and as a result, get the
commuted vector shuffle node.

However, a vector shuffle will not always be returned as the result for a
commuted vector shuffle. In such a scenario, this patch updates the original
cast of a shuffle into a dyn_cast<> and checks if the shuffle is a valid vector
shuffle node prior to obtaining the commuted shuffle mask.

This patch also adds a new test case that demonstrates this scenario (primarily
seen on 32-bit), and was originally a crash prior to this fix.

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

22 months agoRevert "[TargetLowering][RISCV][X86] Support even divisors in expandDIVREMByConstant."
Craig Topper [Mon, 24 Oct 2022 14:05:21 +0000 (07:05 -0700)]
Revert "[TargetLowering][RISCV][X86] Support even divisors in expandDIVREMByConstant."

This reverts commit f6a7b47820904c5e69cc4f133d382c74a87c44e8.

I received a report that this fails on 32-bit X86.

22 months ago[AMDGPU][MC] Correct definition of aliases
Dmitry Preobrazhensky [Mon, 24 Oct 2022 10:30:25 +0000 (13:30 +0300)]
[AMDGPU][MC] Correct definition of aliases

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

22 months ago[lldb] Include gtest in standalone build only if LLDB_INCLUDE_TESTS
Michał Górny [Sun, 23 Oct 2022 12:47:50 +0000 (14:47 +0200)]
[lldb] Include gtest in standalone build only if LLDB_INCLUDE_TESTS

Build gtest targets when building standalone only if LLDB_INCLUDE_TESTS
is true.  Prior to this change, they were built whenever
LLVM_MAIN_SRC_DIR was available, independently whether tests themselves
would be run.

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

22 months ago[X86] Treat PSLLDQ/PSRLDQ as a shuffle not a shift
Simon Pilgrim [Mon, 24 Oct 2022 13:42:40 +0000 (14:42 +0100)]
[X86] Treat PSLLDQ/PSRLDQ as a shuffle not a shift

This appears to be a copy+paste typo in the znver1/2 AMD SoG tables, treating the byte shift instructions like bit shifts

Older AMD SoG referred to PSLLDQ/PSRLDQ as shuffles, and Agner/instlatx64 both report they are integer shuffles

22 months ago[flang] Add kernel to lower expressions to HLFIR
Jean Perier [Mon, 24 Oct 2022 13:35:19 +0000 (15:35 +0200)]
[flang] Add kernel to lower expressions to HLFIR

This patch adds the kernel to lower evaluate::Expr to HLFIR to a
hlfir::FortranEntity (a single mlir::Value that can be interpreted as
a Fortran variable or the value of a Fortram expression).

It implements lowering of simple name designators ("x") and starts
adding a translation layer in AbstractConverter::genExprBox and
AbstractConverter::genExprAddr so that the new expression lowering
can be used without any changes for now in the current statement and
construct lowering.

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

22 months agoGH58368: Correct concept checking in a lambda defined in concept
Erich Keane [Thu, 20 Oct 2022 18:55:01 +0000 (11:55 -0700)]
GH58368: Correct concept checking in a lambda defined in concept

As that bug reports, the problem here is that the lambda's
'context-decl' was not set to the concept, and the lambda picked up
template arguments from the concept.  SO, we failed to get the correct
template arguments in SemaTemplateInstantiate.

However, a Concept Specialization is NOT a decl, its an expression, so
we weren't able to put the concept in the decl tree like we needed.
This patch introduces a ConceptSpecializationDecl, which is the smallest
type possible to use for this purpose, containing only the template
arguments.

The net memory impliciation of this is turning a
trailing-objects into a pointer to a type with trailing-objects,  so it
should be minor.

As future work, we may consider giving this type more responsibility, or
figuring out how to better merge duplicates, but as this is just a
template-argument collection at the moment, there isn't much value to
it.

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

22 months ago[mlir] Apply ClangTidy performance fix (NFC)
Adrian Kuegel [Mon, 24 Oct 2022 13:24:42 +0000 (15:24 +0200)]
[mlir] Apply ClangTidy performance fix (NFC)

22 months ago[InstCombine] vary commuted patterns for mul fold; NFC
Sanjay Patel [Mon, 24 Oct 2022 13:13:28 +0000 (09:13 -0400)]
[InstCombine] vary commuted patterns for mul fold; NFC

Try to get better coverage for the pattern-matching
possibilities in D136015.

22 months ago[InstCombine] adjust mul tests to avoid reliance on other folds; NFC
Sanjay Patel [Mon, 24 Oct 2022 12:54:43 +0000 (08:54 -0400)]
[InstCombine] adjust mul tests to avoid reliance on other folds; NFC

This gets the tests closer to the form that we are
trying to test in D136015. Note that the IR has
changed, but the check lines have not changed.

This also shows that the desired commuted pattern
coverage is not as expected.

22 months agoFix caret position to be on the non null parameter
Arthur Grillo [Mon, 24 Oct 2022 12:38:21 +0000 (08:38 -0400)]
Fix caret position to be on the non null parameter

When checking for non null arguments the wrong SourceLocation was given,
this fix to pass the proper argument's location.

Fixes #58273

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

22 months ago[mlir][scf][bufferize] Fix bufferizesToMemoryRead with 0 loop iterations
Matthias Springer [Mon, 24 Oct 2022 12:19:31 +0000 (14:19 +0200)]
[mlir][scf][bufferize] Fix bufferizesToMemoryRead with 0 loop iterations

There was a bug in scf.for loop bufferization that could lead to a missing buffer copy (alloc was there, but not the copy).

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

22 months ago[Clang][AArch64] Add support for -mcpu=grace
Sjoerd Meijer [Mon, 24 Oct 2022 12:00:34 +0000 (17:30 +0530)]
[Clang][AArch64] Add support for -mcpu=grace

This adds Clang command line support for the NVIDIA Grace CPU [1], which
we would like to target with -mcpu=grace.

Grace is based on the Arm Neoverse V2 CPU [1], which is why, in the
driver, we pass neoverse-v2 to the compiler when grace is requested.
Thus, for now, it's an alias to Neoverse V2.

This adds support for grace in user-facing tool Clang, but not yet the
developer tools like opt and llc, so we probably want to follow up on
this.

[1] https://www.nvidia.com/en-us/data-center/grace-cpu/

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

22 months agoGlobalISel: Artifact combine merge-like and unmerges into merge-like
Petar Avramovic [Mon, 24 Oct 2022 10:54:41 +0000 (12:54 +0200)]
GlobalISel: Artifact combine merge-like and unmerges into merge-like

Recognize when sub-vectors have been split to elements which are used to
build large vector.
This happens when instructions have different vector sizes available.
For example a few arithmetic instruction are required to process all
elements of larger vector that can be stored using one instruction.

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

22 months agoGlobalISel: Artifact combine merge-like and unmerge into unmerge
Petar Avramovic [Mon, 24 Oct 2022 10:52:39 +0000 (12:52 +0200)]
GlobalISel: Artifact combine merge-like and unmerge into unmerge

Recognize when source could have been unmerged to pieces with DstTy
without having to split source to smaller elements
and then merge small elements into DstTy pieces.
This happens when vector was meant to be split to sub-vectors but there
was leftover. At this point artifact combiner have already dealt with
leftover and we can continue to use sub-vectors.

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

22 months agoGlobalISel: Artifact combine merge-like and unmerge into copy
Petar Avramovic [Mon, 24 Oct 2022 10:51:10 +0000 (12:51 +0200)]
GlobalISel: Artifact combine merge-like and unmerge into copy

Recognize copy that is represented as split of a source register to
elements that were reassembled to another register with the same type.

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

22 months agoGlobalISel: Precommit for artifact combine patches
Petar Avramovic [Mon, 24 Oct 2022 10:49:05 +0000 (12:49 +0200)]
GlobalISel: Precommit for artifact combine patches

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

22 months ago[gn build] port 97bd44f436ea
Nico Weber [Mon, 24 Oct 2022 11:32:13 +0000 (07:32 -0400)]
[gn build] port 97bd44f436ea

22 months agoAdd nocapture to pointer parameters of masked stores/loads
Benjamin Maxwell [Mon, 24 Oct 2022 09:41:19 +0000 (09:41 +0000)]
Add nocapture to pointer parameters of masked stores/loads

The lack of this attribute (particularly on the load intrinsics)
prevented InstCombine from optimizing away allocas and memcpys
for arrays that could be read directly from rodata.

This now also includes a new test to check the masked load/store
intrinsics have the expected attributes (specifically nocapture).

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

22 months ago[llvm-exegesis] Fix missing dependency in BUILD.bazel
Guillaume Chatelet [Mon, 24 Oct 2022 10:39:33 +0000 (10:39 +0000)]
[llvm-exegesis] Fix missing dependency in BUILD.bazel

This was broken by https://reviews.llvm.org/D136351

22 months ago[libc] Fix BUILD.bazel missing dependency
Guillaume Chatelet [Mon, 24 Oct 2022 10:33:58 +0000 (10:33 +0000)]
[libc] Fix BUILD.bazel missing dependency

22 months ago[libc] Use cpp::byte instead of char in mem* functions
Guillaume Chatelet [Mon, 24 Oct 2022 10:27:53 +0000 (10:27 +0000)]
[libc] Use cpp::byte instead of char in mem* functions

`cpp::byte` is better than `char` which -depending on platform- can be `signed char` or `unsigned char`.  This has introduced subtle arithmetic errors.

22 months ago[AArch64] Alter v8.5a FRINT neon intrinsics to be target-based, not preprocessor...
David Green [Mon, 24 Oct 2022 10:22:06 +0000 (11:22 +0100)]
[AArch64] Alter v8.5a FRINT neon intrinsics to be target-based, not preprocessor based

This switches the v8.5-a FRINT intrinsics over to be target-gated,
behind preprocessor defines. This one is pretty simple, being AArch64
only.

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

22 months ago[lldb] Add LLVM include dirs prior to gtest target in standalone build
Michał Górny [Sun, 23 Oct 2022 12:52:22 +0000 (14:52 +0200)]
[lldb] Add LLVM include dirs prior to gtest target in standalone build

Move include_directories() declaration before gtest targets are created
in standalone build.  This fixes build failure due to gtest targets
being unable to find LLVM headers, e.g.:

    /var/tmp/portage/dev-util/lldb-16.0.0_pre20221023/work/llvm/utils/unittest/googletest/include/gtest/internal/custom/raw-ostream.h:43:10: fatal error: llvm/ADT/Optional.h: No such file or directory

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

22 months ago[LLDB] Check that RegisterInfo and ContextInfo are trivial
David Spickett [Mon, 24 Oct 2022 08:54:33 +0000 (08:54 +0000)]
[LLDB] Check that RegisterInfo and ContextInfo are trivial

RegisterInfo is often initialised with a memcpy, and ContextInfo
does not run destructors for anything within it.

This was discussed in https://reviews.llvm.org/D134041.

Reviewed By: labath

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

22 months ago[libc] Fix generic 32-bit implementation of Bcmp/Memcmp
Guillaume Chatelet [Mon, 24 Oct 2022 10:15:28 +0000 (10:15 +0000)]
[libc] Fix generic 32-bit implementation of Bcmp/Memcmp

22 months ago[libc] Fix broken tests on arm32
Guillaume Chatelet [Mon, 24 Oct 2022 09:54:19 +0000 (09:54 +0000)]
[libc] Fix broken tests on arm32

22 months ago[llvm-exegesis] getNonRedundantWriteProcRes - perform basic toplogical sorting (PR58500)
Simon Pilgrim [Mon, 24 Oct 2022 09:46:04 +0000 (10:46 +0100)]
[llvm-exegesis] getNonRedundantWriteProcRes - perform basic toplogical sorting (PR58500)

getNonRedundantWriteProcRes was assuming that tblgen topologically sorted the cpu ModelProcResources[] arrays so that resource units were declared before the resource groups that used them, but unfortunately that doesn't appear to be true - in most cases it was just getting lucky based off the alphanumeric sorting that was being performed and the choice of the resource pipe names in most scheduler models (Intel models in particular).

This patch adds an explicit sort, based off llvm-mca's initializeUsedResources, that sorts by resource mask - I'm hoping this basic sorting is enough, I don't think overlapping groups or Super resources are a problem.

I'd like to take this further in the future and start sharing more code between llvm-mca and llvm-exegesis - while triaging this bug I saw how similar both approaches are, but are just dissimilar enough that any refactor isn't going to be trivial :(

Working with @courbet on a follow up unit test

Fixes #58500
Fixes #37045

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

22 months ago[DAG] Fold (abs (sign_extend_inreg x)) -> (zero_extend (abs (truncate x))) (PR43370)
Simon Pilgrim [Mon, 24 Oct 2022 09:27:00 +0000 (10:27 +0100)]
[DAG] Fold (abs (sign_extend_inreg x)) -> (zero_extend (abs (truncate x))) (PR43370)

If the upper half of an abs() is all sign bits, then we can perform the abs() using just the lower half and then zero extend.

I've limited the DAG combine to only sign_extend_inreg (and free truncate/zero_extend) to minimise any later promotion issues, but for legalization a similar fold can use ComputeNumSignBits to be more aggressive.

Alive2: https://alive2.llvm.org/ce/z/y32fS4

Fixes #43370

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

22 months ago[libc] mem* framework v3
Guillaume Chatelet [Sat, 22 Oct 2022 11:23:04 +0000 (11:23 +0000)]
[libc] mem* framework v3

This version is more composable and also simpler at the expense of being more explicit and more verbose.

This patch provides rationale for the framework, implementation and unit tests but the functions themselves are still using the previous version. The change in implementation will come in a follow up patch.

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

22 months ago[RISCV] Add Svnapot extension
Piyou Chen [Mon, 24 Oct 2022 08:26:46 +0000 (01:26 -0700)]
[RISCV] Add Svnapot extension

Reviewed By: kito-cheng

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

22 months ago[gn build] Port e98a4c5acb37
LLVM GN Syncbot [Mon, 24 Oct 2022 07:30:12 +0000 (07:30 +0000)]
[gn build] Port e98a4c5acb37

22 months ago[llvm-debuginfo-analyzer] (07/09) - Compare elements
Carlos Alberto Enciso [Mon, 24 Oct 2022 06:18:36 +0000 (07:18 +0100)]
[llvm-debuginfo-analyzer] (07/09) - Compare elements

llvm-debuginfo-analyzer is a command line tool that processes debug
info contained in a binary file and produces a debug information
format agnostic “Logical View”, which is a high-level semantic
representation of the debug info, independent of the low-level
format.

The code has been divided into the following patches:

1) Interval tree
2) Driver and documentation
3) Logical elements
4) Locations and ranges
5) Select elements
6) Warning and internal options
7) Compare elements
8) ELF Reader
9) CodeView Reader

Full details:
https://discourse.llvm.org/t/llvm-dev-rfc-llvm-dva-debug-information-visual-analyzer/62570

This patch:

Compare elements
- Support for logical elements comparison. See '--compare' options.
  LVCompare

Reviewed By: psamolysov, probinson

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

22 months ago[mlir][interfaces] Remove getDestinationOperands from TilingInterface
Matthias Springer [Mon, 24 Oct 2022 07:17:44 +0000 (09:17 +0200)]
[mlir][interfaces] Remove getDestinationOperands from TilingInterface

`getDestinationOperands` was almost a duplicate of `DestinationStyleOpInterface::getOutputOperands`. Now that the interface has been moved to mlir/Interfaces, it is no longer needed.

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

22 months ago[SelectionDAG] Use std::clamp (NFC)
Kazu Hirata [Mon, 24 Oct 2022 07:23:51 +0000 (00:23 -0700)]
[SelectionDAG] Use std::clamp (NFC)

22 months ago[ADT] Remove redundant typename (NFC)
Kazu Hirata [Mon, 24 Oct 2022 07:14:56 +0000 (00:14 -0700)]
[ADT] Remove redundant typename (NFC)

22 months ago[LoongArch] Add support for ISD::FRAMEADDR and ISD::RETURNADDR
gonglingqin [Mon, 24 Oct 2022 06:49:04 +0000 (14:49 +0800)]
[LoongArch] Add support for ISD::FRAMEADDR and ISD::RETURNADDR

For now, only support lowering frame/return address for current frame.

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

22 months ago[mlir][Bazel] Port 3bef1e0f4c1d7fd901b58abe0c5c0e67da764ba2
Adrian Kuegel [Mon, 24 Oct 2022 07:10:30 +0000 (09:10 +0200)]
[mlir][Bazel] Port 3bef1e0f4c1d7fd901b58abe0c5c0e67da764ba2

22 months ago[mlir:LLVM] Add attribute/op definitions for debug info
River Riddle [Sat, 22 Oct 2022 21:13:20 +0000 (14:13 -0700)]
[mlir:LLVM] Add attribute/op definitions for debug info

This adds a subset of the necessary metadata for defining
debug info in the LLVM dialect. It doesn't import everything,
but just enough to start actually generating LLVM debug info
the expected way. Export/Import to LLVMIR will be added in a
followup.

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

22 months ago[mlir] Refactor alias generation to support nested aliases
River Riddle [Sat, 22 Oct 2022 21:01:41 +0000 (14:01 -0700)]
[mlir] Refactor alias generation to support nested aliases

We currently only support one level of aliases, which isn't great
in situations where an attribute/type can have multiple duplicated
components nested within it(e.g. debuginfo metadata). This commit
refactors alias generation to support nested aliases, which requires
changing alias grouping to take into account the depth of child
aliases, to ensure that attributes/types aren't printed before the
aliases they use.

The only real user facing change here was that we no longer print
0 as an alias suffix, which would be unnecessarily expensive to keep
in the new alias generation method (and isn't that valuable of a
behavior to preserve).

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

22 months ago[mlir] Better handling for bit groups in enum parser/printer
River Riddle [Sat, 22 Oct 2022 20:57:15 +0000 (13:57 -0700)]
[mlir] Better handling for bit groups in enum parser/printer

We currently wrap all multi-bit cases with a string, but this is
overly restrictive. This commit refactors to use keywords when
we know they are valid, and only degrade to string when the validity
of the bitgroup is unknown.

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

22 months ago[lldb][Test] Add CPlusPlusNameParser unit-test: C-array function arguments
Michael Buch [Mon, 24 Oct 2022 06:42:01 +0000 (07:42 +0100)]
[lldb][Test] Add CPlusPlusNameParser unit-test: C-array function arguments

Tests that `CPlusPlusLanguage::MethodName` can parse demangled
names that contain references to C-arrays.

Example taken from libcxx API in the wild.

22 months ago[LIT] Add AArch64/Windows to LP64 feature
Muhammad Omair Javaid [Mon, 17 Oct 2022 11:32:40 +0000 (16:32 +0500)]
[LIT] Add AArch64/Windows to LP64 feature

This patch adds AArch64 to the LP64 feature to avoid running LLP64
incompatible test on AArch64/Windows platform.

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

22 months ago[AMDGPU] Autogenerate icmp codegen test
Pierre van Houtryve [Fri, 21 Oct 2022 13:19:31 +0000 (13:19 +0000)]
[AMDGPU] Autogenerate icmp codegen test

Switch to autogenerated tests so we can use the same test for GISel and DAGIsel.

Reviewed By: arsenm

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

22 months ago[mlir] Fix a warning
Kazu Hirata [Mon, 24 Oct 2022 06:24:59 +0000 (23:24 -0700)]
[mlir] Fix a warning

This patch fixes:

  mlir/include/mlir/IR/PatternMatch.h:1092:63: warning: parameter
  ‘values’ set but not used [-Wunused-but-set-parameter]

22 months ago[Clang] Change AnonStructIds in MangleContext to per-function based
Rong Xu [Mon, 24 Oct 2022 05:31:10 +0000 (22:31 -0700)]
[Clang] Change AnonStructIds in MangleContext to per-function based

Clang is generating different mangled names for the same lambda
function in slightly changed builds (like with non-related
source/Macro change). This is due to the fact that clang uses a
cross-translation-unit sequential string "$_<n>" in lambda's
mangled name. Here, "n" is the AnonStructIds field in MangleContext.

Different mangled names for a unchanged function is undesirable:
it makes perf comparison harder, and can cause some unnecessary
profile mismatch in SampleFDO.

This patch makes mangled name for lambda functions more stable
by changing AnonStructIds to a per-function based seq number if the
DeclContext is a function.

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

22 months ago[llvm-debuginfo-analyzer] Fix shared build. NFC.
Michael Liao [Mon, 24 Oct 2022 05:32:34 +0000 (01:32 -0400)]
[llvm-debuginfo-analyzer] Fix shared build. NFC.

22 months ago[llvm-debuginfo-analyzer] (06/09) - Warning and internal options
Carlos Alberto Enciso [Mon, 24 Oct 2022 04:55:47 +0000 (05:55 +0100)]
[llvm-debuginfo-analyzer] (06/09) - Warning and internal options

The 'clang-ppc64le-linux-multistage24452' buildbot fails with:

  https://lab.llvm.org/buildbot#builders/121/builds/24452
  undefined reference to `llvm::dwarf::TagString(unsigned int)'

Add 'DebugInfoDWARF' in the CMakeLists.txt CMake file.

22 months ago[NFC][X86] Fix typo: stric => strict
Sheng [Mon, 24 Oct 2022 04:56:26 +0000 (04:56 +0000)]
[NFC][X86] Fix typo: stric => strict

22 months ago[gn build] Port 2c155d379960
LLVM GN Syncbot [Mon, 24 Oct 2022 04:14:21 +0000 (04:14 +0000)]
[gn build] Port 2c155d379960

22 months ago[llvm-debuginfo-analyzer] (06/09) - Warning and internal options
Carlos Alberto Enciso [Fri, 21 Oct 2022 05:08:48 +0000 (06:08 +0100)]
[llvm-debuginfo-analyzer] (06/09) - Warning and internal options

llvm-debuginfo-analyzer is a command line tool that processes debug
info contained in a binary file and produces a debug information
format agnostic “Logical View”, which is a high-level semantic
representation of the debug info, independent of the low-level
format.

The code has been divided into the following patches:

1) Interval tree
2) Driver and documentation
3) Logical elements
4) Locations and ranges
5) Select elements
6) Warning and internal options
7) Compare elements
8) ELF Reader
9) CodeView Reader

Full details:
https://discourse.llvm.org/t/llvm-dev-rfc-llvm-dva-debug-information-visual-analyzer/62570

This patch:

Warning and internal options
- Support for '--warning' options.
- Support for '--internal' options.

Reviewed By: psamolysov, probinson

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

22 months ago[mlir] Support overriding LLVM_LIT_ARGS in standalone builds
Michał Górny [Sun, 23 Oct 2022 17:08:47 +0000 (19:08 +0200)]
[mlir] Support overriding LLVM_LIT_ARGS in standalone builds

Introduce LLVM_LIT_ARGS cache variable in standalone builds, to let
the caller override the options passed by LLVM to lit calls.  Once
defined, this is automatically handled by LLVM's cmake logic.

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

22 months ago[NFC][M68k] Update the status of ISA implementation
Sheng [Mon, 24 Oct 2022 01:37:48 +0000 (09:37 +0800)]
[NFC][M68k] Update the status of ISA implementation

LINK/UNLNK have been implemented in 64d326c33c6d3f008.

22 months ago[flang] Add atomic_define and atomic_ref to list of intrinsics
Katherine Rasmussen [Tue, 20 Sep 2022 22:35:48 +0000 (15:35 -0700)]
[flang] Add atomic_define and atomic_ref to list of intrinsics

Add the atomic subroutines, atomic_define and atomic_ref, to the
list of intrinsic subroutines. Add a new function
CheckAtomicDefineAndRef to check that for each of these procedures,
that their value arguments are the same type as their atom
arguments, and that their 3rd argument is not coindexed.

Reviewed By: PeteSteinfeld

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

22 months ago[clang] Fix time profile in "isIntegerConstantExpr"
Evgeny Shulgin [Sun, 23 Oct 2022 11:00:41 +0000 (11:00 +0000)]
[clang] Fix time profile in "isIntegerConstantExpr"

The time profiler in `Expr::isIntegerConstantExpr` used to
call `Loc->printToString`, it was inconsistent with other time
profiles in the file and caused segfaults if `Loc` was `nullptr`.

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

Reviewed By: dyung, jloser

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

22 months agollvm-reduce: Add conditional reduction passes
Matt Arsenault [Thu, 13 Oct 2022 21:42:15 +0000 (14:42 -0700)]
llvm-reduce: Add conditional reduction passes

Copy this technique from bugpoint. Before trying to blindly
delete blocks, try to fold branch conditions. This intuitively
makes more sense for a faster reduction, since you can find
dead paths in the function to prune out before trying to bisect
blocks in source order.

Seems to provide some speedup on my multi-hour reduction samples.

This does have the potential to produce testcases with unreachable
blocks. This is already a problem with the existing block
reduction pass. I'm struggling dealing with invalid reductions
in these cases, so in the future this should probably start
deleting those. However, I do sometimes try to reduce failures
in code that becomes unreachable, so I'm not totally sure
what to do here.

22 months agollvm-reduce: Fix opcode reduction leaving behind dead instructions
Matt Arsenault [Sat, 22 Oct 2022 16:38:33 +0000 (09:38 -0700)]
llvm-reduce: Fix opcode reduction leaving behind dead instructions

ce3c3cb2912425bb4367bfbe9a4c68a6d6f0a04a broke this by
speculatively making transforms before checking shouldKeep.
Originally I tried to roll back changes to the IR, but it's probably
best to not touch it before querying.

22 months ago[M68k][NFC] Use OS and ABI agnostic triple in codegen tests
Min-Yih Hsu [Sun, 23 Oct 2022 21:36:35 +0000 (14:36 -0700)]
[M68k][NFC] Use OS and ABI agnostic triple in codegen tests

Use 'm68k' (i.e. m68k-unknown-unknown) in all codegen tests rather
than m68k-linux-gnu. NFC.

22 months ago[gn build] Port 596fdf75d99f
LLVM GN Syncbot [Sun, 23 Oct 2022 22:17:33 +0000 (22:17 +0000)]
[gn build] Port 596fdf75d99f

22 months ago[gn build] Port 27902eea0f0a
LLVM GN Syncbot [Sun, 23 Oct 2022 22:17:32 +0000 (22:17 +0000)]
[gn build] Port 27902eea0f0a

22 months agoCodeExtractor: Fix assertion with non-0 alloca address spaces
Matt Arsenault [Wed, 19 Oct 2022 04:00:33 +0000 (21:00 -0700)]
CodeExtractor: Fix assertion with non-0 alloca address spaces

emitCallAndSwitchStatement creates placeholder allocas to pass
to these, so the types need to match.

22 months agollvm-reduce: Remove okToRemove logic in block reduction
Matt Arsenault [Tue, 18 Oct 2022 23:51:50 +0000 (16:51 -0700)]
llvm-reduce: Remove okToRemove logic in block reduction

This was making decisions based on BBsToDelete, while being
used to determine BBsToDelete which doesn't really work.
Additionally, this is a lot of logic just to avoid deleting
the entry block when we can just skip it.

22 months agollvm-reduce: Fix some broken test checks
Matt Arsenault [Sun, 23 Oct 2022 17:40:08 +0000 (10:40 -0700)]
llvm-reduce: Fix some broken test checks

22 months agollvm-reduce: Add a reduction to replace atomics with non-atomics
Matt Arsenault [Fri, 21 Oct 2022 21:59:07 +0000 (14:59 -0700)]
llvm-reduce: Add a reduction to replace atomics with non-atomics

Make load and store non-atomic. Make the others monotonic.

We could probably try to incrementally relax the orderings; not sure
how useful that would be.

22 months agollvm-reduce: Add atomic syncscope reduction
Matt Arsenault [Fri, 21 Oct 2022 21:45:28 +0000 (14:45 -0700)]
llvm-reduce: Add atomic syncscope reduction

22 months agollvm-reduce: Add volatile reduction pass
Matt Arsenault [Fri, 21 Oct 2022 21:03:51 +0000 (14:03 -0700)]
llvm-reduce: Add volatile reduction pass

Removing volatile may help optimization passes do more to the IR. However,
this will increase scheduler freedom.

22 months agollvm-reduce: Add flag reduction pass
Matt Arsenault [Fri, 21 Oct 2022 17:37:52 +0000 (10:37 -0700)]
llvm-reduce: Add flag reduction pass

Try to remove each flag from instructions. It may make more
sense to introduce these flags instead.

22 months agollvm-reduce: Don't use unreachable blocks in remove-bbs test
Matt Arsenault [Wed, 19 Oct 2022 17:59:34 +0000 (10:59 -0700)]
llvm-reduce: Don't use unreachable blocks in remove-bbs test

A future change will skip the reduction for functions with
unreachable blocks. Also stop using the hard to follow python based
interestingness check in favor of FileCheck.

22 months ago[CMake] Drop libLTO and switch to PIE for Fuchsia toolchain
Petr Hosek [Fri, 7 Oct 2022 18:20:34 +0000 (18:20 +0000)]
[CMake] Drop libLTO and switch to PIE for Fuchsia toolchain

All our users have migrated to ld64.lld so we no longer need libLTO.

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

22 months ago[ORC] Remove reference to incomplete type in debugging output.
Lang Hames [Sun, 23 Oct 2022 21:29:12 +0000 (14:29 -0700)]
[ORC] Remove reference to incomplete type in debugging output.

22 months ago[RISCV] Make selectShiftMask look for negate opportunities after looking through...
Craig Topper [Sun, 23 Oct 2022 21:08:31 +0000 (14:08 -0700)]
[RISCV] Make selectShiftMask look for negate opportunities after looking through AND.

Previously we would only look for an AND or a negate. But its
possible there is a negate after looking through the AND.

22 months agoRevert "[Lex] Simplify and cleanup the updateConsecutiveMacroArgTokens implementation."
Alexander Kornienko [Sun, 23 Oct 2022 20:54:47 +0000 (22:54 +0200)]
Revert "[Lex] Simplify and cleanup the updateConsecutiveMacroArgTokens implementation."

This reverts commit 74e4f778cf16cbf7163b5c6de6027a43f5e9169f, which caused a
~40% increase in SLoc address space utilization on certain cases. See
https://reviews.llvm.org/D136539#3877872.

22 months agoRevert "[TokenLexer][NFC] Rename the InstLoc to ExpandLoc"
Alexander Kornienko [Sun, 23 Oct 2022 20:52:39 +0000 (22:52 +0200)]
Revert "[TokenLexer][NFC] Rename the InstLoc to ExpandLoc"

This reverts commit f83347b0bedb22ea676861c8e4e2ed9c31371ade. This is necessary
to revert 74e4f778cf16cbf7163b5c6de6027a43f5e9169f, which caused a ~40% increase
in SLoc address space utilization on certain cases. See
https://reviews.llvm.org/D136539#3877872.

22 months ago[ORC] Reset MaterializationUnit::InitSymbol if the init symbol is discarded.
Lang Hames [Sun, 23 Oct 2022 20:26:24 +0000 (13:26 -0700)]
[ORC] Reset MaterializationUnit::InitSymbol if the init symbol is discarded.

Discarding the init symbol is expected to be uncommon (it represents metadata
in the MaterializationUnit that is relevant to dlopen, and this will not
usually be fully duplicated in some other location), however if a client has
marked an InitSymbol as weak and it is selected to be discarded then we should
keep the data structure consistent.

22 months ago[ORC] Force linking of eh-frame registration functions from LLJIT.cpp.
Lang Hames [Sun, 23 Oct 2022 20:07:52 +0000 (13:07 -0700)]
[ORC] Force linking of eh-frame registration functions from LLJIT.cpp.

Since aedeb8d5570, which switched to EPC-based eh-frame registrationin LLJIT,
the eh-frame registration functions need to be forcibly linked into the target
process.

Failure to link the eh-frame registration functions triggered a test failure in
https://green.lab.llvm.org/green/job/clang-stage1-RA/31497, which was fixed by
forcibly linking the registration functions into that test case in saf2b2214b4
(rdar://101083784), however it has also caused some tests (e.g. the C API unit
tests) that depend on successful construction of an LLJIT instance to be
skipped.

Moving the forcible registration into LLJIT.cpp fixes the general issue.

22 months ago[test] Use new pass manager syntax in some tests
Arthur Eubanks [Sun, 23 Oct 2022 20:43:39 +0000 (13:43 -0700)]
[test] Use new pass manager syntax in some tests

To prepare for upcoming change.

22 months ago[SLP][NFC] Added test to check resulting mask in shufflevector as per order of phinodes
skc7 [Sun, 23 Oct 2022 15:21:59 +0000 (15:21 +0000)]
[SLP][NFC] Added test to check resulting mask in shufflevector as per order of phinodes

Reviewed By: ABataev

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

22 months ago[X86] Add abs(sext_inreg(x)) test coverage for Issue #43370
Simon Pilgrim [Sun, 23 Oct 2022 17:15:58 +0000 (18:15 +0100)]
[X86] Add abs(sext_inreg(x)) test coverage for Issue #43370

22 months ago[mlir] Fix a warning
Kazu Hirata [Sun, 23 Oct 2022 17:11:20 +0000 (10:11 -0700)]
[mlir] Fix a warning

This patch fixes:

  mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp:128:10: warning:
  variable ‘llvm2xI32’ set but not used [-Wunused-but-set-variable]

The last use of llvm2xI32 was removed on July 6, 2022 in commit
63295622491a31eaccb6c534ba5caa836beb843f.

22 months ago[clang] Fix a warning
Kazu Hirata [Sun, 23 Oct 2022 16:34:49 +0000 (09:34 -0700)]
[clang] Fix a warning

This patch fixes:

  clang/lib/AST/Interp/ByteCodeExprGen.cpp:978:24: warning: variable
  ‘T’ set but not used [-Wunused-but-set-variable]

T and ReturnType were introduced on August 19, 2022 in commit
8e41e6a4eafa2b667ec37ece33a85493fe0156c2.

Their last uses were removed on October 13, 2022 in commit
0e754cfadc9487282d9b6119c41962c5c6c3660f.

22 months ago[X86][AVX512] Fold extract_element(bitcast(<X x i1>) -> bitcast(extract_subvector())
Simon Pilgrim [Sun, 23 Oct 2022 13:47:19 +0000 (14:47 +0100)]
[X86][AVX512] Fold extract_element(bitcast(<X x i1>) -> bitcast(extract_subvector())

On AVX512, extract legal bool vectors as bool subvectors before bitcasting to scalars to avoid spilling to stack.

This helps rust which internally represents bool vectors as bool arrays

It also exposes more missed opportunities to use the KADD instruction to add masks together before moving to gpr

Fixes #58546

22 months ago[tests] precommit tests for D136015
zhongyunde [Sat, 22 Oct 2022 12:30:29 +0000 (20:30 +0800)]
[tests] precommit tests for D136015

Address the commit https://reviews.llvm.org/D136015#inline-1313479

Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D136340

22 months ago[X86] Add test case for Issue #58546
Simon Pilgrim [Sun, 23 Oct 2022 13:27:37 +0000 (14:27 +0100)]
[X86] Add test case for Issue #58546

22 months ago[ADT] APInt.h - remove <cmath> include. NFC.
Simon Pilgrim [Sun, 23 Oct 2022 11:44:14 +0000 (12:44 +0100)]
[ADT] APInt.h - remove <cmath> include. NFC.

We only need this for std::abs, but since we're also testing the sign of the same value, then its not really necessary.

As detailed in https://commondatastorage.googleapis.com/chromium-browser-clang/llvm-include-analysis.html - APInt.h is the generic header with the highest expanded size, due to the dependency on <cmath>

22 months ago[ADT] APInt.cpp - remove <cstring> duplicate. NFC.
Simon Pilgrim [Sun, 23 Oct 2022 11:40:13 +0000 (12:40 +0100)]
[ADT] APInt.cpp - remove <cstring> duplicate. NFC.

This is already included in APInt.h

22 months ago[spirv] Remove unused include
Benjamin Kramer [Sun, 23 Oct 2022 11:23:40 +0000 (13:23 +0200)]
[spirv] Remove unused include

22 months ago[DAG] Add freeze(sign/zero_extend_vector_inreg(x)) -> sign/zero_extend_vector_inreg...
Simon Pilgrim [Sun, 23 Oct 2022 11:19:36 +0000 (12:19 +0100)]
[DAG] Add freeze(sign/zero_extend_vector_inreg(x)) -> sign/zero_extend_vector_inreg(freeze(x)) folding

22 months agoclean up std::iterator in LibcBenchmark.h
Schrodinger ZHU Yifan [Sun, 23 Oct 2022 10:30:37 +0000 (10:30 +0000)]
clean up std::iterator in LibcBenchmark.h

Reviewed By: gchatelet

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

22 months ago[libc] Add missing is_unsigned in type_traits.h
Guillaume Chatelet [Sun, 23 Oct 2022 10:08:44 +0000 (12:08 +0200)]
[libc] Add missing is_unsigned in type_traits.h

22 months ago[clang][unittest] Resolve ClangSupportTest link time errors
John McIver [Sun, 23 Oct 2022 09:53:17 +0000 (09:53 +0000)]
[clang][unittest] Resolve ClangSupportTest link time errors

Resolves undefined references to vtable for clang::ASTConsumer,
PCHContainerOperations::PCHContainerOperations(), and
CodeGenOptions::CodeGenOptions().

Reviewed By: Izaron

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