platform/upstream/llvm.git
17 months ago[IndVars] Expand icmp in preheader rather than in loop
Max Kazantsev [Wed, 25 Jan 2023 07:06:08 +0000 (14:06 +0700)]
[IndVars] Expand icmp in preheader rather than in loop

The motivation is that 'createInvariantCond' unconditionally
builds icmp in the loop block,  while it could always do it
in preheader. Build it in preheader instead.

Patch by Aleksandr Popov!

Differential Revision: https://reviews.llvm.org/D141994
Reviewed By: nikic

17 months ago[LLDB] Fix for libc++ atomic allowing modification of contained value
Pavel Kosov [Wed, 25 Jan 2023 07:39:50 +0000 (10:39 +0300)]
[LLDB] Fix for libc++ atomic allowing modification of contained value

Reviewed By: clayborg

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

17 months agolibcxx: Don't apply ABI tags to extern "C" fns
Arsen Arsenović [Wed, 25 Jan 2023 07:34:55 +0000 (07:34 +0000)]
libcxx: Don't apply ABI tags to extern "C" fns

GCC rejects ABI tags on non mangled functions, as they would otherwise
be a no-op.  This commit replaces such instances with equivalent
_LIBCPP_HIDE_FROM_ABI constants but without ABI tags attached.

  .../include/c++/v1/__support/musl/xlocale.h:28:68: error: 'abi_tag'
  attribute applied to extern "C" declaration 'long long int
  strtoll_l(const char*, char**, int, locale_t)'
     28 | strtoll_l(const char *__nptr, char **__endptr, int __base, locale_t) {
        |                                                                    ^

Bug: https://bugs.gentoo.org/869038

Reviewed By: #libc, ldionne

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

17 months ago[X86] Use llvm::countr_zero instead of findFirstSet (NFC)
Kazu Hirata [Wed, 25 Jan 2023 07:26:08 +0000 (23:26 -0800)]
[X86] Use llvm::countr_zero instead of findFirstSet (NFC)

At the call site of findFirstSet, ZMask | (1 << DstIdx) always have
exactly 3 bits set, and they are all among the 4 least significant
bits, so (ZMask | (1 << DstIdx)) ^ 15 has exactly one bit set.  Since
the argument to findFirstSet is nonzero, we can safely switch to
llvm::countr_zero.

17 months ago[MLIR] Expose LocationAttrs in the C API
Andrew Young [Wed, 25 Jan 2023 07:13:20 +0000 (23:13 -0800)]
[MLIR] Expose LocationAttrs in the C API

This patch adds three functions to the C API:
- mlirAttributeIsALocation: returns true if the attribute is a LocationAttr,
  false otherwise.
- mlirLocationGetAttribute: returns the underlying LocationAttr of a Location.
- mlirLocationFromAttribute: gets a Location from a LocationAttr.

Reviewed By: mikeurbach, Mogball

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

17 months ago[libc][NFC] Another round of replacement of "inline" with "LIBC_INLINE".
Siva Chandra Reddy [Tue, 24 Jan 2023 22:31:51 +0000 (22:31 +0000)]
[libc][NFC] Another round of replacement of "inline" with "LIBC_INLINE".

Reviewed By: michaelrj

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

17 months agoBump the trunk major version to 17
Tom Stellard [Wed, 25 Jan 2023 06:55:53 +0000 (22:55 -0800)]
Bump the trunk major version to 17

17 months ago[CodeGen] Use llvm::bit_ceil (NFC)
Kazu Hirata [Wed, 25 Jan 2023 06:54:53 +0000 (22:54 -0800)]
[CodeGen] Use llvm::bit_ceil (NFC)

If we know that x is nonzero and not a power of 2, then
llvm::findLastSet(x) + 1 is the index of the bit just above the
highest set bit in x.  That is, 1 << (llvm::findLastSet(x) + 1) is the
same as llvm::bit_ceil(x).

Since llvm::bit_ceil is a nop on a power of 2, we can unconditionally
call llvm::bit_ceil.  The end result actually matches the comment.

17 months ago[SystemZ] Use llvm::bit_floor (NFC)
Kazu Hirata [Wed, 25 Jan 2023 06:10:02 +0000 (22:10 -0800)]
[SystemZ] Use llvm::bit_floor (NFC)

If x is known to be nonzero, findLastSet(x) returns the index of the
highest set bit counting from the LSB, so 1 << findLastSet(x) is the
same as llvm::bit_floor(x).

17 months ago[M68k][MC] Make immediate operands relocatable
Min-Yih Hsu [Tue, 11 Oct 2022 05:07:48 +0000 (22:07 -0700)]
[M68k][MC] Make immediate operands relocatable

Sometimes memory addresses are treated as immediate values. Thus
immediate operands have to be relocatable.

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

17 months ago[M68k][Disassembler] Use custom decoder for 32-bit immediates
Min-Yih Hsu [Mon, 21 Nov 2022 06:38:09 +0000 (22:38 -0800)]
[M68k][Disassembler] Use custom decoder for 32-bit immediates

32-bit immediates require special cares because they go across the
normal word (16 bits) boundaries.
This patch also fixes some incorrect disassembler test cases.

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

17 months ago[TableGen] Support custom decoders for variable length instructions
Min-Yih Hsu [Mon, 21 Nov 2022 06:35:27 +0000 (22:35 -0800)]
[TableGen] Support custom decoders for variable length instructions

Just like the encoder directive for variable-length instructions, this
patch adds a new decoder directive to allow custom decoder function on
an operand.

Right now, due to the design of DecoderEmitter each operand can only
have a single custom decoder in a given instruction.

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

17 months ago[zero-call-used-regs] Mark only non-debug instruction's register as used
Shivam Gupta [Mon, 23 Jan 2023 18:16:04 +0000 (23:46 +0530)]
[zero-call-used-regs] Mark only non-debug instruction's register as used

zero-call-used-regs pass generate an xor instruction to help mitigate
return-oriented programming exploits via zeroing out used registers. But
in this below test case with -g option there is dbg.value instruction
associating the register with the debug-info description of the formal
parameter d, which makes the register appear used, therefore it zero the
register edi in -g case and makes binary different from without -g option.

The pass should be looking only at the non-debug uses.

$ cat test.c
char a[];
int b;
__attribute__((zero_call_used_regs("used"))) char c(int d) {
  *a = ({
    int e = d;
    b;
  });
}

This fixes https://github.com/llvm/llvm-project/issues/57962.

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

17 months agoRevert "[SCCP] Use range info to prove AddInst has NUW flag."
Douglas Yung [Wed, 25 Jan 2023 05:19:25 +0000 (21:19 -0800)]
Revert "[SCCP] Use range info to prove AddInst has NUW flag."

This reverts commit de122cb920080fd9e24b2777114271fbef932d5e.

This change causes assertion failures in many of our internal tests.
I have filed #60280 for this issue.

17 months agoRevert "[clang-tidy] Introduce HeaderFileExtensions and ImplementationFileExtensions...
Carlos Galvez [Wed, 25 Jan 2023 05:06:43 +0000 (05:06 +0000)]
Revert "[clang-tidy] Introduce HeaderFileExtensions and ImplementationFileExtensions options"

This reverts commit 4240c9146248ac0a91c45dee421c6ef07709ba74.

The current solution won't work since getLocalOrGlobal does not
support returning a vector. More work needs to be put into
ensuring both the local and global way of setting the options
are available during the transition period.

17 months agoFix running MLIR tests when enabling examples but the native backends isn't configure...
Mehdi Amini [Wed, 25 Jan 2023 04:32:20 +0000 (20:32 -0800)]
Fix running MLIR tests when enabling examples but the native backends isn't configured (NFC)

17 months ago[Transform] Rewrite LowerSwitch using APInt
Peter Rong [Thu, 12 Jan 2023 18:58:38 +0000 (10:58 -0800)]
[Transform] Rewrite LowerSwitch using APInt

This rewrite fixes https://github.com/llvm/llvm-project/issues/59316.

Previously LowerSwitch uses int64_t, which will crash on case branches using integers with more than 64 bits.
Using APInt fixes this problem. This patch also includes a test

Reviewed By: RKSimon

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

17 months ago[AssumptionCache] caches @llvm.experimental.guard's
Joshua Cao [Mon, 23 Jan 2023 07:26:37 +0000 (23:26 -0800)]
[AssumptionCache] caches @llvm.experimental.guard's

As discussed in https://github.com/llvm/llvm-project/issues/59901

This change is not NFC. There is one SCEV and EarlyCSE test that have an
improved analysis/optimization case. Rest of the tests are not failing.

I've mostly only added cleanup to SCEV since that is where this issue
started. As a follow up, I believe there is more cleanup opportunity in
SCEV and other affected passes.

There could be cases where there are missed registerAssumption of
guards, but this case is not so bad because there will be no
miscompilation. AssumptionCacheTracker should take care of deleted
guards.

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

17 months ago[Clang][OpenMP] Find the type `omp_allocator_handle_t` from identifier table
Shilei Tian [Wed, 25 Jan 2023 03:48:56 +0000 (22:48 -0500)]
[Clang][OpenMP] Find the type `omp_allocator_handle_t` from identifier table

In Clang, in order to determine the type of `omp_allocator_handle_t`, Clang
checks the type of those predefined allocators. The first one it checks is
`omp_null_allocator`. If the language is C, and the system is 64-bit, what Clang
gets is a `int`, instead of an enum of size 8, given the fact how we define
`omp_allocator_handle_t` in `omp.h`.  If the allocator is captured by a region,
let's say a parallel region, the allocator will be privatized. Because Clang deems
`omp_allocator_handle_t` as an `int`, it will first cast the value returned by
the runtime library (for `libomp` it is a `void *`) to `int`, and then in the
outlined function, it casts back to `omp_allocator_handle_t`. This two casts
completely shaves the first 32-bit of the pointer value returned from `libomp`,
and when the private "new" pointer is fed to another runtime function
`__kmpc_allocate()`, it causes segment fault. That is the root cause of PR54082.
I have no idea why `-fno-pic` could hide this bug.

In this patch, we detect `omp_allocator_handle_t` using roughly the same method
as `omp_event_handle_t`, by looking it up into the identifier table.

Fix #54082.

Reviewed By: ABataev

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

17 months ago[lldb] Remove legacy six module for py2->py3
Jordan Rupprecht [Wed, 25 Jan 2023 03:46:26 +0000 (19:46 -0800)]
[lldb] Remove legacy six module for py2->py3

LLDB only supports Python3 now, so the `six` shim for Python2 is no longer necessary.

Reviewed By: JDevlieghere

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

17 months ago[lldb] Don't create Clang AST nodes in GetDIEClassTemplateParams
Arthur Eubanks [Mon, 23 Jan 2023 23:37:57 +0000 (15:37 -0800)]
[lldb] Don't create Clang AST nodes in GetDIEClassTemplateParams

Otherwise we may be inserting a decl into a DeclContext that's not fully defined yet.

This simplifies/removes some clang AST node creation code. Instead, use
clang::printTemplateArgumentList().

Reviewed By: Michael137

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

17 months ago[Clang] Fix test that sometimes fails depending on the temp name
Joseph Huber [Wed, 25 Jan 2023 03:11:15 +0000 (21:11 -0600)]
[Clang] Fix test that sometimes fails depending on the temp name

Summary:
This test has a negative check for an extra file. it turns out that
sometimes the temp name can match it. Be more specific with it.

17 months ago[OpenMP] Create a temp file in /tmp if /dev/shm is not accessible
Shilei Tian [Wed, 25 Jan 2023 02:45:32 +0000 (21:45 -0500)]
[OpenMP] Create a temp file in /tmp if /dev/shm is not accessible

When `libomp` is initialized, it creates a temp file in `/dev/shm` to store
registration flag. Some systems, like Android, don't have `/dev/shm`, then this
feature is disabled by the macro `KMP_USE_SHM`, though most Linux distributions
have that. However, some customized distribution, such as the one reported in
https://github.com/llvm/llvm-project/issues/53955, doesn't support it either.
It causes a core dump. In this patch, if it is the case, we will try to create a
temporary file in `/tmp`, and if it still doesn't make it, then we error out.
Note that we don't consider in this patch if the temporary directory has been
set to `TMPDIR` in this patch. If `/tmp` is not accessible, we error out.

Fix #53955.

Reviewed By: jdoerfert

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

17 months ago[clang-format] Put peekNextToken(/*SkipComment=*/true) to good use
Owen Pan [Mon, 23 Jan 2023 23:30:38 +0000 (15:30 -0800)]
[clang-format] Put peekNextToken(/*SkipComment=*/true) to good use

To prevent potential bugs in situations where we want to peek the next
non-comment token.

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

17 months ago[libc++] Introduce a compile-time mechanism to override __libcpp_verbose_abort
Louis Dionne [Mon, 9 Jan 2023 21:59:59 +0000 (16:59 -0500)]
[libc++] Introduce a compile-time mechanism to override __libcpp_verbose_abort

This changes the mechanism for verbose termination (again!) to make it
support compile-time customization in addition to link-time customization,
which is important for users who need fine-grained control over what code
gets generated around sites that call the verbose termination handler.

This concern had been raised to me both privately by prospecting users
and in https://llvm.org/D140944, so I think it is clearly worth fixing.

We still support _LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED for
a limited time since the same functionality can be achieved by overriding
the _LIBCPP_VERBOSE_ABORT macro.

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

17 months agotest-release.sh: Only build clang for stage1 and stage2
Tom Stellard [Wed, 25 Jan 2023 02:09:13 +0000 (18:09 -0800)]
test-release.sh: Only build clang for stage1 and stage2

The stage1 and stage2 builds aren't packaged, so we only need to build
enough of the toolchain to build the next phase.

Reviewed By: thieta, amyk

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

17 months ago[compiler-rt] Remove XFAIL decorator trampoline_setup_test.c
Muhammad Omair Javaid [Wed, 25 Jan 2023 01:12:40 +0000 (06:12 +0500)]
[compiler-rt] Remove XFAIL decorator trampoline_setup_test.c

This patch remove xfail decorator from
builtins/Unit/trampoline_setup_test.c as it is passing on Windows/AArch64
nowz. It is being skipped in code with __clang__ not defined.

https://lab.llvm.org/buildbot/#/builders/120/builds/3873

17 months ago[RISCV] Combine extract_vector_elt followed by VFMV_S_F_VL.
Craig Topper [Tue, 24 Jan 2023 23:26:42 +0000 (15:26 -0800)]
[RISCV] Combine extract_vector_elt followed by VFMV_S_F_VL.

If we're extracting an element and inserting into a undef vector
with the same number of elements, we can use the original vector.

This pattern occurs around reductions that have been cascaded
together.

This can be generalized to wider/narrow vectors by using
insert_subvector/extract_subvector, but we don't have lit tests
for that case currently.

We can also support non-undef before by using a slide or vmv.v.v

Reviewed By: reames

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

17 months ago[NFC][libc++] Remove __unexpected namespace
yronglin [Wed, 25 Jan 2023 01:10:01 +0000 (09:10 +0800)]
[NFC][libc++] Remove __unexpected namespace

Remove __unexpected namespace.

Reviewed By: philnik, #libc, ldionne

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

17 months ago[lld-macho] Have all load commands aligned to the word size
Jez Ng [Wed, 11 Jan 2023 07:23:15 +0000 (02:23 -0500)]
[lld-macho] Have all load commands aligned to the word size

This is what ld64 does, and also what we already do for most of the
other load commands. I'm not aware of a good way to test this, but I
don't think it really matters.

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

17 months ago[ADT] Use fold expressions to compare tuples. NFCI
Benjamin Kramer [Wed, 25 Jan 2023 00:38:28 +0000 (01:38 +0100)]
[ADT] Use fold expressions to compare tuples. NFCI

17 months ago[HWASAN] Copy some ASAN independent unit tests from ASAN to LSAN
Kirill Stoimenov [Tue, 24 Jan 2023 23:46:04 +0000 (23:46 +0000)]
[HWASAN] Copy some ASAN independent unit tests from ASAN to LSAN

Reviewed By: vitalybuka

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

17 months ago[CodeGen] bugfix: add REQUIRES target triple in test
usama hameed [Tue, 24 Jan 2023 23:59:19 +0000 (15:59 -0800)]
[CodeGen] bugfix: add REQUIRES target triple in test

17 months ago[ADT] Fix circular include dependency by using std::array. NFC
Younan Zhang [Tue, 24 Jan 2023 23:58:34 +0000 (15:58 -0800)]
[ADT] Fix circular include dependency by using std::array. NFC

2db6b34ea introduces circular dependency on llvm::ArrayRef. By
inspecting commit history, it appears that we have some issue using
deduction guide on std::array. Why don't we try std::array with explicit
template arguments?

Differential revision: https://reviews.llvm.org/D141352

17 months ago[clang][test] Remove check that fails if SOURCE_DATE_EPOCH is set globally
Ben Langmuir [Tue, 24 Jan 2023 23:34:37 +0000 (15:34 -0800)]
[clang][test] Remove check that fails if SOURCE_DATE_EPOCH is set globally

The check for "no SOURCE_DATE_EPOCH" wasn't especially interesting, and
I am not aware of a _portable_ way to unset and environment variable in
a lit test. So remove it since it can fail if the build environment has
SOURCE_DATE_EPOCH set globally.

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

17 months ago[BOLT][DWARF] Reuse entries in .debug_addr when not modified
Alexander Yermolovich [Tue, 24 Jan 2023 23:54:28 +0000 (15:54 -0800)]
[BOLT][DWARF] Reuse entries in .debug_addr when not modified

In some binaries produced with ThinLTO there are CUs that share entry in
.debug_addr. Before we would generate a new entry for each. Which lead to binary
size increase. This changes the behavior so that we re-use entries in
.debug_addr.

Reviewed By: maksfb

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

17 months ago[mlir][tosa] Add RFFT2d operation
Luke Hutton [Tue, 24 Jan 2023 23:42:02 +0000 (15:42 -0800)]
[mlir][tosa] Add RFFT2d operation

Adds the RFFT2d TOSA operation and supporting
shape inference function.

Signed-off-by: Luke Hutton <luke.hutton@arm.com>
Change-Id: I7e49c47cdd846cdc1b187545ef76d5cda2d5d9ad

Reviewed By: jpienaar

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

17 months ago[ASan] Introduce a flag -asan-constructor-kind to control the generation of the Asan...
usama hameed [Tue, 24 Jan 2023 22:03:26 +0000 (14:03 -0800)]
[ASan] Introduce a flag -asan-constructor-kind to control the generation of the Asan module constructor.

By default, ASan generates an asan.module_ctor function that initializes asan and
registers the globals in the module. This function is added to the
@llvm.global_ctors array. Previously, there was no way to control the
generation of this function.

This patch adds a way to control the generation of this function. The
flag -asan-constructor-kind has two options:

global: This is the default option and the default behavior of ASan. It generates an
asan.module_ctor function.
none: This skips the generation of the asan.module_ctor function.

rdar://104448572

Differential revision: https://reviews.llvm.org/D142505

17 months ago[CodeGen] bugfix: ApplyDebugLocation goes out of scope before intended
usama hameed [Fri, 20 Jan 2023 19:24:05 +0000 (11:24 -0800)]
[CodeGen] bugfix: ApplyDebugLocation goes out of scope before intended

rdar://103570533

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

17 months ago[OpenMP][libomptarget] Implement memory lock/unlock API in NextGen plugins
Kevin Sala [Sun, 8 Jan 2023 16:35:14 +0000 (17:35 +0100)]
[OpenMP][libomptarget] Implement memory lock/unlock API in NextGen plugins

This patch implements the memory lock/unlock API, introduced in patch https://reviews.llvm.org/D139208,
in the NextGen plugins. Locked buffers feature reference counting and we allow certain overlapping. Given
an already locked buffer A, other buffers that are fully contained inside A can be locked again, even if
they are smaller than A. In this case, the reference count of locked buffer A will be incremented. However,
extending an existing locked buffer is not allowed. The original buffer is actually unlocked once all its
users have released the locked buffer and sub-buffers (i.e., the reference counter becomes zero).

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

17 months ago[InlineCost] model calls to llvm.objectsize.*
Nick Desaulniers [Tue, 24 Jan 2023 22:54:50 +0000 (14:54 -0800)]
[InlineCost] model calls to llvm.objectsize.*

Very similar to https://reviews.llvm.org/D111272. We very often can
evaluate calls to llvm.objectsize.* regardless of inlining. Don't count
calls to llvm.objectsize.* against the InlineCost when we can evaluate
the call to a constant.

Link: https://github.com/ClangBuiltLinux/linux/issues/1302
Reviewed By: manojgupta

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

17 months ago[Clang] Add missing requires directives for new test
Joseph Huber [Tue, 24 Jan 2023 23:09:18 +0000 (17:09 -0600)]
[Clang] Add missing requires directives for new test

Summary:
Forgot to add this.

17 months ago[OpenMP] Do not link the bitcode OpenMP runtime when targeting AMDGPU.
Joseph Huber [Tue, 24 Jan 2023 17:45:17 +0000 (11:45 -0600)]
[OpenMP] Do not link the bitcode OpenMP runtime when targeting AMDGPU.

The AMDGPU target can only emit LLVM-IR, so we can always rely on LTO to
link the static version of the runtime optimally. Using the static
library only has a few advantages. Namely, it avoids several known bugs
and allows us to optimize out more functions. This is legal since the
changes in D142486 and D142484

Depends on D142486 D142484

Reviewed By: jdoerfert

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

17 months ago[OpenMP] Unconditionally link the OpenMP device RTL static library
Joseph Huber [Tue, 24 Jan 2023 17:18:22 +0000 (11:18 -0600)]
[OpenMP] Unconditionally link the OpenMP device RTL static library

Currently we have two versions of the static library. One is built as
individual bitcode files and linked via `-mlink-builtin-bitcode`. The
other is built as a single static archive `omptarget.devicertl.a` and is
linked via `-lomptarget.devicertl` and handled by the linker wrapper
during LTO. We use the former in the case that we are not performing
LTO, because linking the library late wouldn't allow us to optimize the
runtime library effectively. The support in D142484 allows us to
unconditionally link this library, so it will only be pulled in if
needed. That is, if we linked already via `-mlink-builtin-bitcode` then
we will not pull in the static library even if it's linked on the
command line.

Depends on D142484

Reviewed By: jdoerfert

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

17 months ago[LinkerWrapper] Only import static libraries with needed symbols
Joseph Huber [Tue, 24 Jan 2023 17:04:47 +0000 (11:04 -0600)]
[LinkerWrapper] Only import static libraries with needed symbols

Currently, we pull in every single static archive member as long as we
have an offloading architecture that requires it. This goes against the
standard sematnics of static libraries that only pull in symbols that
define currently undefined symbols. In order to support this we roll
some custom symbol resolution logic to check if a static library is
needed. Because of offloading semantics, this requires an extra check
for externally visibile symbols. E.g. if a static member defines a
kernel we should import it.

The main benefit to this is that we can now link against the
`libomptarget.devicertl.a` library unconditionally. This removes the
requirement for users to specify LTO on the link command. This will also
allow us to stop using the `amdgcn` bitcode versions of the libraries.

```
clang foo.c -fopenmp --offload-arch=gfx1030 -foffload-lto -c
clang foo.o -fopenmp --offload-arch=gfx1030 -foffload-lto
```

Reviewed By: tra

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

17 months ago[OpenMP][docs] Update for record-and-replay
Giorgis Georgakoudis [Tue, 24 Jan 2023 22:33:44 +0000 (14:33 -0800)]
[OpenMP][docs] Update for record-and-replay

Reviewed By: jdoerfert

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

17 months ago[BOLT] Use range-based implicit def/use accessors. NFCI
Benjamin Kramer [Tue, 24 Jan 2023 22:11:23 +0000 (23:11 +0100)]
[BOLT] Use range-based implicit def/use accessors. NFCI

17 months ago[X86] Add support for "light" AVX
Ilya Tokar [Thu, 15 Dec 2022 20:00:27 +0000 (15:00 -0500)]
[X86] Add support for "light" AVX

AVX/AVX512 instructions may cause frequency drop on e.g. Skylake.
The magnitude of frequency/performance drop depends on instruction
(multiplication vs load/store) and vector width. Currently users,
that want to avoid this drop can specify -mprefer-vector-width=128.
However this also prevents generations of 256-bit wide instructions,
that have no associated frequency drop (mainly load/stores).

Add a tuning flag that allows generations of 256-bit AVX load/stores,
even when -mprefer-vector-width=128 is set, to speed-up memcpy&co.
Verified that running memcpy loop on all cores has no frequency impact
and zero CORE_POWER:LVL[12]_TURBO_LICENSE perf counters.

Makes coping memory faster e.g.:
BM_memcpy_aligned/256 80.7GB/s Â± 3% 96.3GB/s Â± 9% +19.33% (p=0.000 n=9+9)

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

17 months ago[OpenMP] Disable tests that are not supported by GCC if it is used for testing
Shilei Tian [Tue, 24 Jan 2023 21:59:52 +0000 (16:59 -0500)]
[OpenMP] Disable tests that are not supported by GCC if it is used for testing

GCC doesn't support `-fopenmp-version`, causing test failure if the compiler used
for testing is GCC.

GCC's OpenMP 5.2 support is very limited yet. Disable those tests requiring 5.2
feature for GCC as well.

We might want to take a look at all `libomp` tests and mark those tests that
don't support GCC yet.

Reviewed By: ABataev

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

17 months ago[llvm][DiagnosticInfo] handle function pointer casts
Nick Desaulniers [Tue, 24 Jan 2023 21:52:24 +0000 (13:52 -0800)]
[llvm][DiagnosticInfo] handle function pointer casts

As pointed out by @arsenm in https://reviews.llvm.org/D141451#4045099,
we don't handle ConstantExpressions for dontcall-{warn|error} IR Fn
Attrs.

Use CallBase::getCalledOperand() and Value::stripPointerCasts() should
the call to CallBase::getCalledFunction return nullptr.

I don't know how to express the IR test case in C, otherwise I'd add a
clang test, too.

Reviewed By: aeubanks

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

17 months agoIR: Add atomicrmw uinc_wrap and udec_wrap
Matt Arsenault [Thu, 3 Nov 2022 01:50:48 +0000 (18:50 -0700)]
IR: Add atomicrmw uinc_wrap and udec_wrap

These are essentially add/sub 1 with a clamping value.

AMDGPU has instructions for these. CUDA/HIP expose these as
atomicInc/atomicDec. Currently we use target intrinsics for these,
but those do no carry the ordering and syncscope. Add these to
atomicrmw so we can carry these and benefit from the regular
legalization processes.

17 months ago[InstCombine] invert canonicalization of sext (x > -1) --> not (ashr x)
Sanjay Patel [Tue, 24 Jan 2023 21:01:37 +0000 (16:01 -0500)]
[InstCombine] invert canonicalization of sext (x > -1) --> not (ashr x)

https://alive2.llvm.org/ce/z/2iC4oB

This is similar to changes made for zext + lshr:
21d3871b7c90
6c39a3aae1dc

The existing fold did not account for extra uses, so we
see some instruction count reductions in the test diffs.

This is intended to improve analysis (icmp likely has more
transforms than any other opcode), make other transforms
more symmetric with zext/lshr, and it can be inverted
in codegen if profitable.

As with the earlier changes, there is potential to uncover
infinite combine loops, but I have not found any yet.

17 months ago[flang] Fixed missing dependency.
Slava Zakharin [Tue, 24 Jan 2023 21:24:42 +0000 (13:24 -0800)]
[flang] Fixed missing dependency.

It looks like a flaky issue that sometimes breaks the buildbot:
https://lab.llvm.org/buildbot/#/builders/181/builds/13475

Reviewed By: clementval

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

17 months ago[MC] Store target Insts table in reverse order. NFC.
Jay Foad [Wed, 11 Jan 2023 15:18:42 +0000 (15:18 +0000)]
[MC] Store target Insts table in reverse order. NFC.

This will allow an entry in the table to access data that is stored
immediately after the end of the table, by adding its opcode value
to its address.

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

17 months ago[AArch64] Add the Ampere1A core
Philipp Tomsich [Tue, 24 Jan 2023 21:28:22 +0000 (22:28 +0100)]
[AArch64] Add the Ampere1A core

The Ampere1A core improves on the Ampere1 with key differences being:
 * memory tagging is supported
 * SM3/SM4 are supported
 * adds a new fusion pair for (A+B+1 and A-B-1)
   (added in a later commit)

Depends on D142395

Reviewed By: dmgreen

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

17 months ago[MC] Store number of implicit operands in MCInstrDesc. NFC.
Jay Foad [Wed, 11 Jan 2023 13:45:46 +0000 (13:45 +0000)]
[MC] Store number of implicit operands in MCInstrDesc. NFC.

Combine the implicit uses and defs lists into a single list of uses
followed by defs. Instead of 0-terminating the list, store the number
of uses and defs. This avoids having to scan the whole list to find the
length and removes one pointer from MCInstrDesc (although it does not
get any smaller due to alignment issues).

Remove the old accessor methods getImplicitUses, getNumImplicitUses,
getImplicitDefs and getNumImplicitDefs as all clients are using the new
implicit_uses and implicit_defs.

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

17 months ago[OpenMP][NFC] Augment release notes
Johannes Doerfert [Tue, 24 Jan 2023 21:22:54 +0000 (13:22 -0800)]
[OpenMP][NFC] Augment release notes

17 months ago[AArch64] Update enabled extensions for Ampere1 core
Philipp Tomsich [Tue, 24 Jan 2023 21:16:20 +0000 (22:16 +0100)]
[AArch64] Update enabled extensions for Ampere1 core

The original enablement for the Ampere1 core inadvertently had omitted
that FEAT_RAND is support and errorously claimed that FEAT_MTE was
available.

Adjust the definition of Ampere1 to match reality.

Reviewed By: dmgreen

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

17 months ago[OpenMP][Doc] Update release notes with NextGen plugins
Kevin Sala [Tue, 24 Jan 2023 21:02:30 +0000 (22:02 +0100)]
[OpenMP][Doc] Update release notes with NextGen plugins

17 months agoFix C++11 warnings in RangeSetTest.cpp
Philipp Tomsich [Tue, 24 Jan 2023 21:12:46 +0000 (22:12 +0100)]
Fix C++11 warnings in RangeSetTest.cpp

This change fixes the following warnings:
   llvm/clang/unittests/StaticAnalyzer/RangeSetTest.cpp:727:55: warning: ISO C++11 requires at least one argument for the "..." in a variadic macro
     727 | TYPED_TEST_SUITE(RangeSetCastToNoopTest, NoopCastTypes);
 |                                                       ^
   llvm/clang/unittests/StaticAnalyzer/RangeSetTest.cpp:728:65: warning: ISO C++11 requires at least one argument for the "..." in a variadic macro
     728 | TYPED_TEST_SUITE(RangeSetCastToPromotionTest, PromotionCastTypes);
 |                                                                 ^
   llvm/clang/unittests/StaticAnalyzer/RangeSetTest.cpp:729:67: warning: ISO C++11 requires at least one argument for the "..." in a variadic macro
     729 | TYPED_TEST_SUITE(RangeSetCastToTruncationTest, TruncationCastTypes);
 |                                                                   ^
   llvm/clang/unittests/StaticAnalyzer/RangeSetTest.cpp:730:67: warning: ISO C++11 requires at least one argument for the "..." in a variadic macro
     730 | TYPED_TEST_SUITE(RangeSetCastToConversionTest, ConversionCastTypes);
 |                                                                   ^
   llvm/clang/unittests/StaticAnalyzer/RangeSetTest.cpp:732:46: warning: ISO C++11 requires at least one argument for the "..." in a variadic macro
     732 |                  PromotionConversionCastTypes);
 |                                              ^
   llvm/clang/unittests/StaticAnalyzer/RangeSetTest.cpp:734:47: warning: ISO C++11 requires at least one argument for the "..." in a variadic macro
     734 |                  TruncationConversionCastTypes);
 |                                               ^

Reviewed By: steakhal

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

17 months ago[Clang] Only emit textual LLVM-IR in device only mode
Joseph Huber [Fri, 13 Jan 2023 19:31:18 +0000 (13:31 -0600)]
[Clang] Only emit textual LLVM-IR in device only mode

Currently, we embed device code into the host to perform
multi-architecture linking and handling of device code. If the user
specified `-S -emit-llvm` then the embedded output will be textual
LLVM-IR. This is a problem because it can't be used by the LTO backend
and it makes reading the file confusing.

This patch changes the behaviour to only emit textual device IR if we
are in device only mode, that is, if the device code is presented
directly to the user instead of being embedded. Otherwise we should
always embed device bitcode instead.

Reviewed By: tra

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

17 months ago[analyzer] Update satest dependencies
Manas [Tue, 24 Jan 2023 21:06:46 +0000 (02:36 +0530)]
[analyzer] Update satest dependencies

A couple of packages were out-dated while building satest docker image.
This patch updates those.

Reviewed By: steakhal

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

17 months ago[analyzer][solver] Improve reasoning for not equal to operator
Manas [Tue, 24 Jan 2023 20:59:05 +0000 (02:29 +0530)]
[analyzer][solver] Improve reasoning for not equal to operator

This patch fixes certain cases where solver was not able to infer
disequality due to overlapping of values in rangeset. This case was
casting from lower signed type to bigger unsigned type.

Reviewed By: steakhal

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

17 months agoRevert "[15/15][Clang][RISCV][NFC] Set data member under Policy as constants"
Douglas Yung [Tue, 24 Jan 2023 20:59:15 +0000 (12:59 -0800)]
Revert "[15/15][Clang][RISCV][NFC] Set data member under Policy as constants"

This reverts commit 2b807336ad385e64a7d182d5fb67bdfe449707a3.

This change is causing Windows builds to hang and out of memory errors with clang-15:
 - https://lab.llvm.org/buildbot/#/builders/17/builds/33129
 - https://lab.llvm.org/buildbot/#/builders/174/builds/17069
 - https://lab.llvm.org/buildbot/#/builders/83/builds/28484
 - https://lab.llvm.org/buildbot/#/builders/172/builds/22803
 - https://lab.llvm.org/buildbot/#/builders/216/builds/16210

17 months ago[SCCP] Use range info to prove AddInst has NUW flag.
Florian Hahn [Tue, 24 Jan 2023 20:53:06 +0000 (20:53 +0000)]
[SCCP] Use range info to prove AddInst has NUW flag.

This patch updates SCCP to use the value ranges of AddInst operands to
try to prove the AddInst does not overflow in the unsigned sense and
adds the NUW flag. The reasoning is done with
makeGuaranteedNoWrapRegion (thanks @nikic for point it out!).

Follow-ups will include adding NSW and extension to more
OverflowingBinaryOperators.

Reviewed By: nikic

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

17 months ago[InstCombine] canonicalize 'not' ahead of bitcast+sext
Sanjay Patel [Tue, 24 Jan 2023 20:30:29 +0000 (15:30 -0500)]
[InstCombine] canonicalize 'not' ahead of bitcast+sext

not (bitcast (sext i1 X)) --> bitcast (sext (not i1 X))

https://alive2.llvm.org/ce/z/-6Ygkd

This shows up as a potential regression if we change
canonicalization of ashr+not to icmp+sext.

17 months ago[InstCombine] add tests for 'not' of cast of cast; NFC
Sanjay Patel [Tue, 24 Jan 2023 19:58:53 +0000 (14:58 -0500)]
[InstCombine] add tests for 'not' of cast of cast; NFC

17 months agoDrop a path component from the sarif diagnostics test; NFC
Aaron Ballman [Tue, 24 Jan 2023 20:35:36 +0000 (15:35 -0500)]
Drop a path component from the sarif diagnostics test; NFC

The test currently expects to be run in a directory named 'clang' but
that's not valid for our release tarballs. We don't actually care what
base directory the test is run from, so this removes the path component
entirely.

17 months ago[asan] fix two memory leaks in integration tests
Aart Bik [Tue, 24 Jan 2023 19:57:16 +0000 (11:57 -0800)]
[asan] fix two memory leaks in integration tests

Note that I did not track why this started failing exactly,
which is why I CC Matthias on this fix. But at least we run
asan clean again for the whole suite after this change.

Reviewed By: ftynse

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

17 months ago[TargetParser] Remove an EXPECT that is never executed
Paul Robinson [Tue, 24 Jan 2023 20:26:26 +0000 (12:26 -0800)]
[TargetParser] Remove an EXPECT that is never executed

Found by the Rotten Green Tests project.

17 months ago[RISCV][LSR] Treat number of instructions as dominate factor in LSR cost decisions
Philip Reames [Tue, 24 Jan 2023 19:33:28 +0000 (11:33 -0800)]
[RISCV][LSR] Treat number of instructions as dominate factor in LSR cost decisions

This matches the behavior from a number of other targets, including e.g. X86. This does have the effect of increasing register pressure slightly, but we have a relative abundance of registers in the ISA compared to other targets which use the same heuristic.

The motivation here is that our current cost heuristic treats number of registers as the dominant cost. As a result, an extra use outside of a loop can radically change the LSR result. As an example consider test4 from the recently added test/Transforms/LoopStrengthReduce/RISCV/lsr-cost-compare.ll. Without a use outside the loop (see test3), we convert the IV into a pointer increment. With one, we leave the gep in place.

The pointer increment version both decreases number of instructions in some loops, and creates parallel chains of computation (i.e. decreases critical path depth). Both are generally profitable.

Arguably, we should really be using a more sophisticated model here - such as e.g. using profile information or explicitly modeling parallelism gains. However, as a practical matter starting with the same mild hack that other targets have used seems reasonable.

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

17 months ago[libc][NFC] Replace "inline" keyword with "LIBC_INLINE".
Siva Chandra Reddy [Tue, 24 Jan 2023 07:10:06 +0000 (07:10 +0000)]
[libc][NFC] Replace "inline" keyword with "LIBC_INLINE".

This is the first of patches doing similar cleanup. A section in the
code style doc has been added explaining where and how LIBC_INLINE is to
be used.

Reviewed By: jeffbailey, lntue

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

17 months ago[OpenMP][Docs] Add non-blocking target nowait environment variables
Guilherme Valarini [Tue, 24 Jan 2023 19:30:34 +0000 (16:30 -0300)]
[OpenMP][Docs] Add non-blocking target nowait environment variables

17 months ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Tue, 24 Jan 2023 16:34:30 +0000 (11:34 -0500)]
[InstCombine] regenerate test checks; NFC

Value name propagation improved.

17 months ago[InstCombine] reduce code duplication; NFC
Sanjay Patel [Tue, 24 Jan 2023 16:21:29 +0000 (11:21 -0500)]
[InstCombine] reduce code duplication; NFC

17 months ago[InstCombine] rename variables for readability; NFC
Sanjay Patel [Tue, 24 Jan 2023 15:46:00 +0000 (10:46 -0500)]
[InstCombine] rename variables for readability; NFC

There's no reason to use "CI" (cast instruction) when
we know that the value is a more specific (exact) type
of instruction (although we might want to common-ize some
of this code to eliminate duplication or logic diffs).

It's also visually difficult to distinguish between "CI",
"ICI", and "IC" acronyms (and those could change meaning
depending on context).

This was partially changed in earlier commits, so this
makes this pair of functions consistent.

17 months ago[AMDGPU] Split dot8 feature
Stanislav Mekhanoshin [Mon, 23 Jan 2023 22:41:05 +0000 (14:41 -0800)]
[AMDGPU] Split dot8 feature

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

17 months ago[OpenMP][Doc] Update release note for 16 release
Shilei Tian [Tue, 24 Jan 2023 19:04:28 +0000 (14:04 -0500)]
[OpenMP][Doc] Update release note for 16 release

17 months ago[AMDGPU] Remove dot1 and dot6 features from clang for gfx11
Stanislav Mekhanoshin [Tue, 24 Jan 2023 18:22:32 +0000 (10:22 -0800)]
[AMDGPU] Remove dot1 and dot6 features from clang for gfx11

These are unsupported.

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

17 months ago[NFC] Update tsan_rtl.h comment after D142039
Han Zhu [Tue, 24 Jan 2023 18:46:31 +0000 (10:46 -0800)]
[NFC] Update tsan_rtl.h comment after D142039

17 months ago[flang] Keep a fir.box type when doing an array of derived type component
Valentin Clement [Tue, 24 Jan 2023 15:37:52 +0000 (16:37 +0100)]
[flang] Keep a fir.box type when doing an array of derived type component

When referencing a single component from a polymorphic array in an expression,
the rebox operation should output a boxed array of that component type and
not a polymorphic boxed array as it was done.

Reviewed By: PeteSteinfeld

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

17 months ago[IPSCCP][FuncSpec] Fix compiler crash 60191.
Alexandros Lamprineas [Mon, 23 Jan 2023 18:08:51 +0000 (18:08 +0000)]
[IPSCCP][FuncSpec] Fix compiler crash 60191.

Found here https://github.com/llvm/llvm-project/issues/60191

The compiler would crash when specializing a function based on a function
pointer whose call sites may expect less parameters than those of the
function we are replacing the pointer with.

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

17 months ago[OpenMP][Docs] Add some release notes for OpenMP
Joseph Huber [Tue, 24 Jan 2023 18:35:45 +0000 (12:35 -0600)]
[OpenMP][Docs] Add some release notes for OpenMP

17 months agoTeach RuntimeDyld about COFF weak references and to consider comdat symbols weak.
Vassil Vassilev [Tue, 24 Jan 2023 18:24:10 +0000 (18:24 +0000)]
Teach RuntimeDyld about COFF weak references and to consider comdat symbols weak.

Patch by Lang Hames and Sunho Kim!

Differential revision: https://reviews.llvm.org/D138264

17 months agoCorrect some dead links in the clang-tidy docs
Pratik Sharma [Tue, 24 Jan 2023 18:22:41 +0000 (13:22 -0500)]
Correct some dead links in the clang-tidy docs

There were some dead links in Suppressing Undesired Diagnostics which I
replaced with the working links.

Fixes #60023

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

17 months agoRevert "[OpenMP][Archer] Use dlsym rather than weak symbols for TSan annotations"
Slava Zakharin [Tue, 24 Jan 2023 18:17:35 +0000 (10:17 -0800)]
Revert "[OpenMP][Archer] Use dlsym rather than weak symbols for TSan annotations"

OpenMP buildbots are failing:
https://lab.llvm.org/buildbot/#/builders/193/builds/25434
https://lab.llvm.org/buildbot/#/builders/193/builds/25420

This reverts commit 7fbf12210007a66f7b62beadc0e5a52561cc0ab3.

17 months ago[AMDGPU] Add missing gfx11 tests in the directive-amdgcn-target.ll. NFC.
Stanislav Mekhanoshin [Tue, 24 Jan 2023 17:50:44 +0000 (09:50 -0800)]
[AMDGPU] Add missing gfx11 tests in the directive-amdgcn-target.ll. NFC.

17 months ago[clang][deps] NFC: Remove dead code
Jan Svoboda [Tue, 24 Jan 2023 00:16:27 +0000 (16:16 -0800)]
[clang][deps] NFC: Remove dead code

This patch removes some dead code in the dependency scanner.

The `ModuleDeps::ImplicitModulePCMPath` member stopped being used in D131934.

The strict context hash was replaced in D129884 by hash of the canonical command line.

Reviewed By: benlangmuir

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

17 months ago[clang][deps] Account for transitive spurious dependencies
Jan Svoboda [Tue, 24 Jan 2023 17:31:04 +0000 (09:31 -0800)]
[clang][deps] Account for transitive spurious dependencies

In D106100, we started guarding against spurious dependencies on modules that ended up being textual includes and thus didn't have any AST file associated. That patch accounted only for direct dependencies. There's a way how to get spurious dependencies for modules that are transitive. This patch guards against that scenario and adds a test case.

(Note that since D142167, we don't allow `@import FW_Private` with `-fmodule-name=FW` anymore. However, that check lives in sema, which the scanner doesn't run. Being defensive in this patch therefore still makes sense.)

rdar://104324602

Reviewed By: benlangmuir

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

17 months ago[AVR] Support most address space casts
Ayke van Laethem [Thu, 19 Jan 2023 13:49:43 +0000 (14:49 +0100)]
[AVR] Support most address space casts

All hardware address spaces on AVR can be freely cast between (they keep
the same bit pattern). They just aren't dereferenceable when they're in
a different address space as they really do point to a separate address
space.

This is supported in avr-gcc: https://godbolt.org/z/9Gfvhnhv9

avr-gcc also supports the `__memx` address space which is 24 bits. We
don't support this address space yet but I've added a safeguard just in
case.

Differential Revison: https://reviews.llvm.org/D142107

17 months ago[VPlan] Fix leak by manually cleaning up allocated Phi in test.
Florian Hahn [Tue, 24 Jan 2023 17:20:16 +0000 (17:20 +0000)]
[VPlan] Fix leak by manually cleaning up allocated Phi in test.

This should fix a LeakSanitizer failure reported here:
https://lab.llvm.org/buildbot/#/builders/5/builds/30952

17 months ago[libc++][format] Fixes usage of contiguous ranges.
Mark de Wever [Sun, 22 Jan 2023 12:31:27 +0000 (13:31 +0100)]
[libc++][format] Fixes usage of contiguous ranges.

The contiguous range made incorrect assumptions for certain input
ranges.

Fixes llvm.org/PR60164

Reviewed By: #libc, ldionne

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

17 months ago[clang][deps] Add module files for input dependencies earlier
Ben Langmuir [Thu, 19 Jan 2023 17:31:31 +0000 (09:31 -0800)]
[clang][deps] Add module files for input dependencies earlier

I originally thought we needed to add module file inputs for modular
deps at the same time as outputs because they depend on the
lookupModuleOutput callback, but this is not the case: they only depend
on the callback results for other modules, which have already been
computed by this point. So move them earlier so that they're set in the
CompilerInvocation at the same time as other inputs. This makes the
code easier to understand.

This change is effectively NFC, though it technically changes the module
exact value of the context hash.

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

17 months ago[15/15][Clang][RISCV][NFC] Set data member under Policy as constants
eopXD [Sun, 15 Jan 2023 17:56:23 +0000 (09:56 -0800)]
[15/15][Clang][RISCV][NFC] Set data member under Policy as constants

The object is now correct by construction.

This is the 15th commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Depends on D141793.

Reviewed By: craig.topper

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

17 months ago[14/15][Clang][RISCV] Change default policy from TAMU to TAMA
eopXD [Sun, 15 Jan 2023 12:27:07 +0000 (04:27 -0800)]
[14/15][Clang][RISCV] Change default policy from TAMU to TAMA

After this commit, the non-policy variants of `vid` and `viota` are no
longer available for an oveloaded version since the default policy is
now TAMA and the masked-off operand is removed.

Be noted that ALL RVV intrinsics now operate under the general
assumption that a policy behavior is "agnostic" unless specified.
Therefore this patch also changes the semantic of policy intrinsics
with the suffix of `_ta` and `tu`. These intrinsics don't have their
mask policy specified and was assumed to be undisturbed. It is now
changed to agnostic.

This is the 14th commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Reviewed By: craig.topper

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

17 months ago[13/15][Clang][RISCV][NFC] Remove repeating test cases under rvv-intrinsics-autogenerated
eopXD [Sun, 15 Jan 2023 12:48:33 +0000 (04:48 -0800)]
[13/15][Clang][RISCV][NFC] Remove repeating test cases under rvv-intrinsics-autogenerated

These files were oversights in D141198. The test cases are now under its
exact mnemonics. For example, test cases of `vle8`, `vle16`, `vle32`,
and `vle64` were under `vle.c`. Now they are exist under `vle8.c`,
`vle16.c`, `vle32.c`, and `vle64.c`, respectively.

This is the 13th commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Reviewed By: craig.topper

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

17 months ago[12/15][Clang][RISCV][NFC] Refine the way to check for Policy in riscv_vector_builtin...
eopXD [Sun, 15 Jan 2023 12:13:48 +0000 (04:13 -0800)]
[12/15][Clang][RISCV][NFC] Refine the way to check for Policy in riscv_vector_builtin_cg.inc

The current way creates a fallacy that checking for
`PolicyAttrs == TAIL_AGNOSTIC` is implicitly equivalant to
`TAIL_AGNOSTIC_MASK_UNDISTURBED`. This works under the assumption that
an unmasked intrinsic has a policy of TAMU. The expression here is
mis-leading and will not be correct when the default policy is not
TAMU.

As this patch-set targets to change the default policy from TAMU to
TAMA, this commit is necessary before changing the default.

This is the 12th commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Reviewed By: craig.topper

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

17 months agoRevert D142108 "[reland][libc][NFC] Detect host CPU features using try_compile instea...
Guillaume Chatelet [Tue, 24 Jan 2023 16:22:26 +0000 (16:22 +0000)]
Revert D142108 "[reland][libc][NFC] Detect host CPU features using try_compile instead of try_run."

The build bots are failing.
This reverts commit c84d74f5bfe810744de1268eb0516a6622e4aa73.

17 months ago[libc++][doc] Updates format status.
Mark de Wever [Thu, 19 Jan 2023 20:17:34 +0000 (21:17 +0100)]
[libc++][doc] Updates format status.

The paper
- P2286R8 Formatting ranges
is fully implemented modulo its feature test macro. This macro has been
revised by
- LWG3750 Too many papers bump __cpp_lib_format
The new macro depends on
- P2585R0 Improving default container formatting
This paper revises parts of P2286R8 and adds new formatter
specializations. The specialization for debug strings has some wording
issues, which is addresses in this paper
- P2733R0 Fix handling of empty specifiers in std::format

Reviewed By: #libc, ldionne

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

17 months ago[11/15][Clang][RISCV][NFC] Remove Policy::PolicyType::Omit
eopXD [Sat, 14 Jan 2023 16:06:19 +0000 (08:06 -0800)]
[11/15][Clang][RISCV][NFC] Remove Policy::PolicyType::Omit

The attribute can be removed now as preceding patches have removed its
users.

This is the 11th commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Reviewed By: craig.topper, kito-cheng

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