platform/upstream/llvm.git
16 months ago[libc++] Fix thread annotations on shared_mutex and shared_timed_mutex
Louis Dionne [Mon, 3 Jul 2023 15:02:47 +0000 (11:02 -0400)]
[libc++] Fix thread annotations on shared_mutex and shared_timed_mutex

Based on the comment in https://reviews.llvm.org/D54290#4418958, these
attributes need to be on the top-level functions in order to work
properly. Also, add tests.

Fixes http://llvm.org/PR57035.

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

16 months ago[RISCV][test] Add RV32I and RV64I RUN lines to llvm.frexp.ll
Alex Bradbury [Thu, 6 Jul 2023 12:34:58 +0000 (13:34 +0100)]
[RISCV][test] Add RV32I and RV64I RUN lines to llvm.frexp.ll

Thanks to D154555, these intrinsics no longer crash when used with a
soft float ABI.

16 months ago[LV] Consider if scalar epilogue is required in getMaximizedVFForTarget.
Florian Hahn [Thu, 6 Jul 2023 12:31:44 +0000 (13:31 +0100)]
[LV] Consider if scalar epilogue is required in getMaximizedVFForTarget.

When a scalar epilogue is required, at least one iteration of the scalar loop
has to execute. Adjust ConstTripCount accordingly to avoid picking a max VF
that results in a dead vector loop.

Reviewed By: Ayal

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

16 months ago[lldb][NFC] Remove code duplication in InitOSO
Felipe de Azevedo Piovezan [Wed, 5 Jul 2023 12:44:52 +0000 (08:44 -0400)]
[lldb][NFC] Remove code duplication in InitOSO

Two identical loops were iterating over different ranges, leading to code
duplication. We replace this by a loop over the concatenation of the ranges.

We also use early returns to avoid deeply nested code and explicitly check for a
condition mentioned in comments.

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

16 months agoFix compile error in UnresolvedSetTest.cpp, hopefully the last one
John Brawn [Thu, 6 Jul 2023 10:48:10 +0000 (11:48 +0100)]
Fix compile error in UnresolvedSetTest.cpp, hopefully the last one

This test is failing to compile when LLVM_ENABLE_MODULES=ON due to
NamedDecl being multiply defined. Fix this by avoiding declaring our
own NamedDecl in the test and instead cast a struct of appropriate
size and alignment to NamedDecl.

16 months agoupdate_mir_test_checks.py - separate different prefix checks
Eddie Phillips [Thu, 6 Jul 2023 10:48:56 +0000 (11:48 +0100)]
update_mir_test_checks.py - separate different prefix checks

Matches behaviour in update_llc_test_checks.py etc.

Fixes #63112

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

16 months ago[AMDGPU] Add GlobalISel test coverage for floating-point truncations.
Ivan Kosarev [Thu, 6 Jul 2023 10:22:25 +0000 (11:22 +0100)]
[AMDGPU] Add GlobalISel test coverage for floating-point truncations.

Reviewed By: arsenm

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

16 months ago[compiler-rt] Fix __sanitizer_cpuset size on newer FreeBSD
Marco Elver [Thu, 6 Jul 2023 10:25:47 +0000 (12:25 +0200)]
[compiler-rt] Fix __sanitizer_cpuset size on newer FreeBSD

Current FreeBSD has increased size of cpuset. Match it to not break the
build on newer FreeBSD.

Patch by John F. Carr

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

16 months ago[LLD][ELF] Cortex-M Security Extensions (CMSE) Support
Amilendra Kodithuwakku [Thu, 6 Jul 2023 09:45:10 +0000 (10:45 +0100)]
[LLD][ELF] Cortex-M Security Extensions (CMSE) Support

This commit provides linker support for Cortex-M Security Extensions (CMSE).
The specification for this feature can be found in ARM v8-M Security Extensions:
Requirements on Development Tools.

The linker synthesizes a security gateway veneer in a special section;
`.gnu.sgstubs`, when it finds non-local symbols `__acle_se_<entry>` and `<entry>`,
defined relative to the same text section and having the same address. The
address of `<entry>` is retargeted to the starting address of the
linker-synthesized security gateway veneer in section `.gnu.sgstubs`.

In summary, the linker translates input:

```
    .text
  entry:
  __acle_se_entry:
    [entry_code]

```
into:

```
    .section .gnu.sgstubs
  entry:
    SG
    B.W __acle_se_entry

    .text
  __acle_se_entry:
    [entry_code]
```

If addresses of `__acle_se_<entry>` and `<entry>` are not equal, the linker
considers that `<entry>` already defines a secure gateway veneer so does not
synthesize one.

If `--out-implib=<out.lib>` is specified, the linker writes the list of secure
gateway veneers into a CMSE import library `<out.lib>`. The CMSE import library
will have 3 sections: `.symtab`, `.strtab`, `.shstrtab`. For every secure gateway
veneer <entry> at address `<addr>`, `.symtab` contains a `SHN_ABS` symbol `<entry>` with
value `<addr>`.

If `--in-implib=<in.lib>` is specified, the linker reads the existing CMSE import
library `<in.lib>` and preserves the entry function addresses in the resulting
executable and new import library.

Reviewed By: MaskRay, peter.smith

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

16 months ago[llvm][Support] Deprecate llvm::writeFileAtomically API
Haojian Wu [Mon, 3 Jul 2023 09:49:13 +0000 (11:49 +0200)]
[llvm][Support] Deprecate llvm::writeFileAtomically API

We're in favor of the llvm::writeToOutput API, and all
writeFileAtomically usages have been migrated to writeToOutput.

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

16 months ago[mlir][linalg][transform] Fix Python build
Matthias Springer [Thu, 6 Jul 2023 10:20:03 +0000 (12:20 +0200)]
[mlir][linalg][transform] Fix Python build

This should have been part of D154585.

16 months ago[MLIR][Linalg] Expose `packMatmulGreedily` in `Transforms.h` (NFC)
Lorenzo Chelini [Wed, 5 Jul 2023 13:11:22 +0000 (15:11 +0200)]
[MLIR][Linalg] Expose `packMatmulGreedily` in `Transforms.h` (NFC)

Make the transformation accessible to other drivers (i.e., passes).

16 months ago[X86] Fold BITOP(PACKSS(X,Z),PACKSS(Y,W)) --> PACKSS(BITOP(X,Y),BITOP(Z,W)) (REAPPLIED)
Simon Pilgrim [Thu, 6 Jul 2023 09:55:49 +0000 (10:55 +0100)]
[X86] Fold BITOP(PACKSS(X,Z),PACKSS(Y,W)) --> PACKSS(BITOP(X,Y),BITOP(Z,W)) (REAPPLIED)

Fold allsignbits pack patterns to make better use of cheap (and commutable) logic ops

Reapplied after a32d14fd4c0a / 156913cb7764 with bitcast fix

16 months ago[X86] Add base SSE2 i686 test coverage to vector bitlogic reduction tests
Simon Pilgrim [Thu, 6 Jul 2023 09:45:41 +0000 (10:45 +0100)]
[X86] Add base SSE2 i686 test coverage to vector bitlogic reduction tests

16 months ago[X86] Add base SSE2 i686 test coverage to vector bool reduction tests
Simon Pilgrim [Thu, 6 Jul 2023 09:37:24 +0000 (10:37 +0100)]
[X86] Add base SSE2 i686 test coverage to vector bool reduction tests

16 months ago[mlir][linalg][transform] Fix TileOp builder
Matthias Springer [Thu, 6 Jul 2023 09:31:33 +0000 (11:31 +0200)]
[mlir][linalg][transform] Fix TileOp builder

The TileOp builders did not set `scalable_sizes`, which produces invalid ops. `scalable_sizes` must contain as any booleans as there are sizes.

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

16 months ago[include-cleaner] Add an IgnoreHeaders flag to the command-line tool.
Haojian Wu [Thu, 6 Jul 2023 08:56:08 +0000 (10:56 +0200)]
[include-cleaner] Add an IgnoreHeaders flag to the command-line tool.

Reviewed By: kadircet

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

16 months ago[clang-format] Fix align consecutive declarations over function pointers
Gedare Bloom [Thu, 6 Jul 2023 09:13:22 +0000 (02:13 -0700)]
[clang-format] Fix align consecutive declarations over function pointers

Fixes a bug that prevents alignment from proceeding through a function
pointer in a list of declarations.

Fixes #63451.

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

16 months ago[docs] Remove incorrect markup in a code block
Dmitri Gribenko [Wed, 5 Jul 2023 11:08:46 +0000 (13:08 +0200)]
[docs] Remove incorrect markup in a code block

16 months ago[clang-format] Fix RAS reference alignment when PAS is left or middle
Gedare Bloom [Thu, 6 Jul 2023 08:36:31 +0000 (01:36 -0700)]
[clang-format] Fix RAS reference alignment when PAS is left or middle

Fixes a bug with the handling of right aligned references with left/middle
alignment pointers.

Fixes #63452.

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

16 months ago[lldb] Fix crash when completing register names after program exit
David Spickett [Tue, 4 Jul 2023 08:10:59 +0000 (08:10 +0000)]
[lldb] Fix crash when completing register names after program exit

Previously the following would crash:
(lldb) run
Process 2594053 launched: '/tmp/test.o' (aarch64)
Process 2594053 exited with status = 0 (0x00000000)
(lldb) register read <tab>

As the completer assumed that the execution context would always
have a register context. After a program has finished, it does not.

Split out the generic parts of the test from the x86 specific tests,
and added "register info" to both.

Reviewed By: JDevlieghere

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

16 months ago[RISCV] Use 'long' in aes64 Zknd/Zkne builtin tests. NFC
Craig Topper [Thu, 6 Jul 2023 08:14:02 +0000 (01:14 -0700)]
[RISCV] Use 'long' in aes64 Zknd/Zkne builtin tests. NFC

This matches the data type of the intrinsics. This case be seen
from the removal of sext and trunc instructions from the IR.

Reviewed By: kito-cheng

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

16 months ago[RISCV] Add trunc instruction to the __builtin_riscv_ctz_64/__builtin_riscv_clz_64 IR.
Craig Topper [Thu, 6 Jul 2023 07:55:16 +0000 (00:55 -0700)]
[RISCV] Add trunc instruction to the __builtin_riscv_ctz_64/__builtin_riscv_clz_64 IR.

These builtins were recently changed to return 'int' like the
similar __builtin_clz/__builtin_ctz builtins, but the IR generation
was not updated to use a truncate.

16 months ago[JITLink][RISCV] Move relax to PostAllocationPasses
Job Noorman [Thu, 6 Jul 2023 07:28:13 +0000 (09:28 +0200)]
[JITLink][RISCV] Move relax to PostAllocationPasses

`JITLinkContext` is notified (using `notifyResolved`) of the final
symbol addresses after allocating memory and running the post-allocation
passes. However, linker relaxation, which can cause symbol addresses to
change, was run during the pre-fixup passes. This causes users of
JITLink (e.g., ORC) to pick-up wrong symbol addresses when linker
relaxation was enabled.

This patch fixes this by running relaxation during the post-allocation
passes.

Fixes #63671

Reviewed By: lhames

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

16 months ago[mlir][linalg] Vectorize 0-d tensor extract
Andrzej Warzynski [Wed, 5 Jul 2023 15:45:43 +0000 (16:45 +0100)]
[mlir][linalg] Vectorize 0-d tensor extract

This patch adds the missing logic to vectorise `tensor.extract` for 0-d
tensors.

Fixes #63688

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

16 months ago[RISCV] Use 'int' for return type for clz_64/clo_64 tests in riscv64-xtheadbb.c. NFC
Craig Topper [Thu, 6 Jul 2023 07:20:43 +0000 (00:20 -0700)]
[RISCV] Use 'int' for return type for clz_64/clo_64 tests in riscv64-xtheadbb.c. NFC

This matches the definition for the underlying builtins and what
is done in the Zbb test.

16 months ago[AIX] make integrated-as as default on AIX.
esmeyi [Thu, 6 Jul 2023 07:16:10 +0000 (03:16 -0400)]
[AIX] make integrated-as as default on AIX.

Summary: Clang uses LLVM's integrated assembler by default on most targets, however non-integrated-as mode is default on AIX. Currently integrated-as mode on AIX has passed tests of LLVM test-suite, bootstrap and Spec2017, therefore this patch sets integrated-as as the default assembler mode on AIX.

Reviewed By: DiggerLin

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

16 months ago[ModRef] Use enum class for IRMemLocation (NFC)
Nikita Popov [Thu, 6 Jul 2023 06:56:03 +0000 (08:56 +0200)]
[ModRef] Use enum class for IRMemLocation (NFC)

As reported at https://reviews.llvm.org/D153305#4475840.

16 months ago[AIX][clang][tests] XFail PCH/late-parsed-instantiations.cpp
Serge Pavlov [Thu, 6 Jul 2023 05:27:28 +0000 (12:27 +0700)]
[AIX][clang][tests] XFail PCH/late-parsed-instantiations.cpp

The issue: https://github.com/llvm/llvm-project/issues/63704

16 months ago[InstCombine] Transform (A > 0) | (A < 0) -> zext (A != 0) fold
XChy [Thu, 6 Jul 2023 05:44:56 +0000 (00:44 -0500)]
[InstCombine] Transform (A > 0) | (A < 0) -> zext (A != 0) fold

[InstCombine] Transform (A > 0) | (A < 0) -> zext (A != 0) fold

This extends **foldCastedBitwiseLogic** to handle the similar cases.

Actually, for `(A > B) | (A < B)`, when B != 0, it can be optimized to `zext( A != B )` by **foldAndOrOfICmpsUsingRanges**.
However, when B = 0, **transformZExtICmp** will transform `zext(A < 0) to i32` into `A << 31`,
which cannot be optimized by **foldAndOrOfICmpsUsingRanges**.

Because I'm new to LLVM and has no concise knowledge about how LLVM decides the order of optimization,
I choose to extend **foldCastedBitwiseLogic** to fold `( A << (X - 1) ) | ((A > 0) zext to iX) -> (A != 0) zext to iX`.

And the equivalent fold follows:
```
 A << (X - 1) ) | ((A > 0) zext to iX
  -> A < 0 | A > 0
  -> (A != 0) zext to iX
```

It's proved by [[https://alive2.llvm.org/ce/z/33HzjE|alive-tv]]

Related issue:
[[https://github.com/llvm/llvm-project/issues/62586  | (a > b) | (a < b) is not simplified only for the case b=0 ]]

Reviewed By: goldstein.w.n

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

16 months ago[InstCombine] Add tests for (A > 0) | (A < 0) -> zext (A != 0) fold (NFC)
XChy [Thu, 6 Jul 2023 05:44:56 +0000 (00:44 -0500)]
[InstCombine] Add tests for (A > 0) | (A < 0) -> zext (A != 0) fold (NFC)

Tests for an upcoming  (A > 0) | (A < 0) -> zext (A != 0) fold.
Related issue:
[[ https://github.com/llvm/llvm-project/issues/62586 | (a > b) | (a < b) is not simplified only for the case b=0 ]]

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

16 months ago[clang][dataflow] Bug fix: `BuiltinFnToFnPtr` cast does not produce a pointer.
Martin Braenne [Wed, 5 Jul 2023 07:46:52 +0000 (07:46 +0000)]
[clang][dataflow] Bug fix: `BuiltinFnToFnPtr` cast does not produce a pointer.

See comments in the code for details.

Reviewed By: xazax.hun

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

16 months ago[AMDGPU] Fix register class for a subreg in GCNRewritePartialRegUses.
Valery Pykhtin [Fri, 9 Jun 2023 11:40:37 +0000 (13:40 +0200)]
[AMDGPU] Fix register class for a subreg in GCNRewritePartialRegUses.

1. Improved code that deduces register class from instruction definitions. Previously if some instruction didn't contain a reg class for an operand it was considered as no information on register class even if other instructions specified the class.

2. Added check on required size of resulting register because in some cases classes with smaller registers had been selected (for example VReg_1).

Reviewed By: arsenm, #amdgpu

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

16 months ago[LibCallsShrinkWrap] Set IsFPConstrained is true for creating quiet floating comparis...
Jim Lin [Thu, 6 Jul 2023 02:15:22 +0000 (10:15 +0800)]
[LibCallsShrinkWrap] Set IsFPConstrained is true for creating quiet floating comparision if function has strictfp attribute

Create a quiet floating-point comparision if function has strictfp attribute.
Avoid unexpected FP exception raised during libcall domain error checking.
It raises an FP exception only in case where an input is a signaling NaN.

Reviewed By: efriedma

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

16 months ago[XRay][test] Remove unneeded REQUIRES: x86_64-target-arch
Fangrui Song [Thu, 6 Jul 2023 04:34:02 +0000 (21:34 -0700)]
[XRay][test] Remove unneeded REQUIRES: x86_64-target-arch

fdr-thread-order.cpp can be very slow when the thread contention is large.
Enable it for AArch64 and x86-64 for now.

fdr-mode.cpp fails on a ppc64le machine. Unsupport it on ppc64le for now.

The remaining modified tests pass on AArch64, ppc64le, and x86-64.

16 months ago[LTO] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D123803
Fangrui Song [Thu, 6 Jul 2023 04:08:30 +0000 (21:08 -0700)]
[LTO] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D123803

16 months ago[XRay][AArch64] Implement __xray_ArgLoggerEntry
Fangrui Song [Thu, 6 Jul 2023 03:56:00 +0000 (20:56 -0700)]
[XRay][AArch64] Implement __xray_ArgLoggerEntry

16 months ago[RISCV][NFC] Use common prefix to simlify test.
Jianjian GUAN [Wed, 5 Jul 2023 09:10:48 +0000 (17:10 +0800)]
[RISCV][NFC] Use common prefix to simlify test.

Reviewed By: craig.topper

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

16 months agoGetClangResourceDir: Fix downstream projects that bundle llvm source
Tom Stellard [Thu, 6 Jul 2023 03:09:58 +0000 (20:09 -0700)]
GetClangResourceDir: Fix downstream projects that bundle llvm source

A project that bundles the llvm source code may have their own
PACKAGE_VERSION variable, so only use this to compute the
CLANG_RESOURCE_DIR if CLANG_VERSION_MAJOR is undefined.

Reviewed By: sebastian-ne

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

16 months ago[profile] Enable loongarch64
zhanglimin [Thu, 6 Jul 2023 02:50:32 +0000 (10:50 +0800)]
[profile] Enable loongarch64

Mark loongarch64 as supported for profile. All tests passed.

Reviewed By: MaskRay

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

16 months ago[XRay][test] Replace some XFAIL with more appropriate REQUIRES
Fangrui Song [Thu, 6 Jul 2023 03:06:37 +0000 (20:06 -0700)]
[XRay][test] Replace some XFAIL with more appropriate REQUIRES

16 months agoAMDGPU: Remove add_dependencies calls from CMakeLists.txt
Tom Stellard [Thu, 6 Jul 2023 00:02:34 +0000 (17:02 -0700)]
AMDGPU: Remove add_dependencies calls from CMakeLists.txt

These are redundant.  The same dependencies are being added as part
of the add_llvm_component_library() call.  I confirmed this by diff'ing
the build.ninja files before and after the change and saw no change.

Reviewed By: arsenm

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

16 months ago[mlir][shape] Remove overzealous Dim verifier
Jacques Pienaar [Thu, 6 Jul 2023 03:01:32 +0000 (20:01 -0700)]
[mlir][shape] Remove overzealous Dim verifier

Follow up of D143999 and follow
https://mlir.llvm.org/getting_started/DeveloperGuide/#ir-verifier.

Fixes #60808.

16 months ago[RISCV] Add DAG combine for (fmv_w_x_rv64 (fmv_x_anyextw_rv64 X))
Craig Topper [Thu, 6 Jul 2023 02:35:13 +0000 (19:35 -0700)]
[RISCV] Add DAG combine for (fmv_w_x_rv64 (fmv_x_anyextw_rv64 X))

This pattern started showing up more after D151284

16 months ago[RISCV][NFC] Simplify uses of PatFrag binop_oneuse
Ben Shi [Tue, 4 Jul 2023 11:29:21 +0000 (19:29 +0800)]
[RISCV][NFC] Simplify uses of PatFrag binop_oneuse

Reviewed By: craig.topper

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

16 months agoAdd SymbolRefAttr to python bindings
max [Wed, 5 Jul 2023 20:02:59 +0000 (15:02 -0500)]
Add SymbolRefAttr to python bindings

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

16 months agoDAG: Implement soften float for ffrexp
Matt Arsenault [Wed, 5 Jul 2023 12:31:28 +0000 (08:31 -0400)]
DAG: Implement soften float for ffrexp

Fixes #63661

https://reviews.llvm.org/D154555

16 months ago[ODRHash] Stop hashing `ObjCMethodDecl::isPropertyAccessor` as it doesn't capture...
Volodymyr Sapsai [Sat, 1 Jul 2023 02:45:23 +0000 (19:45 -0700)]
[ODRHash] Stop hashing `ObjCMethodDecl::isPropertyAccessor` as it doesn't capture inherent method quality.

`isPropertyAccessor` depends on the surrounding code and not on the method
itself. That's why it can be different in different modules. And
mismatches shouldn't be an error.

rdar://109481753

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

16 months ago[ODRHash] Stop hashing `ObjCMethodDecl::isOverriding` as it doesn't capture inherent...
Volodymyr Sapsai [Wed, 21 Jun 2023 22:47:00 +0000 (15:47 -0700)]
[ODRHash] Stop hashing `ObjCMethodDecl::isOverriding` as it doesn't capture inherent method quality.

`isOverriding` depends on the surrounding code and not on the method
itself. That's why it can be different in different modules. And
mismatches shouldn't be an error.

rdar://109481753

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

16 months ago[RISCV][TableGen] Remove f32 from XLenFVT for RV32.
Craig Topper [Thu, 6 Jul 2023 00:17:22 +0000 (17:17 -0700)]
[RISCV][TableGen] Remove f32 from XLenFVT for RV32.

We don't expect this to be used on RV32 currently so remove it
to reduce number of entries in the isel table.

Teach RegisterInfoEmitter.cpp to allow a type to be missing for
a particular HwMode.

16 months agoRevert "[PowerPC] Remove extend between shift and and"
Nemanja Ivanovic [Thu, 6 Jul 2023 00:04:49 +0000 (20:04 -0400)]
Revert "[PowerPC] Remove extend between shift and and"

This reverts commit a57236de4eb8f38b4201647b10146941cbbb5c0b.
Causes a bootstrap failure on ppc64be.

16 months ago[Sanitizers][Darwin][Test] Mark symbolize_pc test unsupported in Darwin/LSan context
Mariusz Borsa [Mon, 3 Jul 2023 20:44:45 +0000 (13:44 -0700)]
[Sanitizers][Darwin][Test] Mark symbolize_pc test unsupported in Darwin/LSan context

LSan is unsupported on Darwin anyway, and this test fals on public Darwin bots

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

16 months ago[libc] Support fopen / fclose on the GPU
Joseph Huber [Wed, 5 Jul 2023 15:10:07 +0000 (10:10 -0500)]
[libc] Support fopen / fclose on the GPU

This patch adds the necessary support for the fopen and fclose functions
to work on the GPU via RPC. I added a new test that enables testing this
with the minimal features we have on the GPU. I will update it once we
have `fread` and `fwrite` to actually check the outputted strings. For
now I just relied on checking manually via the outpuot temp file.

Reviewed By: JonChesterfield, sivachandra

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

16 months ago[libc] Add GPU support for the 'inttypes.h' functions
Joseph Huber [Wed, 5 Jul 2023 19:18:27 +0000 (14:18 -0500)]
[libc] Add GPU support for the 'inttypes.h' functions

Another low hanging fruit we can put on the GPU, this ports the tests
over to the hermetic framework so we can run them on the GPU.

Reviewed By: sivachandra

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

16 months ago[OpenMP] Delete old plugins
Joseph Huber [Tue, 21 Mar 2023 16:27:37 +0000 (11:27 -0500)]
[OpenMP] Delete old plugins

It's time to remove the old plugins as the next-gen has already been set
to default in LLVM 16.

Reviewed By: tianshilei1992

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

16 months ago[Libomptarget] Remove the remote and ve plugins from libomptarget
Joseph Huber [Wed, 5 Jul 2023 21:45:18 +0000 (16:45 -0500)]
[Libomptarget] Remove the remote and ve plugins from libomptarget

These plugins are unmaintained and are not in a workable state. The VE
plugin has not been touched for years and has never had any running
tests. The remote plugin is in an unfinished state and is not production
ready upstream. These will need to be ported to the new nextgen
interface in the future if they are needed.

Reviewed By: jdoerfert

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

16 months ago[ELF] Remove one unneeded unquote from D124266
Fangrui Song [Wed, 5 Jul 2023 22:08:53 +0000 (15:08 -0700)]
[ELF] Remove one unneeded unquote from D124266

This one is unneeded after commit d60ef9338deb734541ff1c9d0771807815d5d9e6 (2023-02-03).

16 months ago[lld/elf] support quote usage in section names
Roger Pau Monne [Wed, 5 Jul 2023 21:56:15 +0000 (14:56 -0700)]
[lld/elf] support quote usage in section names

Section names used in ELF linker scripts can be quoted, but such
quotes must not be propagated to the binary ELF section names.  As
such strip the quotes from the section names when processing them, and
also strip them from linker script functions that take section names
as parameters.

Reviewed By: MaskRay

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

16 months ago[llvm] A Unified LTO Bitcode Frontend
Matthew Voss [Wed, 5 Jul 2023 21:17:20 +0000 (14:17 -0700)]
[llvm] A Unified LTO Bitcode Frontend

Here's a high level summary of the changes in this patch. For more
information on rational, see the RFC.
(https://discourse.llvm.org/t/rfc-a-unified-lto-bitcode-frontend/61774).

  - Add config parameter to LTO backend, specifying which LTO mode is
    desired when using unified LTO.
  - Add unified LTO flag to the summary index for efficiency. Unified
    LTO modules can be detected without parsing the module.
  - Make sure that the ModuleID is generated by incorporating more types
    of symbols.

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

16 months agoRevert "[X86] Fold BITOP(PACKSS(X,Z),PACKSS(Y,W)) --> PACKSS(BITOP(X,Y),BITOP(Z,W))"
Arthur Eubanks [Wed, 5 Jul 2023 21:48:53 +0000 (14:48 -0700)]
Revert "[X86] Fold BITOP(PACKSS(X,Z),PACKSS(Y,W)) --> PACKSS(BITOP(X,Y),BITOP(Z,W))"

This reverts commit a32d14fd4c0a43c154f251df1ccfe57e8b0a711a.

Causes crashes, see https://reviews.llvm.org/rGa32d14fd4c0a43c154f251df1ccfe57e8b0a711a.

16 months ago[libc++][ranges] Implement the changes to `basic_string` from P1206 (`ranges::to`):
varconst [Sat, 1 Jul 2023 00:04:33 +0000 (17:04 -0700)]
[libc++][ranges] Implement the changes to `basic_string` from P1206 (`ranges::to`):

- add the `from_range_t` constructors and the related deduction guides;
- add the `insert_range`/`assign_range`/etc. member functions.

(Note: this patch is split from https://reviews.llvm.org/D142335)

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

16 months ago[libc++][NFC] Remove leftover entry for <experimental/span> in header_information.py
Louis Dionne [Wed, 5 Jul 2023 21:47:55 +0000 (17:47 -0400)]
[libc++][NFC] Remove leftover entry for <experimental/span> in header_information.py

16 months ago[libc++] Mark LWG2994 as complete and remove Clang from the version
Nikolas Klauser [Wed, 5 Jul 2023 21:42:50 +0000 (14:42 -0700)]
[libc++] Mark LWG2994 as complete and remove Clang from the version

Reviewed By: #libc, ldionne

Spies: ldionne, libcxx-commits

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

16 months ago[libc++] add basic runtime assertions to <latch>
Edoardo Sanguineti [Wed, 5 Jul 2023 21:33:18 +0000 (17:33 -0400)]
[libc++] add basic runtime assertions to <latch>

Adding assertions will aid users that have bugs in their code to
receive better error messages.

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

16 months agoDAG: Fix dropping flags when widening unary vector ops
Matt Arsenault [Thu, 15 Jun 2023 00:06:06 +0000 (20:06 -0400)]
DAG: Fix dropping flags when widening unary vector ops

16 months agoAMDGPU: Correctly lower llvm.exp.f32
Matt Arsenault [Wed, 14 Jun 2023 14:53:56 +0000 (10:53 -0400)]
AMDGPU: Correctly lower llvm.exp.f32

The library expansion has too many paths for all the permutations of
DAZ, unsafe and the 3 exp functions. It's easier to expand it in the
backend when we know all of these things. The library currently misses
the no-infinity check on the overflow, which this handles optimizing
out.

Some of the <3 x half> fast tests regress due to vector widening
dropping flags which will be fixed separately.

Apparently there is no exp10 intrinsic, but there should be. Adds some
deadish code in preparation for adding one while I'm following along
with the current library expansion.

16 months agoAMDGPU: Correctly lower llvm.exp2.f32
Matt Arsenault [Wed, 14 Jun 2023 12:56:49 +0000 (08:56 -0400)]
AMDGPU: Correctly lower llvm.exp2.f32

Previously this did a fast math expansion only.

16 months ago[libc][Obvious] Fix timing on AMDGPU not being initialized
Joseph Huber [Wed, 5 Jul 2023 21:07:21 +0000 (16:07 -0500)]
[libc][Obvious] Fix timing on AMDGPU not being initialized

Summary:
Reviewer requested that this routine not be a macro, however that means
that it was not being intitialized as the static initializer was done
before the memcpy from the device. Fix this so we can get timing
information.

16 months agoDon't pass -ibuiltininc, which is used only by the driver, to CC1
Akira Hatanaka [Wed, 5 Jul 2023 21:02:59 +0000 (14:02 -0700)]
Don't pass -ibuiltininc, which is used only by the driver, to CC1

This fixes a fallout from 5b77e752dcd073846b89559d6c0e1a7699e58615.

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

16 months agoWeaken MFI Max Call Frame Size Assertion
Oskar Wirga [Wed, 5 Jul 2023 21:00:45 +0000 (14:00 -0700)]
Weaken MFI Max Call Frame Size Assertion

A year ago when I was not invested at all into compilers, I found an assertion error when building an AArch64 debug build with LTO + CFI, among other combinations.

It was posted as a github issue here: https://github.com/llvm/llvm-project/issues/54088

I took it upon myself to revisit the issue now that I have spent some more time working on LLVM.

Reviewed By: MatzeB

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

16 months agoRevert "[MLIR][Linalg] Add more arith named ops to linalg"
Renato Golin [Wed, 5 Jul 2023 21:02:23 +0000 (22:02 +0100)]
Revert "[MLIR][Linalg] Add more arith named ops to linalg"

This reverts commit eda47fdd258ca666815122a931b82699a0629b87.

It failed on NVidia, AMD and Windows bots. Investigating.

16 months ago[libc][Obvious] Fix bad macro check on NVPTX tests
Joseph Huber [Wed, 5 Jul 2023 20:53:28 +0000 (15:53 -0500)]
[libc][Obvious] Fix bad macro check on NVPTX tests

Summary:
I forgot to add the `defined()` check on NVPTX.

16 months agoAMDGPU: Always use v_rcp_f16 and v_rsq_f16
Matt Arsenault [Sat, 1 Jul 2023 02:27:31 +0000 (22:27 -0400)]
AMDGPU: Always use v_rcp_f16 and v_rsq_f16

These inherited the fast math checks from f32, but the manual suggests
these should be accurate enough for unconditional use. The definition
of correctly rounded is 0.5ulp, but the manual says "0.51ulp". I've
been a bit nervous about changing this as the OpenCL conformance test
does not cover half. Brute force produces identical values compared to
a reference host implementation for all values.

16 months agoAMDGPU: Add more tests for f16 fdiv lowering
Matt Arsenault [Sat, 1 Jul 2023 11:23:14 +0000 (07:23 -0400)]
AMDGPU: Add more tests for f16 fdiv lowering

Probably should merge the DAG and gisel tests.

16 months ago[NFC][clang] add extra member-alignment testcase
David Tenty [Wed, 5 Jul 2023 18:00:12 +0000 (14:00 -0400)]
[NFC][clang] add extra member-alignment testcase

for when an alignment attribute is used. This will be useful for D147184 to demonstrate what changes.

16 months ago[PowerPC] Remove extend between shift and and
Nemanja Ivanovic [Wed, 5 Jul 2023 20:32:49 +0000 (16:32 -0400)]
[PowerPC] Remove extend between shift and and

The SDAG will sometimes insert an extend between
the shift and an and (immediate) even though the
immediate is narrower than the narrow size.
This does not allow us to produce a rotate
instruction (such as rlwinm).
This patch just adds a combine to move the extend
onto the and.

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

16 months ago[scudo] Extract steps releaseToOSMaybe into functions in
Chia-hung Duan [Wed, 5 Jul 2023 20:31:29 +0000 (20:31 +0000)]
[scudo] Extract steps releaseToOSMaybe into functions in

This refactor helps us identify which steps need FLLock so that we can
reduce the holding time of FLLock in SizeClassAllocator64.

Also move the data members to the end of class to align the style in
SizeClassAllocator32.

Reviewed By: cferris

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

16 months ago[scudo] SCUDO_FUCHSIA uses ReservedMemoryDefault
Caslyn Tonelli [Wed, 5 Jul 2023 18:49:21 +0000 (18:49 +0000)]
[scudo] SCUDO_FUCHSIA uses ReservedMemoryDefault

Some Fuchsia zx tests failed from https://reviews.llvm.org/D153888:
https://turquoise-internal-review.git.corp.google.com/c/integration/+/729619

Use `ReservedMemoryDefault` for `SCUDO_FUCHSIA` to use the default
MemMap API, while test failures are debugged.

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

16 months ago[NFC] Autogenerate CodeGen/SystemZ/int-{uadd,sub}-0*.ll
Amaury Séchet [Wed, 5 Jul 2023 20:13:11 +0000 (20:13 +0000)]
[NFC] Autogenerate CodeGen/SystemZ/int-{uadd,sub}-0*.ll

16 months ago[RISCV] Remove legacy TA/TU pseudo distinction for load instructions
Philip Reames [Wed, 5 Jul 2023 19:25:25 +0000 (12:25 -0700)]
[RISCV] Remove legacy TA/TU pseudo distinction for load instructions

This change continues with the line of work discussed in https://discourse.llvm.org/t/riscv-transition-in-vector-pseudo-structure-policy-variants/71295.

This change targets all the pseudos used in loads (unit, strided, segmented, fault first, and their combinations). As with previous changes in the series, we replace the existing TA and TU forms with a single unified pseudo with a passthru (which may be implicit_def) and a policy operand.

One quirk is that I went ahead and treated the unmasked mask load instruction (vlm) the same way. We need the pass thru operand to model tail undefined, but since the instruction is unconditionally agnostic and the instruction has no mask, the policy operand is arguably unneeded. I kept it mostly for consistency sake.

Another quirk worth highlighting is that segment loads require a bit of dedicated handling. Surprisingly, we don't have IMPLICIT_DEF nodes of the right types, and attempting to use them results in some odd looking codegen and a few crashes. Instead, I left the REG_SEQUENCE form, and extended InsertVSETVLI to recognize the complex undefs. Arguably, we should probably revisit the handling of undef reg_sequence nodes here, but I'm hoping to side step that in this patch.

As before, we see codegen changes (some improvements and some regressions) due to scheduling differences caused by the extra implicit_def instructions. I did have to delete one register allocation regression test as I couldn't figure out how to meaningfully update it. I spent a significant amount of time trying, and finally gave up.

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

16 months agoRemove unused test file
Aaron Ballman [Wed, 5 Jul 2023 19:54:13 +0000 (15:54 -0400)]
Remove unused test file

pth.h hasn't been used since we removed support for PTH in
0a6b5b653ee47234674614fecc213c1d73bb1e28

16 months ago[mlir][Linalg] Relax restriction of Linalg passes on FuncOp
Nicolas Vasilache [Wed, 5 Jul 2023 11:49:18 +0000 (11:49 +0000)]
[mlir][Linalg] Relax restriction of Linalg passes on FuncOp

Existing Linalg passes are still anchoring on FuncOp.
Relax this unnecessary limitation.

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

16 months agoRevert "Change the dyld notification function that lldb puts a breakpoint in"
Jason Molenda [Wed, 5 Jul 2023 19:52:21 +0000 (12:52 -0700)]
Revert "Change the dyld notification function that lldb puts a breakpoint in"

We're seeing a lot of test failures on the lldb incremental x86 CI bot
since I landed https://reviews.llvm.org/D139453 - revert it while I
investigate.

This reverts commit 624813a4f41c5945dc8f8d998173960ad75db731.

16 months ago[llvm-mca][RISCV] Fix typo in test for vsetvli instruction
Michael Maitland [Wed, 5 Jul 2023 17:10:51 +0000 (10:10 -0700)]
[llvm-mca][RISCV] Fix typo in test for vsetvli instruction

The instrument comment specified a different LMUL than the vsetvli
above it. This patch syncs the LMUL comment and the vsetvli.

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

16 months agoAMDGPU: Correctly lower llvm.log.f32 and llvm.log10.f32
Matt Arsenault [Sun, 11 Jun 2023 21:00:15 +0000 (17:00 -0400)]
AMDGPU: Correctly lower llvm.log.f32 and llvm.log10.f32

Previously we expanded these in a fast-math way and the device
libraries were relying on this behavior. The libraries have a pending
change to switch to the new target intrinsic.

Unlike the library version, this takes advantage of no-infinities on
the result overflow check.

16 months ago[libc] Support timing information in libc tests
Joseph Huber [Tue, 4 Jul 2023 14:25:25 +0000 (09:25 -0500)]
[libc] Support timing information in libc tests

This patch adds the necessary support to provide timing information in
`libc` tests. This is useful for determining which tests look what
amount of time. We also can use this as a test basis for providing more
fine-grained timing when implementing things on the GPU.

The main difficulty with this is the fact that the AMDGPU fixed
frequency clock operates at an unknown frequency. We need to read this
on a per-card basis from the driver and then copy it in. NVPTX on the
other hand has a fixed clock at a resolution of 1ns. I have also
increased the resolution of the print-outs as the majority of these are
below a millisecond for me.

Reviewed By: JonChesterfield

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

16 months agoFix aggregate CTAD with string literals adding extra const
Mital Ashok [Mon, 3 Jul 2023 03:27:15 +0000 (20:27 -0700)]
Fix aggregate CTAD with string literals adding extra const

Missing a `withConst`, so when deducing from a string literal, a `const` is erroneously added to the deduced type.

Reviewed By: ychen

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

16 months ago[LV] Update generateInstruction to return produced value (NFC).
Florian Hahn [Wed, 5 Jul 2023 18:15:55 +0000 (19:15 +0100)]
[LV] Update generateInstruction to return produced value (NFC).

Update generateInstruction to return the produced value instead of
setting it for each opcode. This reduces the amount of duplicated code
and is a preparation for D153696.

Reviewed By: Ayal

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

16 months ago[RISCV] Fix interleave/deinterleave store test output
Luke Lau [Wed, 5 Jul 2023 18:51:52 +0000 (19:51 +0100)]
[RISCV] Fix interleave/deinterleave store test output

Looks like the output changed after rebasing

16 months ago[flang][hlfir] Lower actual TARGET for dummy POINTER.
Slava Zakharin [Wed, 5 Jul 2023 17:57:57 +0000 (10:57 -0700)]
[flang][hlfir] Lower actual TARGET for dummy POINTER.

This patch implements HLFIR lowering for associating an actual
TARGET argument to a dummy POINTER argument.

Reviewed By: tblah, jeanPerier

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

16 months ago[MLIR][Linalg] Add more arith named ops to linalg
Renato Golin [Wed, 5 Jul 2023 16:13:42 +0000 (17:13 +0100)]
[MLIR][Linalg] Add more arith named ops to linalg

Following up the 'add' named op, here are the remaining basic arithmetic
and maths, including a 'div_unsigned' for integer unsigned values. In the
same pattern as 'matmul_unsigned', the simply named 'div' assumes signed
values and the '_unsigned' variation handles the unsigned values.

It's a bit odd, but there doesn't seem to be a easy way to restrict to
specific types to make 'div_unsigned' only work with integers in the
structured ops framework.

Same as 'add', these have strict semantics regarding casts.

Unary math ops will need some massaging, so I split these ones for now
as I continue working on them.

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

16 months ago[lldb] Fix incorrect uses of formatv specifiers in LLDB_LOG
Jonas Devlieghere [Wed, 5 Jul 2023 18:26:25 +0000 (11:26 -0700)]
[lldb] Fix incorrect uses of formatv specifiers in LLDB_LOG

Fix incorrect uses of formatv specifiers in LLDB_LOG. Unlike Python,
arguments must be numbered. All the affected log statements take
llvm:Errors so use the LLDB_LOG_ERROR macro instead.

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

16 months ago[lldb] Fix incorrect uses of LLDB_LOG_ERROR
Jonas Devlieghere [Wed, 5 Jul 2023 17:47:14 +0000 (10:47 -0700)]
[lldb] Fix incorrect uses of LLDB_LOG_ERROR

Fix incorrect uses of LLDB_LOG_ERROR. The macro doesn't automatically
inject the error in the log message: it merely passes the error as the
first argument to formatv and therefore must be referenced with {0}.

Thanks to Nicholas Allegra for collecting a list of places where the
macro was misused.

rdar://111581655

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

16 months ago[clang-repl] Improve the clang-repl documentation.
Krishna-13-cyber [Wed, 5 Jul 2023 18:24:30 +0000 (18:24 +0000)]
[clang-repl] Improve the clang-repl documentation.

We add usage, build instructions and examples illustrating how clang-repl works.

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

16 months ago[RISCV] Lower deinterleave2 intrinsics to vlseg2
Luke Lau [Tue, 27 Jun 2023 14:00:10 +0000 (15:00 +0100)]
[RISCV] Lower deinterleave2 intrinsics to vlseg2

Following from D153864, this patch implements the lowerDeinterleaveIntrinsic
hook to lower deinterleaves of loads into vlseg2 intrinsics.

Reviewed By: craig.topper

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

16 months ago[RISCV] Add tests for vector.deinterleave2s of loads
Luke Lau [Tue, 27 Jun 2023 13:45:28 +0000 (14:45 +0100)]
[RISCV] Add tests for vector.deinterleave2s of loads

Reviewed By: reames

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

16 months ago[RISCV] Lower interleave2 intrinsics to vsseg2
Luke Lau [Tue, 27 Jun 2023 12:41:46 +0000 (13:41 +0100)]
[RISCV] Lower interleave2 intrinsics to vsseg2

This patch teaches the RISCV TargetLowering class to lower interleave
intrinsics to vsseg2, so it can lower interleaved stores for scalable vectors.
Previously, we could only lower stores of interleaves for fixed length vectors
with vector shuffles.

This uses the lowerInterleaveIntrinsic interface for the interleaved
access pass that was added in D146218, and subsumes the DAG combine
approach taken in D144175

Reviewed By: reames

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

16 months ago[RISCV] Add tests for stores of vector.interleave2
Luke Lau [Tue, 27 Jun 2023 10:22:36 +0000 (11:22 +0100)]
[RISCV] Add tests for stores of vector.interleave2

Reviewed By: craig.topper

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

16 months ago[libc] fix MPFR rounding problems in fuzz test
Michael Jones [Thu, 29 Jun 2023 20:53:57 +0000 (13:53 -0700)]
[libc] fix MPFR rounding problems in fuzz test

The accuracy for the MPFR numbers in the strtofloat fuzz test was set
too high, causing rounding issues when rounding to a smaller final
result.

Reviewed By: lntue

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

16 months ago[libc] Use the new style includes
Petr Hosek [Wed, 5 Jul 2023 17:42:39 +0000 (17:42 +0000)]
[libc] Use the new style includes

We should be using the standard includes.

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