Commit Graph

481862 Commits

Author SHA1 Message Date
Joseph Huber
4b7beab418 [OpenMP] Add back implicit flags manually
Summary:
We used to inherit these flags from the LLVM options in a runtimes
build. This patch adds them back in manually as they are helpful for
diagnostics and optimizing the created binary.
2023-11-27 14:51:48 -06:00
Johannes Reifferscheid
3d87b9d5f0 [Bazel] Fix for 7eccd52842 2023-11-27 21:43:35 +01:00
Kirill Stoimenov
4e0c48b907 Revert "[libc++] Speed up classic locale (#72112)"
Looks like it broke the ASAN build: https://lab.llvm.org/buildbot/#/builders/168/builds/17053/steps/9/logs/stdio

This reverts commit f8afc53d64.
2023-11-27 20:21:58 +00:00
Aiden Grossman
983a2757b0
[AArch64] Update comment on GHC CC (#72761)
Currently, there are a couple dead links in the comment surrounding the
tablegen implementtion of the GHC calling convention in AArch64. There
was some refactoring in GHC that moved things around. This patch fixes
up the comment to match the current state of the repository to make it
easier for future readers to reference the relevant documentation.
2023-11-27 12:15:47 -08:00
Joseph Huber
ee922e6ebf [llvm] Disable HandleLLVMOptions in runtimes mode (#73031)
Summary:
There are a few default options that LLVM adds that can be problematic
for runtimes builds. These options are generally intended to handle
building LLVM itself, but are also added when building in a runtimes
mode. One such issue I've run into is that in `libc` we deliberately use
`--target` to use a different device toolchain, which doesn't support
some linker arguments passed via `-Wl`. This is observed in
https://github.com/llvm/llvm-project/pull/73030 when attempting to use
these options.

This patch completely removes these default arguments.

The consensus is that any issues created by this patch should ultimately
be solved on a per-runtime basis.
2023-11-27 14:06:53 -06:00
Louis Dionne
2b7cca1ccf [libc++] Add missing REQUIRES for exception handling test
It otherwise fails on Windows.
2023-11-27 15:04:04 -05:00
Johannes Doerfert
7bfcce3e94
[OpenMP] Tear down GenericDeviceTy's with GenericPluginTy (#73557)
There is no point in keeping GenericDeviceTy objects alive longer than
the associated GenericPluginTy. Instead of the old API we now tear them
down with the plugin, avoiding ordering issues.
2023-11-27 11:42:12 -08:00
Duo Wang
e3f16de9a3
[unittest][Support] Fix bad negation of signed integer in LEB128Test.SLEB128Size (#72700)
I came across an undefined behavior when running Support unit tests with
UBSAN on Windows.
```bash
[ RUN      ] LEB128Test.SLEB128Size
C:\llvm\unittests\Support\LEB128Test.cpp:382:3: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long'; cast to an unsigned type to negate this value to itself
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\llvm\unittests\Support\LEB128Test.cpp:382:3 in 
```

UBSAN did not report the same error on macOS, but the negation still
seemed invalid (`0x8000000000000000LL == -0x8000000000000000LL`
evaluated to `true`).
I can confirm that `-0x7fffffffffffffffLL - 1` results in the expected
value on both platforms.
2023-11-27 11:13:27 -08:00
David Li
c2ba2b2190
Fix ISel crash when lowering BUILD_VECTOR (#73186)
512bit vpbroadcastw is available only with AVX512BW. Avoid lowering
BUILD_VEC into vbroard_cast node when the condition is not met. This
fixed a crash (see the added new test).
2023-11-27 11:09:46 -08:00
Johannes Doerfert
f9436464a9 [OpenMP][NFC] Minor name and code simplification 2023-11-27 11:08:29 -08:00
Johannes Doerfert
2b2e711afc [OpenMP][NFC] Remove no-op __tgt_rtl_deinit_plugin
The order in which we deinit things, especially when shared libraries
are involved, is complicated. To simplify our lives the nextgen plugin
deinitializes the GenericPluginTy and subclasses automatically. The old
__tgt_rtl_deinit_plugin is not needed anymore.
2023-11-27 11:07:57 -08:00
Johannes Doerfert
9c33bf62a7 [OpenMP][NFC] Remove unused (un)register_lib plugin API
These APIs have not been hooked up for a while. No need to carry them.
2023-11-27 11:07:57 -08:00
Amir Ayupov
ab14eb23b6
[BOLT][test] Replace /dev/null with temp file (#73485)
NFC processing time script identifies tests by output filename.
When `/dev/null` is used as output filename, we're unable to tell the
source test, and the reports are unhelpful.
Replace `/dev/null/` with `%t.null` which resolves the issue.
2023-11-27 10:53:18 -08:00
Max191
b29332a318
[mlir] Add narrow type emulation for memref.reinterpret_cast (#73144) 2023-11-27 10:41:14 -08:00
Bjorn Pettersson
30afb21547 Revert "[MCP] Enhance MCP copy Instruction removal for special case (#70778)"
This reverts commit cae46f6210.

Reverted due to miscompiles.
See https://github.com/llvm/llvm-project/issues/73512
2023-11-27 19:39:40 +01:00
Craig Topper
5f31dbd18d
[RISCV] Add register bank and instruction selection support for FP G_SELECT. (#72726)
Try to pick the FP register bank based on surrounding use/defs. Code is
basically copied from AArch64.

Need legalizer changes to make this more useful. Right now we're stuck
with only being able to FP select types less than or equal to XLen.
2023-11-27 10:38:25 -08:00
Kazu Hirata
90b3e6711e [RISCV] Fix a warning
This patch fixes:

  llvm/lib/Target/RISCV/RISCVFoldMasks.cpp:151:14: error: unused
  variable 'HasPolicyOp' [-Werror,-Wunused-variable]
2023-11-27 10:32:00 -08:00
Brad Smith
e66876f2e0
[OpenMP][Tools] Have sort(1) not use long name parameters (#73477)
I noticed a few tests were failing on NetBSD. NetBSD's sort(1) does not
support long name parameters unlike GNU and FreeBSD/OpenBSD/DragonFly's
sort(1).

executed command: sort --numeric-sort --stable

 .---command stderr------------
 | sort: unknown option -- -
 | usage: sort [-bdfHilmnrSsu] [-k kstart[,kend]] [-o output] [-R char] [-T dir]
 |              [-t char] [file ...]
 |    or: sort -C|-c [-bdfilnru] [-k kstart[,kend]] [-o output] [-R char]
 |              [-t char] [file]
 `-----------------------------
2023-11-27 13:23:25 -05:00
Brad Smith
20406af31b
[runtime] Have the runtime use the compiler builtin for alloca on NetBSD (#73480)
Most of the tests were failing with the following in their logs..

| /usr/bin/ld: /home/brad/llvm-build/runtimes/runtimes-bins/openmp/runtime/src/libomp.so:
warning: Warning: reference to the libc supplied alloca(3); this most likely will not
work. Please use the compiler provided version of alloca(3), by supplying the appropriate
compiler flags (e.g. -std=gnu99).

By making use of __builtin_alloca..

before:

Total Discovered Tests: 353
  Unsupported:  59 (16.71%)
  Passed     :  51 (14.45%)
  Failed     : 243 (68.84%)

after:

Total Discovered Tests: 353
  Unsupported:  59 (16.71%)
  Passed     : 290 (82.15%)
  Failed     :   4 (1.13%)
2023-11-27 13:22:54 -05:00
Craig Topper
4a2db23e6c
[RISCV][GISel] Use setDesc in some cases instead of creating new instructions. (#72769)
Slight memory usage improvement by reusing.
2023-11-27 10:20:10 -08:00
Lang Hames
56c72c7f33 [ORC] Add a public unsafe-operations helper for SymbolStringPtr.
SymbolStringPoolEntryUnsafe provides unsafe access to SymbolStringPtr objects,
allowing clients to manually retain and release pool entries, or consume or
create SymbolStringPtr instances without affecting an entry's ref-count. This
can be useful when writing C APIs that need to handle SymbolStringPtrs.

As part of this patch the LLVM-C API implementation is updated to use the new
utility, rather than the old, private OrcV2CAPIHelper utility.
2023-11-27 09:48:56 -08:00
Lang Hames
7138fabfbc [ORC-RT] Add SPS serialization for std::tuple.
This will be used in upcoming changes to macho_platform.
2023-11-27 09:48:56 -08:00
Quinn Dawkins
6e8f7d5966
[mlir][vector] Fix patterns for dropping leading unit dims from masks (#73525)
Previously the pattern only worked when the permutation map was a minor
identity. Infer the new mask type from the new transfer map after
dropping leading unit dims.
2023-11-27 12:35:32 -05:00
Jakub Kuderski
1bdb2e8550
[mlir][spirv] Simplify gpu reduction to spirv logic (#73546)
Check the type only once and then specialize op handlers based on it.

Do not use boolean types in group arithmetic ops that expect integers.
2023-11-27 12:33:41 -05:00
Dimitrij Mijoski
390840fbdf
[libc++] Fix UTF-8 decoding in codecvts (#68442)
This patch fixes one case where the decoding member function `in()` was
returning `partial` instead of `error`. Additionally, it adds large
testsuite that tests all `codecvt` facets that were added in C++11 and
in C++20. The testsuite covers this bug.

Fixes #60177.
2023-11-27 18:31:03 +01:00
Farzon Lotfi
d79aee9f73
Changes to support running tests for Windows arm64 asan (#66973)
1. Differentiate SANITIZER_WINDOWS64 for x64 and arm64
2. turn off interception tests that expect x86 assembly

---------

Co-authored-by: Farzon Lotfi <farzon@farzon.com>
2023-11-27 12:28:44 -05:00
Jason Liu
623cd75105
[llvm-objdump] Fix lma display issue for non-bss sections (#72141)
llvm-readobj and llvm-objdump have inconsistent handling of display
lma for sections.
This patch tries to common code up and adapt the same approach for
both tools.
2023-11-27 12:24:39 -05:00
Joseph Huber
9a376530b3 Revert "[llvm] Disable HandleLLVMOptions in runtimes mode (#73031)"
This reverts commit 79b03306af.

I am seeing very confusing errors with the `libomptarget` test suite
when using dlopen / other flags. Reverting to investigate why this is.
2023-11-27 11:16:50 -06:00
Craig Topper
fe3c421843
[RISCV][GISel] Merge selectGlobalValue and selectJumpTable. NFC (#72759)
We can use addDisp in place of addGlobalAddress/addJumpTableIndex to
copy the existing MachineOperand from the generic instruction.
2023-11-27 09:10:23 -08:00
Craig Topper
811234ee95
[RISCV] Add Zbs Write classes to SiFive7AnyToGPRBypass. (#72560) 2023-11-27 09:06:37 -08:00
Dmitri Gribenko
b9b627fbc3 [clang] Fix a new test to not write temp files to the git repository 2023-11-27 18:04:49 +01:00
Youngsuk Kim
d8b8aa3a56 [llvm] Replace calls to Type::getPointerTo (NFC)
Cleanup work towards removing the method Type::getPointerTo.

If a call to Type::getPointerTo is used solely to support an unneeded
pointer-cast, remove the call entirely.
2023-11-27 10:49:34 -06:00
Jakub Kuderski
7eccd52842 Reland "[mlir][gpu] Align reduction operations with vector combining kinds (#73423)"
This reverts commit dd09221a29 and relands
https://github.com/llvm/llvm-project/pull/73423.

* Updated `gpu.all_reduce` `min`/`max` in CUDA integration tests.
2023-11-27 11:38:18 -05:00
Nikita Popov
c644486740 [ValueTracking] Pass unpacked arguments to computeKnownBitsFromCmp() (NFC)
This will alllow using it with an inverted predicate in the future.
2023-11-27 17:35:53 +01:00
Philip Reames
129440728c
[RISCV] Partially move doPeepholeMaskedRVV into RISCVFoldMasks (#72441)
This change is motived by a point of confusion on
https://github.com/llvm/llvm-project/pull/71764. I hadn't fully
understood why doPeepholeMaskedRVV needed to be part of the same change.
As indicated in the fixme in this patch, the reason is that
performCombineVMergeAndVOps doesn't know how to deal with the true side
of the merge being a all-ones masked instruction.

This change removes one of two calls to the routine in
RISCVISELDAGToDAG, and adds a clarifying comment on the precondition for
the remaining call. The post-ISEL code is tested by the cases where we
can form a unmasked instruction after folding the vmerge back into true.

I don't really care if we actually land this patch, or leave it roled
into https://github.com/llvm/llvm-project/pull/71764. I'm posting it
mostly to clarify the confusion.
2023-11-27 08:33:03 -08:00
Jakub Kuderski
dd09221a29 Revert "[mlir][gpu] Align reduction operations with vector combining kinds (#73423)"
This reverts commit e0aac8c88d.

I'm seeing some nvidia integration test failures:
https://lab.llvm.org/buildbot/#/builders/61/builds/52334.
2023-11-27 11:29:23 -05:00
Fangrui Song
dd3184c30f [unittest,examples] Replace uses of IRBuilder::getInt8PtrTy with getPtrTy. NFC 2023-11-27 08:29:13 -08:00
David Green
3c23ed156f [AArch64] Add a test to show scheduling aliasing between SVE loads and stores. NFC 2023-11-27 16:22:46 +00:00
Jakub Kuderski
e0aac8c88d
[mlir][gpu] Align reduction operations with vector combining kinds (#73423)
The motivation for this change is explained in
https://github.com/llvm/llvm-project/issues/72354.

Before this change, we could not tell between signed/unsigned
minimum/maximum and NaN treatment for floating point values.

The mapping of old reduction operations to the new ones is as follows:
*  `min` --> `minsi` for ints, `minf` for floats
*  `max` --> `maxsi` for ints, `maxf` for floats

New reduction kinds not represented in the old enum: `minui`, `maxui`,
`minimumf`, `maximumf`.

As a next step, I would like to have a common definition of combining
kinds used by the `vector` and `gpu` dialects. Separately, the GPU to
SPIR-V lowering does not yet properly handle zero and NaN values -- the
behavior of floating point min/max group reductions is not specified by
the SPIR-V spec, see https://github.com/llvm/llvm-project/issues/73459. 

Issue: https://github.com/llvm/llvm-project/issues/72354
2023-11-27 11:19:20 -05:00
Jakub Kuderski
6b9c186b2d
[mlir][spirv] Handle non-innerprod float vector add reductions (#73476)
Instead of extracting all individual vector components and performing a
scalar summation, use `spirv.Dot` with the original reduction operand
and a vector constant of all ones.
2023-11-27 11:10:25 -05:00
Guillaume Chatelet
c599b8eec0
[libc][NFC] Decouple FP properties from C++ types (#73517)
We simplify the floating point properties by splitting concerns:
 - We define all distinct floating point formats in the `FPType` enum.
 - We map them to properties via the `FPProperties` trait.
- We map from C++ type to `FPType` in the `getFPType` function so logic
is easier to understand and extend.
2023-11-27 17:05:49 +01:00
Kiran Chandramohan
63a6e51f8a
[Flang][OpenMP] Fix issue with empty critical or critical without surrounding context (#71944)
Add the sourcerange for critical directive.

Fixes #65571
2023-11-27 15:56:39 +00:00
Louis Dionne
12bb2910c3
[libc++] Remove experimental pmr headers now shipped in mainline (#73172)
Several experimental headers around std::pmr have been slated for
removal for a while now. This patch actually performs the removal and
cleanups from the code base.
2023-11-27 10:54:35 -05:00
Nikita Popov
28a5e6b069
[InstCombine] Remove over-generalization from computeKnownBitsFromCmp() (#72637)
For most practical purposes, the only KnownBits patterns we care about are
those involving a constant comparison RHS and constant mask. However,
the actual implementation is written in a very general way -- and of
course, with basically no test coverage of those generalizations.

This patch reduces the implementation to only handle cases with constant
operands. The test changes are all in "make sure we don't crash" tests.

The motivation for this change is an upcoming patch to handling dominating
conditions in computeKnownBits(). Handling non-constant RHS would add
significant additional compile-time overhead in that case, without any
significant impact on optimization quality.
2023-11-27 16:50:05 +01:00
Louis Dionne
936180a5e8 [libc++][NFC] Fix typo in comment 2023-11-27 10:35:07 -05:00
Fangrui Song
c449460d8a
ms inline asm: Fix {call,jmp} fptr (#73207)
https://reviews.llvm.org/D151863 (2023-05) removed
`BaseReg = BaseReg ? BaseReg : 1` (introduced in commit
175d0aeef3 (2013)) and caused a
regression: ensuring a non-zero `BaseReg` was to treat
`static void (*fptr)(); __asm { call fptr }` as non-`AbsMem`
`AsmOperandClass` and generate `call $0`/`callq *fptr(%rip)` instead of
`call ${0:P}`/`callq *fptr`
(The asm template argument modifier `P` is for call targets, while
no modifier is used by other instructions like `mov rax, fptr`)

This patch reinstates the BaseReg-setting statement but places it inside
`if (IsGlobalLV)` for clarify.

The special case is unfortunate, but we also have special case in
similar places (https://reviews.llvm.org/D149920).

Fix: #73033
2023-11-27 07:27:50 -08:00
Stephan T. Lavavej
bf95a0cd20
[libc++][test] Avoid C++23 Core features that MSVC lacks (#73438)
Found while running libc++'s test suite with MSVC's STL, where we use
both Clang and MSVC's compiler.

libc++'s test suite has started using some C++23 Core Language features
that MSVC hasn't implemented yet. When avoiding these features costs
just a tiny bit of syntax, I would like to ask libc++ to consider making
that change in the interest of practical portability, at least until
MSVC catches up. If there's no desire to do so, then I could skip the
affected tests, but that would make me a slightly sad kitty.
2023-11-27 10:24:22 -05:00
Joseph Huber
ca007181ea [OpenMP] Fix missing CMake function in runtimes build
Summary:
We borrowed this function from LLVM, my previous patch removed that. Now
we redefine it if it's not present.
2023-11-27 09:23:15 -06:00
Guillaume Chatelet
fb23fabc19
[libc] Fix forward octal prefix (#73526)
To fix failing build bots after :
https://github.com/llvm/llvm-project/pull/73372

```
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/macros/properties/float.h:40:71: error: invalid digit '9' in octal constant
#if (defined(LIBC_COMPILER_CLANG_VER) && (LIBC_COMPILER_CLANG_VER >= 0900)) || \
```
2023-11-27 16:21:20 +01:00
Utkarsh Saxena
c94444390f
[clangtidy] Allow safe suspensions in coroutine-hostile-raii check (#72954)
Certain `awaitable` types could be safe to `co_await` on even when we
have suspension-hostile RAII objects in scope.
This PR adds a way for users to mark such safe `awaitable` and silence
false positive warnings in `co_await` expressions involving such an
`awaitable`.

`co_await`-ing an expression of `awaitable` type is considered safe if
the type is part of `SafeAwaiatablesList` check option. RAII objects
persisting across such a `co_await` expression are
considered safe and hence are not flagged.
2023-11-27 16:21:07 +01:00