520721 Commits

Author SHA1 Message Date
Fangrui Song
712264b83c [ELF] Merge parseSymbolVersion and computeIspreemptible
ICF needs isPreemptible, which can be combined with parseSymbolVersion.
2024-12-08 17:50:17 -08:00
Fangrui Song
18538e2134 Revert "[ELF] Optimize parseSymbolVersion"
This reverts commit 2b129dacdde667137b5012d52f1d96e0ab26c749.

parseSymbolVersion can be combined with computeIsPreemptible,
making hasVersionSyms unneeded.
2024-12-08 17:50:16 -08:00
LLVM GN Syncbot
a00eab6a48 [gn build] Port 74e8a37ff32e 2024-12-09 01:43:56 +00:00
Lang Hames
74e8a37ff3 Revert "Reapply "[ORC] Introduce LazyReexportsManager, … (#118923)" with fixes"
This reverts commit 41652c6c92958a87b8505b9b1e6f008856e392ac while I investigate
more bot failures.
2024-12-09 12:38:59 +11:00
c8ef
f145ff3f70
[clang] constexpr built-in elementwise add_sat/sub_sat functions. (#119082)
Part of #51787.

This patch adds constexpr support for the built-in elementwise add_sat
and sub_sat functions.
2024-12-09 09:28:12 +08:00
Schrodinger ZHU Yifan
f91a5fee53
[libc] fix woa64 fenv implementation (#119155)
Changing name type to match x86-64. This resolves definition conflicts
with `core_crt` headers.

fix #119154
2024-12-08 20:24:57 -05:00
LLVM GN Syncbot
8569b47063 [gn build] Port 41652c6c9295 2024-12-09 01:08:45 +00:00
Lang Hames
41652c6c92 Reapply "[ORC] Introduce LazyReexportsManager, … (#118923)" with fixes
This reapplies 570ecdcf8b4, which was reverted in 6073dd923b8 due to bot
failures.

The test failures on Linux were fixed by:
1. Removing an overly restrictive assertion (query dependence on a symbol no
longer implies a MaterializingInfo for that symbol)
2. Adding reentry and resolver files to the ORC runtime CMakeLists.txt for
Linux.
3. Adding the __orc_rt_reentry -> __orc_rt_sysv_reentry alias to ELFNixPlatform.
2024-12-09 12:08:07 +11:00
Kinoshita Kotaro
a1197a2ca8
[AArch64] Add initial support for FUJITSU-MONAKA (#118432)
This patch adds initial support for FUJITSU-MONAKA CPU (-mcpu=fujitsu-monaka).

The scheduling model will be corrected in the future.
2024-12-09 09:56:02 +09:00
Fangrui Song
fe0d0a9e62 [ELF] Merge numSymbols and numELFSyms 2024-12-08 15:59:03 -08:00
David Green
1dfa34c8e1 [AArch64] Extended Dup test coverage. NFC 2024-12-08 22:36:48 +00:00
Florian Hahn
eff0d8103c
[VPlan] Adjust original position of convertToConcreteRecipes.
Restore the original position of the call before afef545efab77a8
to fix a number of crashes.
2024-12-08 21:52:51 +00:00
Benjamin Maxwell
c4aa67e866
Revert "[InstSimplify] Add basic constant folding for llvm.sincos" (#119149)
Reverts llvm/llvm-project#114527

Reverting due to buildbot failures (e.g.
https://lab.llvm.org/buildbot/#/builders/180/builds/9685)
2024-12-08 21:29:30 +00:00
Andreas Jonson
855bc46bc8
[InstCombine] Fold trunc nuw/nsw X to i1 -> true IFF X != 0 (#119131)
proof https://alive2.llvm.org/ce/z/prpPex
2024-12-08 22:28:16 +01:00
Florian Hahn
afef545efa
[VPlan] Address post-commit for #114305.
Apply suggested renaming and adjust placement as suggested in
https://github.com/llvm/llvm-project/pull/114305. Also drop unneeded
RPOT creation.
2024-12-08 21:24:19 +00:00
Benjamin Maxwell
47df46b1e7
[InstSimplify] Add basic constant folding for llvm.sincos (#114527)
This calls into the existing constant folding for `llvm.sin` and
`llvm.cos`, which currently does not fold for any non-finite values, so
most tests are negative tests at the moment.

Note: The constant folding does not consider the `afn` fast-math flag
and will produce the same result regardless of if the flag is set.
2024-12-08 21:16:50 +00:00
Andreas Jonson
bd07e87082 [NFC] Pre commit test for fold trunc nsw X to i1 -> true IFF X != 0 2024-12-08 22:04:52 +01:00
Fangrui Song
2b129dacdd [ELF] Optimize parseSymbolVersion
We can just scan objectFiles and sharedFiles that have versioned symbols
to skip scanning the global symtab. While we won't suggest __wrap_foo
for undefined __wrap_foo@v1 when --wrap=foo@v1 is specified
(internalFile isn't scanned), this edge case difference is acceptable.
2024-12-08 12:32:55 -08:00
Kazu Hirata
b6dfdd2b1e
[memprof] Drop memprof:: in unit tests (NFC) (#119113)
This patch replaces memprof::Foo with Foo if we have corresponding:

  using llvm::memprof::Foo;
2024-12-08 11:34:29 -08:00
SpencerAbson
b0f06769e6
[AArch64] Implement intrinsics for SME FP8 F1CVT/F2CVT and BF1CVT/BF2CVT (#118027)
This patch implements the following intrinsics:

8-bit floating-point convert to half-precision or BFloat16 (in-order).
``` c
  // Variant is also available for: _bf16[_mf8]_x2
  svfloat16x2_t svcvt1_f16[_mf8]_x2_fpm(svmfloat8_t zn, fpm_t fpm) __arm_streaming;
  svfloat16x2_t svcvt2_f16[_mf8]_x2_fpm(svmfloat8_t zn, fpm_t fpm) __arm_streaming;
```

In accordance with https://github.com/ARM-software/acle/pull/323.

Co-authored-by: Marin Lukac marian.lukac@arm.com
Co-authored-by: Caroline Concatto caroline.concatto@arm.com
2024-12-08 19:34:01 +00:00
David CARLIER
2ab687e205
[compiler-rt][rtsan] fdopen/freopen(64) support. (#119100) 2024-12-08 19:24:18 +00:00
Austin Kerbow
b1d42465fc
[AMDGPU] Fix hidden kernarg preload count inconsistency (#116759)
It is possible that the number of hidden arguments that are selected to
be preloaded in AMDGPULowerKernel arguments and isel can differ. This
isn't an issue with explicit arguments since isel can lower the argument
correctly either way, but with hidden arguments we may have alignment
issues if we try to load these hidden arguments that were added to the
kernel signature.

The reason for the mismatch is that isel reserves an extra synthetic
user SGPR for module LDS.

Instead of teaching lowerFormalArguments how to handle these properly it
makes more sense and is less expensive to fix the mismatch and assert if
we ever run into this issue again. We should never be trying to lower
these in the normal way.

In a future change we probably want to revise how we track "synthetic"
user SGPRs and unify the handling in GCNUserSGPRUsageInfo. Sometimes
synthetic SGPRSs are considered user SGPRs and sometimes they are not.
Until then this patch resolves the inconsistency, fixes the bug, and is
otherwise a NFC.
2024-12-08 10:10:08 -08:00
Timm Baeder
1fbbf4c418
[clang][bytecode] Pass (float) BitWidth to DoBitCast (#119119)
In certain cases (i.e. long double on x86), the bit with we get from the
floating point semantics is different than the type size we compute for
the BitCast instruction. Pass this along to DoBitCast, so in there we
can check only the relevant bits for being initialized.

This also fixes a weirdness we still had in DoBitCast.
2024-12-08 18:54:08 +01:00
Chris Apple
8843d2b469
[rtsan] Add verify_interceptors flag to docs (#119074) 2024-12-08 09:34:40 -08:00
Fangrui Song
c650880958 [ELF] Simplify handling of exportDynamic and canBeOmittedFromSymbolTable
When computing whether a defined symbol is exported, we set
`exportDynamic` in Defined and CommonSymbol's ctor and merge the bit in
symbol resolution. The complexity is for the LTO special case
canBeOmittedFromSymbolTable, which can be simplified by introducing a
new bit.

We might simplify the state by caching includeInDynsym in exportDynamic
in the future.
2024-12-08 09:33:48 -08:00
Fangrui Song
aedc81b9d8 [ELF] Remove unneeded sym->inDynamicList check
Follow-up to d31fb264821ceac90b55c87c3f777053ab30a9af
2024-12-08 09:17:38 -08:00
Kazu Hirata
6c062afc2e
[memprof] Compare Frames instead of FrameIds in a unit test (#119111)
When we call IndexedMemProfRecord::toMemProfRecord, we care about
getting the original (that is, non-indexed) MemProfRecord back, so we
should just verify that, not the hash values, which are
intermediaries.

There is a remote possibility of hash collisions where call stack
{F1, F2} might come back as {F1, F1} if F1.hash() == F2.hash() for
example.  However, since FrameId uses BLAKE, the hash values should be
consistent across architectures.  That is, if this test case works on
one architecture, it should work on others as well.
2024-12-08 08:33:05 -08:00
Thorsten Schütt
fc2cc018ec
[GlobalISel] list undocumented opcodes in docs (#119089) 2024-12-08 16:35:33 +01:00
NimishMishra
9eb4056144
[mlir][llvm] Translation support for task detach (#116601)
This PR adds translation support for task detach. Essentially, if the
`detach` clause is present on a task, emit a
`__kmpc_task_allow_completion_event` on it, and store its return (of
type `kmp_event_t*`) into the `event_handle`.
2024-12-08 06:09:52 -08:00
Andreas Jonson
25dcee4042 [NFC] Pre commit test for fold trunc nuw X to i1 -> true IFF X != 0 2024-12-08 15:02:51 +01:00
Jon Chesterfield
4e0ba801ea Revert "[amdgpu][lds] Simplify error diag path - lds variable names are no longer special"
Test case didn't run locally, investigating

This reverts commit 7bad469182ff2f6423ea209d5a1e81acca600568.
2024-12-08 12:00:13 +00:00
Jon Chesterfield
7bad469182 [amdgpu][lds] Simplify error diag path - lds variable names are no longer special 2024-12-08 11:26:33 +00:00
Owen Pan
eeadd0128d [clang-format] Also check ClangFormat.rst is up to date in docs_updated.test 2024-12-08 01:15:45 -08:00
Fangrui Song
d31fb26482 [ELF] Simplify includeInDynsym for --dynamic-list 2024-12-07 22:57:25 -08:00
Owen Pan
6b1c357acc [clang-format] Add cmake target clang-format-help to update ClangFormat.rst 2024-12-07 22:41:50 -08:00
Yingwei Zheng
f4f6566e44
[InstCombine] Fix type mismatch in foldICmpBinOpEqualityWithConstant (#119068)
Closes https://github.com/llvm/llvm-project/issues/119063.
2024-12-08 13:21:34 +08:00
Vitaly Buka
118f7b95c8
[sancov] Regenerate test (#119115)
For #119097.
2024-12-07 21:12:22 -08:00
Vitaly Buka
6dec33834d
[sanitizer] Fix few size types in memprof (#119114)
Fix type in a few related Min() calls.

Follow up to #116957.

Co-authored-by: Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
2024-12-07 21:02:22 -08:00
Fangrui Song
8669028c18 [ELF] Remove unneeded sym->file check
After #78944 and some follow-ups, sym->file, unless in the initial
Placeholder stage, is guaranteed to be non-null.
2024-12-07 20:46:02 -08:00
Stefan Schulze Frielinghaus
ce44640fe2
[sanitizer] Add type __sanitizer::ssize (#116957)
Since the sanitizer merge in commit r15-5164-gfa321004f3f628 of GCC
which entails LLVM commit 61a6439f35b6de28ff4aff4450d6fca970292fd5, GCCs
bootstrap is broken on s390 -m31. This is due to commit
ec68dc1ca4d967b599f1202855917d5ec9cae52f which introduces stricter type
checking which is why GCC bootstrap fails with

```
In file included from /gcc/src/libsanitizer/interception/interception.h:18,
                 from /gcc/src/libsanitizer/interception/interception_type_test.cpp:14:
/gcc/src/libsanitizer/interception/interception_type_test.cpp:30:61: error: static assertion failed
   30 | COMPILER_CHECK((__sanitizer::is_same<::SSIZE_T, ::ssize_t>::value));
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/gcc/src/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:363:44: note: in definition of macro 'COMPILER_CHECK'
  363 | #define COMPILER_CHECK(pred) static_assert(pred, "")
      |                                            ^~~~
make[8]: *** [Makefile:469: interception_type_test.lo] Error 1
```

The culprit seems to be that we don't check for equality of type sizes
anymore but rather whether the types are indeed the same. On s390 -m31
we have that `sizeof(int)==sizeof(long)` holds which is why previously
the checks succeeded. They fail now because

```
size_t      => unsigned long
ssize_t     => long
ptrdiff_t   => int
::SSIZE_T   => __sanitizer::sptr => int
::PTRDIFF_T => __sanitizer::sptr => int
```

This is fixed by mapping `SSIZE_T` to `long` in the end.

```
#if defined(__s390__) && !defined(__s390x__)
typedef long ssize;
#else
typedef sptr ssize;
#endif

#define SSIZE_T __sanitizer::ssize
```
2024-12-07 20:41:53 -08:00
Fangrui Song
ae5fdaea43 [ELF] Simplify printLocation
sym.file is always non-null (since around #78944).
2024-12-07 20:31:50 -08:00
Kazu Hirata
684e79f254
[memprof] Add YAML read/write support to llvm-profdata (#118915)
This patch adds YAML read/write support to llvm-profdata.  The primary
intent is to accommodate MemProf profiles in test cases, thereby
avoiding the binary format.

The read support is via llvm-profdata merge.  This is useful when we
want to verify that the compiler does the right thing on a given .ll
file and a MemProf profile in a test case.  In the test case, we would
convert the MemProf profile in YAML to an indexed profile and invoke
the compiler on the .ll file along with the indexed profile.

The write support is via llvm-profdata show --memory.  This is useful
when we wish to convert an indexed MemProf profile to YAML while
writing tests.  We would compile a test case in C++, run it for an
indexed MemProf profile, and then convert it to the text format.
2024-12-07 20:22:05 -08:00
Stefan Schulze Frielinghaus
9a156f6b2b [sanitizer] Replace uptr by usize/SIZE_T in interfaces
For some targets uptr is mapped to unsigned int and size_t to unsigned
long and sizeof(int)==sizeof(long) holds.  Still, these are distinct
types and type checking may fail.  Therefore, replace uptr by
usize/SIZE_T wherever a size_t is expected.

Part of #116957
2024-12-07 20:20:27 -08:00
Valentin Clement (バレンタイン クレメン)
16c2a1016e
Revert "[flang] Allow to pass an async id to allocate the descriptor (#118713)" (#119109)
This reverts commit 7d1c661381d36018fd105f4ad4c2d6dc45e7288b.

This commit breaks some device runtime builds. Need time to investigate.
2024-12-07 19:55:12 -08:00
Chandler Carruth
f0297ae552
Switch the intrinsic names to a string table (#118929)
This avoids the need to dynamically relocate each pointer in the table.

To make this work, this PR also moves the binary search of intrinsic
names to an internal function with an adjusted signature, and switches
the unittesting to test against actual intrinsics.
2024-12-07 17:53:59 -08:00
Nathan Ridge
70c1764d7a
[clang] [Sema] Preserve nested name specifier prefix in MemberPointerType (#118236)
Fixes https://github.com/llvm/llvm-project/issues/118198
Fixes https://github.com/clangd/clangd/issues/2235
2024-12-07 20:17:07 -05:00
Owen Pan
cb61a5e420
[clang-format] Fix an assertion failure in RemoveSemicolon (#117472)
Fixes #117290.
2024-12-07 16:47:35 -08:00
Fangrui Song
4153c2dc05 [ProfileData] Avoid deprecated is_pod 2024-12-07 16:22:14 -08:00
Vitaly Buka
7787328dd6
[ubsan] Improve lowering of @llvm.allow.ubsan.check (#119013)
This fix the case, when single hot inlined callsite, prevent
checks for all other. This helps to reduce number of removed checks up
to 50% (deppedes on `cutoff-hot` value) .

`ScalarOptimizerLateEPCallback` was happening during
CGSCC walk, after each inlining, but this is effectively
after inlining.

Example, order in comments:

```
static void overflow() {
  // 1. Inline get/set if possible
  // 2. Simplify
  // 3. LowerAllowCheckPass
  set(get() + get());
}

void test() {
  // 4. Inline
  // 5. Nothing for LowerAllowCheckPass
  overflow();
}
```

With this patch it will look like:
```
static void overflow() {
  // 1. Inline get/set if possible
  // 2. Simplify
  set(get() + get());
}

void test() {
  // 3. Inline
  // 4. Simplify
  overflow();
}

// Later, after inliner CGSCC walk complete:
// 5. LowerAllowCheckPass for `overflow`
// 6. LowerAllowCheckPass for `test`
```
2024-12-07 16:12:58 -08:00
Fangrui Song
639e1fa255 [IntervalMap] Fix -Wdeprecated-anon-enum-enum-conversion due to InstrProf.h 2024-12-07 15:48:15 -08:00