platform/upstream/llvm.git
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.

2 years ago[X86] Add RDPRU instruction
Paul Robinson [Thu, 30 Jun 2022 20:23:41 +0000 (13:23 -0700)]
[X86] Add RDPRU instruction

Add support for the RDPRU instruction on Zen2 processors.

User-facing features:

- Clang option -m[no-]rdpru to enable/disable the feature
- Support is implicit for znver2/znver3 processors
- Preprocessor symbol __RDPRU__ to indicate support
- Header rdpruintrin.h to define intrinsics
- "rdpru" mnemonic supported for assembler code

Internal features:

- Clang builtin __builtin_ia32_rdpru
- IR intrinsic @llvm.x86.rdpru

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

2 years ago[Clang][NFC] fix typo
Corentin Jabot [Wed, 6 Jul 2022 14:04:16 +0000 (16:04 +0200)]
[Clang][NFC] fix typo

2 years ago[AMDGPU][GFX1030][DOC][NFC] Update assembler syntax description
Dmitry Preobrazhensky [Mon, 27 Jun 2022 16:55:07 +0000 (19:55 +0300)]
[AMDGPU][GFX1030][DOC][NFC] Update assembler syntax description

Summary of changes:
- Update MUBUF lds syntax (see https://reviews.llvm.org/D124485).
- Add v_cvt_pkrtz_f16_f32_dpp, v_cvt_pkrtz_f16_f32_sdwa.
- Update SMEM syntax (see https://reviews.llvm.org/D127314).
- Enable op_sel for v_add_nc_u16, v_sub_nc_u16 (see https://reviews.llvm.org/D123594).
- Minor bug fixing and improvements.

2 years ago[WebAssembly][NFC] Consolidate TargetRegisterClass=>COPY opcode conversion into a...
Alex Bradbury [Wed, 6 Jul 2022 13:43:49 +0000 (14:43 +0100)]
[WebAssembly][NFC] Consolidate TargetRegisterClass=>COPY opcode conversion into a single helper

Previously WebAssemblyCFGStackify, WebAssemblyInstrInfo, and
WebAssemblyPeephole all had equivalent logic for this. Move it into a
common helper in WebAssemblyUtilities.

2 years ago[SimplifyCFG] Don't split predecessors of callbr terminator
Nikita Popov [Wed, 6 Jul 2022 13:36:45 +0000 (15:36 +0200)]
[SimplifyCFG] Don't split predecessors of callbr terminator

This addresses the assertion failure reported in
https://reviews.llvm.org/D124159#3631240.

I believe that this limitation in SplitBlockPredecessors is not
actually necessary (because unlike with indirectbr, callbr is
restricted in a way that does allow updating successors), but for
now fix the assertion failure the same way we do everywhere else,
by also skipping callbr.

2 years ago[clangd] Fix tests after ed0e20d5e8c5d6c679d2c
Sam McCall [Wed, 6 Jul 2022 13:21:59 +0000 (15:21 +0200)]
[clangd] Fix tests after ed0e20d5e8c5d6c679d2c

2 years ago[NFC] Add a TODO comment to apply nounwind attribute in all GPU modes.
Alexey Bader [Wed, 6 Jul 2022 13:15:17 +0000 (06:15 -0700)]
[NFC] Add a TODO comment to apply nounwind attribute in all GPU modes.

2 years ago[pseudo] Define recovery strategy as grammar extension.
Sam McCall [Tue, 5 Jul 2022 20:14:52 +0000 (22:14 +0200)]
[pseudo] Define recovery strategy as grammar extension.

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

2 years ago[clangd] Support external throttler for preamble builds
Sam McCall [Tue, 5 Jul 2022 00:33:04 +0000 (02:33 +0200)]
[clangd] Support external throttler for preamble builds

Building preambles is the most resource-intensive thing clangd does, driving
peak RAM and sustained CPU usage.

In a hosted environment where multiple clangd instances are packed into the same
container, it's useful to be able to limit the *aggregate* resource peaks.

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

2 years ago[WebAssembly][NFC] Reuse the regClassToValType helper in WebAssemblyMCInstLower
Alex Bradbury [Wed, 6 Jul 2022 12:56:10 +0000 (13:56 +0100)]
[WebAssembly][NFC] Reuse the regClassToValType helper in WebAssemblyMCInstLower

There's no need for WebAssemblyMCInstLower to carry its own functionally
equivalent implementation.

2 years ago[tbaa] Handle base classes in struct tbaa
Bruno De Fraine [Wed, 6 Jul 2022 12:36:14 +0000 (14:36 +0200)]
[tbaa] Handle base classes in struct tbaa

This is a fix for the miscompilation reported in https://github.com/llvm/llvm-project/issues/55384

Not adding a new test case since existing test cases already cover base classes (including new-struct-path tbaa).

Reviewed By: jeroen.dobbelaere

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

2 years ago[mlir][OpenMP] Add if clause to OpenMP simd construct
Dominik Adamski [Thu, 30 Jun 2022 14:50:03 +0000 (09:50 -0500)]
[mlir][OpenMP] Add if clause to OpenMP simd construct

This patch adds if clause to OpenMP TableGen for simd construct.

Reviewed By: peixin

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

Signed-off-by: Dominik Adamski <dominik.adamski@amd.com>
2 years ago[lldb][AArch64] Use "+all" feature for the disassembler
David Spickett [Tue, 5 Jul 2022 13:25:35 +0000 (13:25 +0000)]
[lldb][AArch64] Use "+all" feature for the disassembler

The "+all" feature name was added in https://reviews.llvm.org/D128029.

This feature means we don't have to generate a list of features
or use a base architecture feature.

Reviewed By: labath

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

2 years ago[libc++] default-construct moved-from test-iterators
Nikolas Klauser [Mon, 4 Jul 2022 20:43:50 +0000 (22:43 +0200)]
[libc++] default-construct moved-from test-iterators

This way we ensure that we don't use-after-move the iterators.

Reviewed By: Mordante, #libc

Spies: libcxx-commits

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

2 years ago[libc++] Prefer __has_builtin for detecting compiler-provided type_traits
Nikolas Klauser [Mon, 4 Jul 2022 01:27:58 +0000 (03:27 +0200)]
[libc++] Prefer __has_builtin for detecting compiler-provided type_traits

Both clang and GCC support using `__has_builtin` for detecting compiler-provided type_traits. Use it instead of `__has_keyword` or `__has_feature` to remove special-casing for GCC-provided builtins

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

2 years ago[ORC][ORC_RT][AArch64] Implement TLS descriptor in ELFNixPlatform.
Sunho Kim [Wed, 6 Jul 2022 11:12:22 +0000 (20:12 +0900)]
[ORC][ORC_RT][AArch64] Implement TLS descriptor in ELFNixPlatform.

Implements TLS descriptor relocations in JITLink ELF/AARCH64 backend and support the relevant runtime functions in ELFNixPlatform.

Unlike traditional TLS model, TLS descriptor model requires linker to return the "offset" from thread pointer via relocaiton not the actual pointer to thread local variable. There is no public libc api for adding new allocations to TLS block dynamically which thread pointer points to. So, we support this by taking delta from thread base pointer to the actual thread local variable in our allocated section.

Reviewed By: lhames

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

2 years ago[MIPS] Resolve issues in building ASAN for N32 ABI
Dimitrije Milosevic [Wed, 6 Jul 2022 10:24:58 +0000 (12:24 +0200)]
[MIPS] Resolve issues in building ASAN for N32 ABI

Building the compiler-rt's AddressSanitizer for
the n32 MIPS ABI currently fails, due to a few reasons:

    - defined(__mips64), which is set solely based on
    the architecture type (32-bit/64-bit), was still used
    in some places. Therefore, defined(__mips64) is swapped
    with SANITIZER_MIPS64, which takes the ABI into account
    as well - defined(__mips64) && _MIPS_SIM == ABI64.
    - The n32 ABI still uses 64-bit *Linux* system calls,
    even though the word size is 32 bits.
    - After the transition to canonical system calls (D124212),
    the n32 ABI still didn't use them, even though they
    are supported.

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

2 years ago[MIPS] Fix the ASAN shadow offset hook for the N32 ABI
Dimitrije Milosevic [Wed, 6 Jul 2022 10:22:04 +0000 (12:22 +0200)]
[MIPS] Fix the ASAN shadow offset hook for the N32 ABI

Currently, LLVM doesn't have the correct shadow offset
mapping for the n32 ABI.
This patch introduces the correct shadow offset value
for the n32 ABI - 1ULL << 29.

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