platform/upstream/llvm.git
2 years ago[BOLT] Fix concurrent hash table modification in the instrumentation runtime
Michał Chojnowski [Thu, 7 Jul 2022 10:54:51 +0000 (13:54 +0300)]
[BOLT] Fix concurrent hash table modification in the instrumentation runtime

`__bolt_instr_data_dump()` does not lock the hash tables when iterating
over them, so the iteration can happen concurrently with a modification
done in another thread, when the table is in an inconsistent state. This
also has been observed in practice, when it caused a segmentation fault.

We fix this by locking hash tables during iteration. This is done by taking
the lock in `forEachElement()`.
The only other site of iteration, `resetCounters()`, has been correctly
locking the table even before this patch. This patch removes its `Lock`
because the lock is now taken in the inner `forEachElement()`.

Reviewed By: maksfb, yota9

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

2 years ago[mlir] Transform dialect: introduce merge_handles op
Alex Zinenko [Thu, 7 Jul 2022 11:11:34 +0000 (13:11 +0200)]
[mlir] Transform dialect: introduce merge_handles op

This Transform dialect op allows one to merge the lists of Payload IR
operations pointed to by several handles into a single list associated with one
handle. This is an important Transform dialect usability improvement for cases
where transformations may temporarily diverge for different groups of Payload
IR ops before converging back to the same script. Without this op, several
copies of the trailing transformations would have to be present in the
transformation script.

Depends On D129090

Reviewed By: nicolasvasilache

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

2 years ago[mlir] Structured transforms: introduce op splitting
Alex Zinenko [Thu, 7 Jul 2022 11:10:40 +0000 (13:10 +0200)]
[mlir] Structured transforms: introduce op splitting

Introduce a new transformation on structured ops that splits the iteration
space into two parts along the specified dimension. The index at which the
splitting happens may be static or dynamic. This transformation can be seen as
a rudimentary form of index-set splitting that only supports the splitting
along hyperplanes parallel to the iteration space hyperplanes, and is therefore
decomposable into per-dimension application.

It is a key low-level transformation that enables independent scheduling for
different parts of the iteration space of the same op, which hasn't been
possible previously. It may be used to implement, e.g., multi-sized tiling. In
future, peeling can be implemented as a combination of split-off amount
computation and splitting.

The transformation is conceptually close to tiling in its separation of the
iteration and data spaces, but cannot be currently implemented on top of
TilingInterface as the latter does not properly support `linalg.index`
offsetting.

Note that the transformation intentionally bypasses folding of
`tensor.extract_slice` operations when creating them as this folding was found
to prevent repeated splitting of the same operation because due to internal
assumptions about extract/insert_slice combination in dialect utilities.

Reviewed By: nicolasvasilache

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

2 years agoFix use of uninitialized member in constructor
Sven van Haastregt [Thu, 7 Jul 2022 11:05:24 +0000 (12:05 +0100)]
Fix use of uninitialized member in constructor

The constructor does `Saver(Alloc)`, so `Alloc` should be
initialized first.  Move `Alloc` up in the declaration order.

Fixes a -Wuninitialized warning when building with GCC 12.1.

Reported-by: Mihail Atanassov <mihail.atanassov@arm.com>
2 years ago[doc][ReleaseNotes] Document AArch64 SVE ABI fix from D127209
Peter Waller [Tue, 5 Jul 2022 09:16:31 +0000 (09:16 +0000)]
[doc][ReleaseNotes] Document AArch64 SVE ABI fix from D127209

D127209 fixed LLVM to bring it in line with the AAPCS. The fix affects
functions where the first SVE parameter appears in the 9th or later
arguments, and the function does not return an SVE type.

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

2 years ago[mlir][ods] Replace redundant `Type` instances for interfaces
Markus Böck [Wed, 6 Jul 2022 15:39:18 +0000 (17:39 +0200)]
[mlir][ods] Replace redundant `Type` instances for interfaces

This patch makes use of TypeInterface implementing Type to remove instances of Type that simply checked whether a type implemented a given interface.
As part of this refactoring, some changes had to be done in the OpenMP Dialect files. In particular, they assumed that OpenMPOps.td to only ever include OpenMP TypeInterfaces, which did not hold anymore with a moved include in LLVMOpBase.td. For that reason, the type interface defintions were moved into a new file as is convention.

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

2 years ago[mlir][ods] Make Type- and AttrInterfaces also `Type`s and `Attr`s
Markus Böck [Wed, 6 Jul 2022 14:42:21 +0000 (16:42 +0200)]
[mlir][ods] Make Type- and AttrInterfaces also `Type`s and `Attr`s

By making TypeInterfaces and AttrInterfaces, Types and Attrs respectively it'd then be possible to use them anywhere where a Type or Attr may go. That is within the arguments and results of an Op definition, in a RewritePattern etc.

Prior to this change users had to separately define a Type or Attr, with a predicate to check whether a type or attribute implements a given interface. Such code will be redundant now.
Removing such occurrences in upstream dialects will be part of a separate patch.

As part of implementing this patch, slight refactoring had to be done. In particular, Interfaces cppClassName field was renamed to cppInterfaceName as it "clashed" with TypeConstraints cppClassName. In particular Interfaces cppClassName expected just the class name, without any namespaces, while TypeConstraints cppClassName expected a fully qualified class name.

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

2 years ago[LegalizeTypes] Replace vecreduce_xor/or/and with vecreduce_add/umax/umin if not...
Bradley Smith [Wed, 29 Jun 2022 10:26:17 +0000 (10:26 +0000)]
[LegalizeTypes] Replace vecreduce_xor/or/and with vecreduce_add/umax/umin if not legal

This is done during type legalization since the target representation of
these nodes may not be valid until after type legalization, and after
type legalization the fact that these are dealing with i1 types may be
lost.

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

2 years ago[VectorCombine] Avoid creating shuffle for extract-extract pattern on scalable vector.
Sander de Smalen [Thu, 7 Jul 2022 07:58:40 +0000 (07:58 +0000)]
[VectorCombine] Avoid creating shuffle for extract-extract pattern on scalable vector.

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

Reviewed By: fhahn

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

2 years ago[VectorCombine] NFC: rename test extract-cmp-binop.ll to extract-scalable.ll
Sander de Smalen [Thu, 7 Jul 2022 07:58:32 +0000 (07:58 +0000)]
[VectorCombine] NFC: rename test extract-cmp-binop.ll to extract-scalable.ll

2 years ago[GlobalsModRef] Don't override getModRefBehavior() for CallBase
Nikita Popov [Thu, 7 Jul 2022 08:31:53 +0000 (10:31 +0200)]
[GlobalsModRef] Don't override getModRefBehavior() for CallBase

BasicAA will already call getModRefBehavior() on the Function of
the CallBase if there are no operand bundles. This happens through
getBestAAResults(), i.e. it is a recursive call that will query
other AA providers, not just the BasicAA implementation.

As such, there is no need to reimplement the same functionality
in GlobalsModRef, a combination of BasicAA and GlobalsModRef already
handles it. This does mean that this no longer works under
-disable-basic-aa, but that's a testing only option.

2 years ago[clang-format] Avoid crash in LevelIndentTracker.
Marek Kurdej [Mon, 4 Jul 2022 09:28:25 +0000 (11:28 +0200)]
[clang-format] Avoid crash in LevelIndentTracker.

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

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

2 years ago[mlir][vector][bufferize] Fix transfer_write dropping mask operand
Matthias Springer [Thu, 7 Jul 2022 07:01:50 +0000 (09:01 +0200)]
[mlir][vector][bufferize] Fix transfer_write dropping mask operand

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

2 years ago[AArch64][SME] Update load/store intrinsics to take predicate corresponding to elemen...
Sander de Smalen [Wed, 6 Jul 2022 16:14:51 +0000 (16:14 +0000)]
[AArch64][SME] Update load/store intrinsics to take predicate corresponding to element size.

Instead of using <vscale x 16 x i1> for all the loads/stores, we now use the appropriate
predicate type according to the element size, e.g.

  ld1b uses <vscale x 16 x i1>
  ld1w uses <vscale x 4 x i1>
  ld1q uses <vscale x 1 x i1>

Reviewed By: kmclaughlin

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

2 years ago[AArc64] Legalisation of compares and truncates of nxv1i1 types.
Sander de Smalen [Wed, 6 Jul 2022 16:14:38 +0000 (16:14 +0000)]
[AArc64] Legalisation of compares and truncates of nxv1i1 types.

Truncates and compares require some changes to generic legalisation functions
to use ElementCount instead of getNumElements.

Reviewed By: paulwalker-arm

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

2 years ago[LSR] Regenerate test checks (NFC)
Nikita Popov [Thu, 7 Jul 2022 07:35:01 +0000 (09:35 +0200)]
[LSR] Regenerate test checks (NFC)

2 years ago[llvm][Debuginfod][Bazel] Match dependencies in CMakeLists.txt.
Adrian Kuegel [Thu, 7 Jul 2022 06:31:43 +0000 (08:31 +0200)]
[llvm][Debuginfod][Bazel] Match dependencies in CMakeLists.txt.

Also update llvm-config.h and llvm-config.h.cmake to match 484b1aa611caa70c8a80b46060cc340bbeee8306

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

2 years ago[BasicBlockUtils] Allow splitting predecessors with callbr terminators
Nikita Popov [Wed, 6 Jul 2022 14:15:34 +0000 (16:15 +0200)]
[BasicBlockUtils] Allow splitting predecessors with callbr terminators

SplitBlockPredecessors currently asserts if one of the predecessor
terminators is a callbr. This limitation was originally necessary,
because just like with indirectbr, it was not possible to replace
successors of a callbr. However, this is no longer the case since
D67252. As the requirement nowadays is that callbr must reference
all blockaddrs directly in the call arguments, and these get
automatically updated when setSuccessor() is called, we no longer
need this limitation.

The only thing we need to do here is use replaceSuccessorWith()
instead of replaceUsesOfWith(), because only the former does the
necessary blockaddr updating magic.

I believe there's other similar limitations that can be removed,
e.g. related to critical edge splitting.

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

2 years ago[NFC] [Coroutines] Update the comments for lowering coro.save
Chuanqi Xu [Thu, 7 Jul 2022 06:57:07 +0000 (14:57 +0800)]
[NFC] [Coroutines] Update the comments for lowering coro.save

The original comment is not right. We don't store 0 all the time.

2 years ago[clang-tidy] Fix confusable identifier interaction with unavailable class def
serge-sans-paille [Wed, 6 Jul 2022 14:34:44 +0000 (10:34 -0400)]
[clang-tidy] Fix confusable identifier interaction with unavailable class def

Fix #56404

2 years ago[libc++[format][NFC] Removes dead code.
Mark de Wever [Tue, 28 Dec 2021 17:48:04 +0000 (18:48 +0100)]
[libc++[format][NFC] Removes dead code.

This removes a part of the now obsolete formater code.
The removal also removes the _v2 suffix where it's no longer needed.

Depends on D128785

Reviewed By: #libc, ldionne

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

2 years ago[libc++][format] Improve floating-point formatters.
Mark de Wever [Tue, 28 Dec 2021 17:48:04 +0000 (18:48 +0100)]
[libc++][format] Improve floating-point formatters.

This changes the implementation of the formatter. Instead of inheriting
from a specialized parser all formatters will use the same generic
parser. This reduces the binary size.

The new parser contains some additional fields only used in the chrono
formatting. Since this doesn't change the size of the parser the fields
are in the generic parser. The parser is designed to fit in 128-bit,
making it cheap to pass by value.

The new format function is a const member function. This isn't required
by the Standard yet, but it will be after LWG-3636 is accepted.
Additionally P2286 adds a formattable concept which requires the member
function to be const qualified in C++23. This paper is likely to be
accepted in the 2022 July plenary.

This is based on D125606. That commit did the groundwork and did similar
changes for the string formatters.

Reviewed By: #libc, ldionne

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

2 years ago[NFC] make ASTContext:isSame* methods const
Chuanqi Xu [Thu, 7 Jul 2022 03:48:34 +0000 (11:48 +0800)]
[NFC] make ASTContext:isSame* methods const

2 years ago[AArch64] Clean up vselect-ext.ll test, add tests with ne/ep preds.
Florian Hahn [Thu, 7 Jul 2022 05:05:32 +0000 (22:05 -0700)]
[AArch64] Clean up vselect-ext.ll test, add tests with ne/ep preds.

2 years ago[NFC][sanitizer] Format dn_expand interceptor
Vitaly Buka [Thu, 7 Jul 2022 04:16:43 +0000 (21:16 -0700)]
[NFC][sanitizer] Format dn_expand interceptor

2 years ago[Debuginfod] Try to fix clang-ppc64le-rhel build
Noah Shutty [Thu, 7 Jul 2022 04:13:30 +0000 (04:13 +0000)]
[Debuginfod] Try to fix clang-ppc64le-rhel build

2 years ago[AArch64][GlobalISel] update the gisel test case
Luo, Yuanke [Thu, 7 Jul 2022 03:42:39 +0000 (11:42 +0800)]
[AArch64][GlobalISel] update the gisel test case

2 years ago[VPlan] Move remove dead recipes before merging regions.
Florian Hahn [Thu, 7 Jul 2022 03:38:37 +0000 (20:38 -0700)]
[VPlan] Move remove dead recipes before merging regions.

This can enable additional region merging,  while not losing
opportunities as region merging does not produce dead recipes.

Reviewed By: Ayal

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

2 years ago[Debug] [Coroutines] Get rid of DW_ATE_address
Chuanqi Xu [Fri, 10 Jun 2022 08:48:01 +0000 (16:48 +0800)]
[Debug] [Coroutines] Get rid of DW_ATE_address

Closing https://github.com/llvm/llvm-project/issues/55916

This patch tries to get rid of DW_ATE_address and enhance the test
coverage.

Reviewed By: dblaikie

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

2 years ago[Debug] [Coroutine] Adjust the scope and name for coroutine frame
Chuanqi Xu [Fri, 20 May 2022 07:30:16 +0000 (15:30 +0800)]
[Debug] [Coroutine] Adjust the scope and name for coroutine frame

Previously the scope of debug type of __coro_frame is limited in the
current function. It looked good at the first sight. But it prevent us
to print the type in splitted functions and other functions. Also the
debug type is different for different coroutine functions. So it makes
sense to rename the debug type to make it related to the function name.

After this patch, we could access the coroutine frame type in a function
by `function_name.coro_frame_ty`.

Reviewed By: dblaikie

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

2 years ago[SystemZ] [z/OS] Use assignCalleeSavedSpillSlots() to mark handle special registers...
Neumann Hon [Thu, 7 Jul 2022 02:22:25 +0000 (22:22 -0400)]
[SystemZ] [z/OS] Use assignCalleeSavedSpillSlots() to mark handle special registers in CSR list instead of determineCalleeSave

This PR moves the handling of special registers that need to be saved/restored in the prolog/epilog respectively from determineCalleeSaves to assignCalleeSavedSpillSlots. The documentation of the parent function of assignCalleeSavedSpillSlots explicitly allows the modification of the CSI hence adding the special registers (the stack pointer register, the return address register, and the entry point register) to the CSI list at that stage should be permissible.

This cleans up the code a bit and makes it so that we do not have to place registers that are not actually considered CSRs by the spec in the CSR list, which is something of a hack.

Reviewed By: uweigand

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

2 years ago[mlir][Math] Support fold PowFOp with constant dense.
jacquesguan [Tue, 5 Jul 2022 07:54:32 +0000 (15:54 +0800)]
[mlir][Math] Support fold PowFOp with constant dense.

This patch adds a conditional binary constant folder which allow to exit when the constants not meet the fold condition. And use it for PowFOp to make it able to fold the constant dense.

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

2 years ago[libc][NFC] Make explicit casts
Alex Brachet [Thu, 7 Jul 2022 02:07:17 +0000 (02:07 +0000)]
[libc][NFC] Make explicit casts

2 years ago[flang][runtime] Trim FORMATs echoed to error messages
Peter Klausler [Fri, 1 Jul 2022 20:05:58 +0000 (13:05 -0700)]
[flang][runtime] Trim FORMATs echoed to error messages

Since dynamic FORMAT strings usually come from blank-padded fixed-length
CHARACTER variables, trim leading and trailing blanks from them when they
are echoed to error messages for better readability.

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

2 years ago[flang] Avoid spurious warnings in pedantic mode from FORMAT items
Peter Klausler [Fri, 1 Jul 2022 18:49:55 +0000 (11:49 -0700)]
[flang] Avoid spurious warnings in pedantic mode from FORMAT items

In free form source, pedantic mode will elicit portability warnings
about missing spaces when a token string ends with a character that
can be in an identifier and there is no space between that last token
character and a following character that can also be part of an identifier.

This behavior doesn't really work well for the token strings that are
parsed for edit descriptors in FORMAT statements.  For example, the
'F' in FORMAT(F7.3) is followed by a digit, but obviously no space is
necessary.  Free form or not, FORMATs are their own odd little world.

This patch adds trailing blanks to these FORMAT edit descriptor token
parsers to disable the missing space check, and extends the documentation
for token string parsing to explain why this technique works.

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

2 years ago[sanitizer] Fix dn_expand test
Vitaly Buka [Thu, 7 Jul 2022 01:39:52 +0000 (18:39 -0700)]
[sanitizer] Fix dn_expand test

res is not the size of expanded string.

2 years ago[flang] Add IsElementalProcedure() predicate
Peter Klausler [Thu, 30 Jun 2022 22:27:28 +0000 (15:27 -0700)]
[flang] Add IsElementalProcedure() predicate

Replace most tests of the explicit Attr::ELEMENTAL symbol flag with
a new predicate IsElementalProcedure() that works correctly for alternate
ENTRY points and does the right thing for procedure interfaces that
reference elemental intrinsic functions like SIN() whose elemental
nature does not propagate.

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

2 years ago[mlir][tblgen] Reverting fatality of assemblyFormat with skipDefaultBuilders=1
wren romano [Wed, 6 Jul 2022 22:42:53 +0000 (15:42 -0700)]
[mlir][tblgen] Reverting fatality of assemblyFormat with skipDefaultBuilders=1

Per @rriddle, we do not want to require `skipDefaultBuilders=0` per se; that is, even though the `assemblyFormat`-generated parser requires a builder with the same prototype as the default-builder, that prototype could instead be implemented via custom `builders`.  This differential reduces the FatalError introduced in D128555 to a non-fatal Warning instead, so that users can still be informed of the error condition (rather than waiting for the C++ compiler to fail).

Reviewed By: rriddle

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

2 years ago[AArch64][GlobalISel] update the test case with update_mir_test_checks.py
Luo, Yuanke [Thu, 7 Jul 2022 01:01:13 +0000 (09:01 +0800)]
[AArch64][GlobalISel] update the test case with update_mir_test_checks.py

2 years ago[GVN] Bug fix to reportMayClobberedLoad remark
Vir Narula [Thu, 7 Jul 2022 00:42:00 +0000 (17:42 -0700)]
[GVN] Bug fix to reportMayClobberedLoad remark

Bug fix to avoid assert crashing when generating remarks for GVN crashing.

Intention of assert is correct but ignores edge case of instructions being equivalent.

Reduced input that causes crash when remarks are turned on:
```
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-macosx12.0.0"

define ptr @ReplaceWithTidy(ptr %zz_hold) {
cond.end480.us:
  %0 = load ptr, ptr null, align 8
  store ptr %0, ptr %0, align 8
  store ptr null, ptr %zz_hold, align 8
  %1 = load ptr, ptr %0, align 8
  store ptr %1, ptr null, align 8
  ret ptr null
}
```

Reviewed By: fhahn

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

2 years ago[flang][runtime] Fix directed UP/DOWN rounding edge case for Fw.d output
Peter Klausler [Fri, 1 Jul 2022 18:46:58 +0000 (11:46 -0700)]
[flang][runtime] Fix directed UP/DOWN rounding edge case for Fw.d output

When Fw.d output editing takes place with directed rounding, make sure that
nonzero values that would normally be converted to zero round up (or down,
depending on the sign) to a scaled 1.

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

2 years ago[flang] Cope with overflow in real MOD/MODULO
Peter Klausler [Fri, 1 Jul 2022 18:43:30 +0000 (11:43 -0700)]
[flang] Cope with overflow in real MOD/MODULO

In folding and in the runtime library for real MOD/MODULO(A,P),
detect overflow from the division A/P and return a properly signed
zero result.  (When A/P overflows and both A and P are finite numbers
with nonzero P, the quotient would be a large integer when rounded to
the precision of the floating-point representation.)

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

2 years ago[flang][runtime] Make ENDFILE work after non-advancing READ
Peter Klausler [Wed, 29 Jun 2022 00:48:15 +0000 (17:48 -0700)]
[flang][runtime] Make ENDFILE work after non-advancing READ

An ENDFILE statement executed when a non-advancing READ has
left the unit in the middle of a record must truncate the file
at that position.

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

2 years ago[LoongArch] Add codegen support for handling floating point immediates
gonglingqin [Wed, 6 Jul 2022 10:02:45 +0000 (18:02 +0800)]
[LoongArch] Add codegen support for handling floating point immediates

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

2 years ago[libc++] Fix a few things in RangesAlgorithms.csv
Nikolas Klauser [Wed, 6 Jul 2022 23:57:20 +0000 (01:57 +0200)]
[libc++] Fix a few things in RangesAlgorithms.csv

2 years ago[Debuginfod] Try to fix shared library build after babef908cc1 (D114845) and 39ed08f8...
Noah Shutty [Wed, 6 Jul 2022 23:01:19 +0000 (23:01 +0000)]
[Debuginfod] Try to fix shared library build after babef908cc1 (D114845) and 39ed08f8d452.

2 years ago[LV] Remove redundant checks from recurrence test.
Florian Hahn [Wed, 6 Jul 2022 22:31:57 +0000 (15:31 -0700)]
[LV] Remove redundant checks from recurrence test.

The removed CHECK configurations are tested as well below, modulo the
dce/instcombine runs. This makes them redundant, and removing them
removes a substantial amount of uneeded checks.

2 years ago[Bazel] Fixup to llvmorg-15-init-15618-ge0b520865026, s/dxil/dx/
NAKAMURA Takumi [Wed, 6 Jul 2022 22:03:16 +0000 (07:03 +0900)]
[Bazel] Fixup to llvmorg-15-init-15618-ge0b520865026, s/dxil/dx/

2 years ago[RISCV] Add codegen coverage for get.active.lane.mask
Philip Reames [Wed, 6 Jul 2022 21:46:52 +0000 (14:46 -0700)]
[RISCV] Add codegen coverage for get.active.lane.mask

2 years ago[mlir][sparse] implement simple reshaping (expand/collapse)
Aart Bik [Fri, 1 Jul 2022 23:57:40 +0000 (16:57 -0700)]
[mlir][sparse] implement simple reshaping (expand/collapse)

The revision makes a start with implementing expand/collapse reshaping
for sparse tensors. When either source or destination is sparse, but
other is dense, the "cheap" dense reshape can be used prior to converting
from or to a sparse tensor.

Note1
sparse to sparse reshaping is still TBD.

Note2
in the long run, we may want to implement a "view" into a sparse tensor so that the operation remains cheap and does not require data shuffling

Reviewed By: wrengr

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

2 years ago[flang] Add semantics test for coshape function
Naje George [Thu, 30 Jun 2022 23:19:20 +0000 (16:19 -0700)]
[flang] Add semantics test for coshape function

Reviewed By: ktras

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

2 years ago[mlir][sparse] fix windows build error
Peiming Liu [Wed, 6 Jul 2022 18:26:01 +0000 (18:26 +0000)]
[mlir][sparse] fix windows build error

Silence warning from MSVC when handling ##__VA_ARGS

Reviewed By: aartbik

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

2 years agoRevert "[Clang] Add a warning on invalid UTF-8 in comments."
Nico Weber [Wed, 6 Jul 2022 20:51:42 +0000 (22:51 +0200)]
Revert "[Clang] Add a warning on invalid UTF-8 in comments."

This reverts commit 4174f0ca618b467571b43cff12cbe4c4239670f8.

Also revert follow-up "[Clang] Fix invalid utf-8 detection"
This reverts commit bf45e27a676d87944f1f13d5f0d0f39935fc4010.

The second commit broke tests, see comments on
https://reviews.llvm.org/D129223, and it sounds like the first
commit isn't valid without the second one. So reverting both for now.

2 years ago[clangd] add inlay hints for std::forward-ed parameter packs
Tobias Ribizel [Wed, 6 Jul 2022 20:09:15 +0000 (22:09 +0200)]
[clangd] add inlay hints for std::forward-ed parameter packs

This adds special-case treatment for parameter packs in
make_unique-like functions to forward parameter names to inlay hints.
The parameter packs are being resolved recursively by traversing the
function body of forwarding functions looking for expressions matching
the (std::forwarded) parameters expanded from a pack.
The implementation checks whether parameters are being passed by
(rvalue) reference or value and adds reference inlay hints accordingly.
The traversal has a limited recursion stack depth, and recursive calls
like std::make_tuple are cut off to avoid hinting duplicate parameter
names.

Reviewed By: sammccall

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

2 years ago[clang][NFC] Re-generate CommandLineReference.rst
Louis Dionne [Wed, 6 Jul 2022 20:21:14 +0000 (16:21 -0400)]
[clang][NFC] Re-generate CommandLineReference.rst

2 years ago[Clang] Fix invalid utf-8 detection
Corentin Jabot [Wed, 6 Jul 2022 20:16:22 +0000 (22:16 +0200)]
[Clang] Fix invalid utf-8 detection

The length of valid codepoints was incorrectly
calculated which was not caught before because the
absence of tests for the valid codepoints scenario.

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

2 years agotry to fix build after babef908cc1
Nico Weber [Wed, 6 Jul 2022 20:15:09 +0000 (22:15 +0200)]
try to fix build after babef908cc1

2 years agoBringing back the test with the required target related to commit 96515df816ebc3af2a6...
Masoud Ataei [Wed, 6 Jul 2022 20:04:17 +0000 (13:04 -0700)]
Bringing back the test with the required target related to commit 96515df816ebc3af2a632669a26374745e98b0c5

2 years ago[llvm] [Debuginfod] DebuginfodCollection and DebuginfodServer for tracking local...
Noah Shutty [Wed, 6 Jul 2022 20:02:03 +0000 (20:02 +0000)]
[llvm] [Debuginfod] DebuginfodCollection and DebuginfodServer for tracking local debuginfo.

This library implements the class `DebuginfodCollection`, which scans a set of directories for binaries, classifying them according to whether they contain debuginfo. This also provides the `DebuginfodServer`, an `HTTPServer` which serves debuginfod's `/debuginfo` and `/executable` endpoints. This is intended as the final new supporting library required for `llvm-debuginfod`.

As implemented here, `DebuginfodCollection` only finds ELF binaries and DWARF debuginfo. All other files are ignored. However, the class interface is format-agnostic. Generalizing to support other platforms will require refactoring of LLVM's object parsing libraries to eliminate use of `report_fatal_error` ([[ https://github.com/llvm/llvm-project/blob/main/llvm/lib/Object/WasmObjectFile.cpp#L74 | e.g. when reading WASM files ]]), so that the debuginfod daemon does not crash when it encounters a malformed file on the disk.

The `DebuginfodCollection` is tested by end-to-end tests of the debuginfod server (D114846).

Reviewed By: mysterymath

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

2 years ago[AsmPrinter] Fix bit pattern for i1 vectors.
Eli Friedman [Wed, 6 Jul 2022 19:56:47 +0000 (12:56 -0700)]
[AsmPrinter] Fix bit pattern for i1 vectors.

Vectors are defined to be tightly packed, regardless of the element
type.  The AsmPrinter didn't realize this, and was allocating extra
padding.

Fixes https://github.com/llvm/llvm-project/issues/49286
Fixes https://github.com/llvm/llvm-project/issues/53246
Fixes https://github.com/llvm/llvm-project/issues/55522

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

2 years agoRemoving this test temporarily beacuse of a failure in x86_64
Masoud Ataei [Wed, 6 Jul 2022 19:41:13 +0000 (12:41 -0700)]
Removing this test temporarily beacuse of a failure in x86_64

2 years ago[gn build] Port 8366e21ef176
LLVM GN Syncbot [Wed, 6 Jul 2022 19:34:19 +0000 (19:34 +0000)]
[gn build] Port 8366e21ef176

2 years ago[gn build] (manually) port 9ee97ce3b8305c5
Nico Weber [Wed, 6 Jul 2022 19:33:45 +0000 (21:33 +0200)]
[gn build] (manually) port 9ee97ce3b8305c5

2 years ago[libc++] Use ABI tags instead of internal linkage to provide per-TU insulation
Louis Dionne [Thu, 9 Jun 2022 21:36:33 +0000 (17:36 -0400)]
[libc++] Use ABI tags instead of internal linkage to provide per-TU insulation

Instead of marking private symbols with internal_linkage (which leads to
one copy per translation unit -- rather wasteful), use an ABI tag that
gets rev'd with each libc++ version. That way, we know that we can't have
name collisions between implementation-detail functions across libc++
versions, so we'll never violate the ODR. However, within a single program,
each symbol still has a proper name with external linkage, which means
that the linker is free to deduplicate symbols even across TUs.

This actually means that we can guarantee that versions of libc++ can
be mixed within the same program without ever having to take a code size
hit, and without having to manually opt-in -- it should just work out of
the box.

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

2 years ago[gn build] (manually) port 484b1aa611ca
Nico Weber [Wed, 6 Jul 2022 19:23:17 +0000 (21:23 +0200)]
[gn build] (manually) port 484b1aa611ca

2 years ago[gn build] (manually) port e0b520865026
Nico Weber [Wed, 6 Jul 2022 19:19:59 +0000 (21:19 +0200)]
[gn build] (manually) port e0b520865026

2 years ago[Clang] Add a warning on invalid UTF-8 in comments.
Corentin Jabot [Fri, 17 Jun 2022 14:23:41 +0000 (16:23 +0200)]
[Clang] Add a warning on invalid UTF-8 in comments.

Introduce an off-by default `-Winvalid-utf8` warning
that detects invalid UTF-8 code units sequences in comments.

Invalid UTF-8 in other places is already diagnosed,
as that cannot appear in identifiers and other grammar constructs.

The warning is off by default as its likely to be somewhat disruptive
otherwise.

This warning allows clang to conform to the yet-to be approved WG21
"P2295R5 Support for UTF-8 as a portable source file encoding"
paper.

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

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

2 years ago[clang] Correct the macOS version that supports aligned allocation
Louis Dionne [Tue, 5 Jul 2022 22:53:33 +0000 (18:53 -0400)]
[clang] Correct the macOS version that supports aligned allocation

After checking the libc++abi.dylib shipped in macOS 10.13, I can confirm
that it contains the align_val_t variants of operator new and operator
delete. However, the libc++abi.dylib shipped on macOS 10.12 does not.

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

2 years ago[llvm] [Debuginfod] Add HTTP Server to Debuginfod library.
Noah Shutty [Wed, 6 Jul 2022 18:50:55 +0000 (18:50 +0000)]
[llvm] [Debuginfod] Add HTTP Server to Debuginfod library.

This provides a minimal HTTP server interface and an implementation wrapping [[ https://github.com/yhirose/cpp-httplib | cpp-httplib ]] in the Debuginfod library. If the Curl HTTP client is available (D112753) the server is tested by pinging it with the client.

Reviewed By: dblaikie

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

2 years ago[libc++] Improves pragma system_header test.
Mark de Wever [Sun, 3 Jul 2022 16:39:30 +0000 (18:39 +0200)]
[libc++] Improves pragma system_header test.

The number of spaces between `#` and `pragma` can differ due to
different indention levels in the preprocessor directives. Therefore
allow any number of spaces.

The test used to put an exclamation mark in its diagnostic. This adds
little benefit and only makes it harder to copy the offending filename.
As drive-by this exclamation mark has been removed.

Reviewed By: ldionne, #libc

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

2 years ago[PowerPC] Fix the check for scalar MASS conversion
Masoud Ataei [Wed, 6 Jul 2022 18:44:00 +0000 (11:44 -0700)]
[PowerPC] Fix the check for scalar MASS conversion

Proposing to move the check for scalar MASS conversion from constructor
of PPCTargetLowering to the lowerLibCallBase function which decides
about the lowering.

The Target machine option Options.PPCGenScalarMASSEntries is set in
PPCTargetMachine.cpp. But an object of the class PPCTargetLowering
is created in one of the included header files. So, the constructor will run
before setting PPCGenScalarMASSEntries to correct value. So, we cannot
check this option in the constructor.

Differential: https://reviews.llvm.org/D128653
Reviewer: @bmahjour

2 years ago[llvm] [Debuginfod] Add cpp-httplib optional dependency.
Noah Shutty [Wed, 6 Jul 2022 18:39:59 +0000 (18:39 +0000)]
[llvm] [Debuginfod] Add cpp-httplib optional dependency.

Adds optional dependency on cpp-httplib, a lightweight header-only HTTP server.

Reviewed By: phosek

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

2 years agoUpdate the status & add tests for some more C99 DRs
Aaron Ballman [Wed, 6 Jul 2022 18:33:37 +0000 (14:33 -0400)]
Update the status & add tests for some more C99 DRs

2 years ago[NFC] [DirectX] Prefix for intrinsics should be dx
Chris Bieneman [Wed, 6 Jul 2022 17:18:09 +0000 (12:18 -0500)]
[NFC] [DirectX] Prefix for intrinsics should be dx

`dxil` is an architecture supported by the DirectX backend. These
intrinsics will likely be shared with other DirectX architectures like
`dxbc`. Using a common prefix `dx` will make it more intuitive.

Also the `dx` prefix is already set in the Triple, which causes
intrinsics described here to be unmatchable via the ClangBuiltin
mechanism.

2 years ago[BOLT] Add runtime functions required by freestanding environment
Maksim Panchenko [Wed, 6 Jul 2022 02:55:26 +0000 (19:55 -0700)]
[BOLT] Add runtime functions required by freestanding environment

Compiler can generate calls to some functions implicitly, even under
constraints of freestanding environment. Make sure these functions are
available in our runtime objects.

Fixes test failures on some systems after https://reviews.llvm.org/D128960.

Reviewed By: yota9

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

2 years ago[gn build] Port f8cbe3cdf024
LLVM GN Syncbot [Wed, 6 Jul 2022 17:46:18 +0000 (17:46 +0000)]
[gn build] Port f8cbe3cdf024

2 years agoRevert "[Clang] Add a warning on invalid UTF-8 in comments."
Corentin Jabot [Wed, 6 Jul 2022 17:45:12 +0000 (19:45 +0200)]
Revert "[Clang] Add a warning on invalid UTF-8 in comments."

Reverting while I investigate build failures

This reverts commit e3dc56805f1029dd5959e4c69196a287961afb8d.

2 years ago[flang] Establish a single source of target information for semantics
Peter Klausler [Fri, 1 Jul 2022 18:40:44 +0000 (11:40 -0700)]
[flang] Establish a single source of target information for semantics

Create a TargetCharacteristics class to centralize the few items of
target specific information that are relevant to semantics.  Use the
new class for all target queries, including derived type component layout
modeling.

Future work will initialize this class with target information
provided or forwarded by the drivers, and use it to fold layout-dependent
intrinsic functions like TRANSFER().

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

Updates: Attempts to work around build issues on Windows.

2 years ago[Metadata] Utilize the resizing capability of MDNodes in Moduleflag processing.
Wolfgang Pieb [Wed, 25 May 2022 17:14:10 +0000 (10:14 -0700)]
[Metadata] Utilize the resizing capability of MDNodes in Moduleflag processing.

This mostly affects PGO/LTO builds which use module flags describing the call
graph. Fixes Issue #51893.

Reviewed By: dexonsmith

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

2 years ago[CMake][Fuchsia] Install static libuwind
Petr Hosek [Wed, 6 Jul 2022 17:08:26 +0000 (17:08 +0000)]
[CMake][Fuchsia] Install static libuwind

This can now be used with -static-libgcc.

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

2 years ago[LTO][ELF] Add selective --save-temps= option
Jin Xin Ng [Wed, 1 Jun 2022 17:46:55 +0000 (10:46 -0700)]
[LTO][ELF] Add selective --save-temps= option

Allows specific “temps” to be saved, instead of the current all-or-nothing nature of --save-temps. Multiple of these “temps” can be saved by specifying the argument multiple times.

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

2 years ago[Clang][OpenMP] Enable floating-point operation for `atomic compare` series
Shilei Tian [Wed, 6 Jul 2022 17:05:00 +0000 (13:05 -0400)]
[Clang][OpenMP] Enable floating-point operation for `atomic compare` series

D127041 introduced the support for `fmax` and `fmin` such that we can also reprent
`atomic compare` and `atomic compare capture` with `atomicrmw` instruction. This
patch simply lifts the limitation we set before.

Depend on D127041.

Reviewed By: ABataev

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

2 years ago[X86] LowerShift - lower some shuffles directly to X86ISD::PSHUFLW nodes.
Simon Pilgrim [Wed, 6 Jul 2022 17:00:21 +0000 (18:00 +0100)]
[X86] LowerShift - lower some shuffles directly to X86ISD::PSHUFLW nodes.

These are expected to lower to X86ISD::PSHUFLW but we were seeing some regressions in D129150 because it'd managed to exploit the masking of the shift amounts to create unintended clear masks instead.

2 years ago[libc++] Implement ranges::remove{, _if}
Nikolas Klauser [Wed, 6 Jul 2022 12:03:00 +0000 (14:03 +0200)]
[libc++] Implement ranges::remove{, _if}

Reviewed By: var-const, #libc

Spies: huixie90, sstefan1, libcxx-commits, mgorny

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

2 years ago[RISCV] Autogen a vectorizer test for ease of update
Philip Reames [Wed, 6 Jul 2022 16:26:10 +0000 (09:26 -0700)]
[RISCV] Autogen a vectorizer test for ease of update

2 years ago[clangd] Fix missing key function in PreambleThrottler
Sam McCall [Wed, 6 Jul 2022 16:27:02 +0000 (18:27 +0200)]
[clangd] Fix missing key function in PreambleThrottler

2 years ago[AArch64][SVE] Zero other lanes when doing OR reduction on unpacked predicate using...
Sander de Smalen [Wed, 6 Jul 2022 15:59:24 +0000 (15:59 +0000)]
[AArch64][SVE] Zero other lanes when doing OR reduction on unpacked predicate using ptest.

When the predicate vector is unpacked, we cannot assume anything about the
values in the other lanes. We have to make sure we use the correct
predicate where we know that the other lanes have been zeroed.

Reviewed By: RosieSumpter

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

2 years ago[JITLink][RISCV] Ignore R_RISCV_RELAX and check R_RISCV_ALIGN
Jonas Hahnfeld [Tue, 5 Jul 2022 20:36:22 +0000 (22:36 +0200)]
[JITLink][RISCV] Ignore R_RISCV_RELAX and check R_RISCV_ALIGN

It is fine to not implement and ignore linker relaxation for now, but
we need to check the alignment. Luckily, an alignment of only 2 bytes
is the most common case when interpreting C++ code in clang-repl, and
already guaranteed by the length of compressed instructions.

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

2 years ago[LV] Remove unnecessary memory checks from recurrence test
Florian Hahn [Wed, 6 Jul 2022 16:08:06 +0000 (09:08 -0700)]
[LV] Remove unnecessary memory checks from recurrence test

The tests are focused on code-gen for first-order recurrences. There are
plenty of tests specifically for runtime check generation. Using noalias
to avoid runtime checks slightly simplifies the test output and ensures
the checks focus on the relevant bits and ensures the checks focus on
the relevant bits and ensures the checks focus on the relevant bits and
ensures the checks focus on the relevant bits.

2 years ago[RISCV] Add test coverage for vectorizer tailfolding
Philip Reames [Wed, 6 Jul 2022 16:05:27 +0000 (09:05 -0700)]
[RISCV] Add test coverage for vectorizer tailfolding

As can be seen in the check lines, we have a lot of work to do.

2 years ago[stackmaps] Start legalizing live variable operands
Edd Barrett [Fri, 17 Jun 2022 12:20:03 +0000 (13:20 +0100)]
[stackmaps] Start legalizing live variable operands

Prior to this change, live variable operands passed to
`llvm.experimental.stackmap` would be emitted directly to target nodes,
meaning that they don't get legalised. The upshot of this is that LLVM
may crash when encountering illegally typed target nodes.

e.g. https://github.com/llvm/llvm-project/issues/21657

This change introduces a platform independent stackmap DAG node whose
operands are legalised as per usual, thus avoiding aforementioned
crashes.

Note that some kinds of argument are still not handled properly, namely
vectors, structs, and large integers, like i128s. These will need to be
addressed in follow-up changes.

Note also that this does not change the behaviour of
`llvm.experimental.patchpoint`. A follow up change will do the same for
this intrinsic.

Differential review:
https://reviews.llvm.org/D125680

2 years ago[Clang] Add a warning on invalid UTF-8 in comments.
Corentin Jabot [Fri, 17 Jun 2022 14:23:41 +0000 (16:23 +0200)]
[Clang] Add a warning on invalid UTF-8 in comments.

Introduce an off-by default `-Winvalid-utf8` warning
that detects invalid UTF-8 code units sequences in comments.

Invalid UTF-8 in other places is already diagnosed,
as that cannot appear in identifiers and other grammar constructs.

The warning is off by default as its likely to be somewhat disruptive
otherwise.

This warning allows clang to conform to the yet-to be approved WG21
"P2295R5 Support for UTF-8 as a portable source file encoding"
paper.

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

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

2 years ago[AArch64] Add support for various operations on nxv1i1 types.
Sander de Smalen [Wed, 6 Jul 2022 15:00:38 +0000 (15:00 +0000)]
[AArch64] Add support for various operations on nxv1i1 types.

The supported operations are:
* Logical operations (and, or, xor, bic)
* Logical reductions (and, or, xor, [us]min, [us]max)
* Conversions to/from svbool_t
* Predicate count (CNTP)

Reviewed By: paulwalker-arm

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

2 years ago[AArch64] NFC: Fix name mangling in sve-insert-vector.ll
Sander de Smalen [Wed, 6 Jul 2022 14:59:45 +0000 (14:59 +0000)]
[AArch64] NFC: Fix name mangling in sve-insert-vector.ll

2 years ago[IndVars] Regenerate test checks (NFC)
Nikita Popov [Wed, 6 Jul 2022 15:13:12 +0000 (17:13 +0200)]
[IndVars] Regenerate test checks (NFC)

2 years ago[MLIR][Presburger] Support lexicographic max/min union of two PWMAFunction
Groverkss [Wed, 6 Jul 2022 15:08:15 +0000 (16:08 +0100)]
[MLIR][Presburger] Support lexicographic max/min union of two PWMAFunction

This patch implements a lexicographic max/min union of two PWMAFunctions.

The lexmax/lexmin union of two functions is defined as a function defined on
the union of the input domains of both functions, such that when only one of the
functions are defined, it outputs the same as that function, and if both are
defined, it outputs the lexmax/lexmin of the two outputs. On points where
neither function is defined, the union is not defined either.

Reviewed By: arjunp

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

2 years ago[Debugify] Port verify-debuginfo-preserve to NewPM
Nikola Tesic [Wed, 6 Jul 2022 12:26:36 +0000 (14:26 +0200)]
[Debugify] Port verify-debuginfo-preserve to NewPM

Debugify in OriginalDebugInfo mode, introduced with D82545,
runs only with legacy PassManager.

This patch enables this utility for the NewPM.

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

2 years ago[LLVM] Add the support for fmax and fmin in atomicrmw instruction
Shilei Tian [Wed, 6 Jul 2022 14:57:24 +0000 (10:57 -0400)]
[LLVM] Add the support for fmax and fmin in atomicrmw instruction

This patch adds the support for `fmax` and `fmin` operations in `atomicrmw`
instruction. For now (at least in this patch), the instruction will be expanded
to CAS loop. There are already a couple of targets supporting the feature. I'll
create another patch(es) to enable them accordingly.

Reviewed By: arsenm

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

2 years ago[gn build] Port 08e4fe6c6196
LLVM GN Syncbot [Wed, 6 Jul 2022 14:24:15 +0000 (14:24 +0000)]
[gn build] Port 08e4fe6c6196

2 years ago[LICM] Check opt output in test (NFC)
Nikita Popov [Wed, 6 Jul 2022 14:21:05 +0000 (16:21 +0200)]
[LICM] Check opt output in test (NFC)

Check what the test actually produces, not just that it doesn't
crash.