508615 Commits

Author SHA1 Message Date
Steven Wu
16f4e85860 Revert "[sanitizer] Remove GetCurrentThread nullness checks from Allocate"
This reverts commit 4411d1e3926d67c393e6a7bdb910bbe77507ff26 for
breaking Darwin bots:
  AddressSanitizer-Unit :: ./Asan-x86_64-calls-Noinst-Test/10/16
  AddressSanitizer-Unit :: ./Asan-x86_64-calls-Noinst-Test/12/16
  AddressSanitizer-Unit :: ./Asan-x86_64-calls-Noinst-Test/13/16
  AddressSanitizer-Unit :: ./Asan-x86_64-inline-Noinst-Test/10/16
  AddressSanitizer-Unit :: ./Asan-x86_64-inline-Noinst-Test/12/16
  AddressSanitizer-Unit :: ./Asan-x86_64-inline-Noinst-Test/13/16
  AddressSanitizer-Unit :: ./Asan-x86_64h-calls-Noinst-Test/10/16
  AddressSanitizer-Unit :: ./Asan-x86_64h-calls-Noinst-Test/12/16
  AddressSanitizer-Unit :: ./Asan-x86_64h-calls-Noinst-Test/13/16
  AddressSanitizer-Unit :: ./Asan-x86_64h-inline-Noinst-Test/10/16
  AddressSanitizer-Unit :: ./Asan-x86_64h-inline-Noinst-Test/12/16
  AddressSanitizer-Unit :: ./Asan-x86_64h-inline-Noinst-Test/13/16
2024-08-15 12:50:03 -07:00
Kirill Stoimenov
1d5c2ad4f1
Reapply "Fix prctl to handle PR_GET_PDEATHSIG. (#101749)" (#104469)
Reapply with a fix. The fix is changing the arg2 type from u64 to int. 

This reverts commit 046524e8fe425cbc86c3371f2bf29fbb39d98435.
2024-08-15 12:41:06 -07:00
Ziqing Luo
9aa3b53ac5
[-Wunsafe-buffer-usage] Fix a small bug recently found (#102953)
`QualType::isConstantArrayType()` checks canonical type. So a following
cast should be applied to canonical type as well:

```
if (Ty->isConstantArrayType())
  cast<ConstantArrayType>(Ty.getCanonicalType());  //  cast<ConstantArrayType>(Ty) is incorrect
```
2024-08-15 12:34:15 -07:00
Craig Topper
3dea42f3e5
[TargetLowering] Don't call SelectionDAG::getTargetLoweringInfo() from TargetLowering methods. NFC (#104197)
If we are inside a TargetLowering method,
`SelectionDAG::getTargetLoweringInfo()` should be the same as `this`.
2024-08-15 12:33:12 -07:00
Amy Kwan
9325381998
[PowerPC][GlobalMerge] Enable GlobalMerge by default on AIX (#101226)
This patch turns on the GlobalMerge pass by default on AIX and updates
LIT tests accordingly.
2024-08-15 15:25:54 -04:00
Sirraide
2b0a8fcf70
[Clang] Implement C++26’s P2893R3 ‘Variadic friends’ (#101448)
Implement P2893R3 ‘Variadic friends’ for C++26.

This closes #98587.

Co-authored-by: Younan Zhang <zyn7109@gmail.com>
2024-08-15 21:16:30 +02:00
Matt Arsenault
b5e63cc533
clang/AMDGPU: Emit atomicrmw for __builtin_amdgcn_global_atomic_fadd_{f32|f64} (#96872)
Need to emit syncscope and new metadata to get the native instruction,
most of the time.
2024-08-15 22:59:24 +04:00
Kazu Hirata
6bbbd30147 [llvm-objdump] Fix a warning
This patch fixes:

  llvm/tools/llvm-objdump/XCOFFDump.cpp:85:12: error: unused variable
  'BytesFormatted' [-Werror,-Wunused-variable]
2024-08-15 11:56:21 -07:00
Keith Smiley
8ffdc87656
[bazel] Port 47721d46187f89c12a13d07b5857496301cf5d6e (#104481)
Made more difficult by many header circular dependencies
2024-08-15 11:50:16 -07:00
Nikolas Klauser
85da39debd
[libc++] Remove the allocator<const T> extension (#102655)
In LLVM 19 removed the extension with an opt-in macro. This finally
removes that option too and removes a few `const_cast`s where I know
that they exist only to support this extension.
2024-08-15 20:45:49 +02:00
Oleksandr T.
6cbd96e24c
[Clang] handle both gnu and cpp11 attributes to ensure correct parsing inside extern block (#102864)
Fixes #101990
2024-08-15 14:42:39 -04:00
LLVM GN Syncbot
7ab2d504a1 [gn build] Port 47721d46187f 2024-08-15 18:26:52 +00:00
royitaqi
47721d4618
[lldb] Realpath symlinks for breakpoints (#102223)
Improve the chance of resolving file/line breakpoints by realpath'ing the support files before doing a second match attempt, with some conditions applied.

A working [hello-world example](https://github.com/royitaqi/lldb_demos/blob/main/realpath/README.md).

See [patch](https://github.com/llvm/llvm-project/pull/102223) for more info about problem/motivation, details of the feature, new settings, telemetries and tests.
2024-08-15 11:26:24 -07:00
Tim Northover
52337d5f9d
llvm-objdump: ensure a MachO symbol isn't STAB before looking up secion (#86667)
The section field has been repurposed for some STAB symbol types, and if
we blindly look it up we'll produce an error and terminate. Logic
already existed

Existing stabs test had a section that was in range. Unfortunately I
don't know of an easy way to produce stabs entries in LLVM (I thought
they died in the 90s until this came up) so I just binary-edited it to
cause a failure on existing llvm-objdump.
2024-08-15 11:19:30 -07:00
earnol
7493ea22f8
[test]Fix test error due to CRT dependency (#104462)
Remove CRT dependency in headers stdint.h, stdio.h inside test
clang/test/CodeGen/bit-int-ubsan.c

---------

Co-authored-by: Eänolituri Lómitaurë <vladislav.aranov@ericsson.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Co-authored-by: Paul Kirth <paulkirth@google.com>
2024-08-15 14:11:27 -04:00
Timm Baeder
75ea8e803a
[clang][Interp] Call move function for certain primitive types (#104437) 2024-08-15 19:59:55 +02:00
zhijian lin
29b0a251c1
[llvm-objdump] Print out xcoff file header for xcoff object file with option private-headers (#96350)
Print out the XCOFF file header and load section header for the XCOFF
object file using llvm-objdump with the --private-headers option.
2024-08-15 13:50:54 -04:00
Oleksandr T.
7332713b8e
[Clang] prevent null explicit object argument from being deduced (#104328)
Fixes #102025
2024-08-15 19:47:14 +02:00
Thurston Dang
e398da2b37 Revert "[Clang] Overflow Pattern Exclusions (#100272)"
This reverts commit 9a666deecb9ff6ca3a6b12e6c2877e19b74b54da.

Reason: broke buildbots

e.g., fork-ubsan.test started failing at
https://lab.llvm.org/buildbot/#/builders/66/builds/2819/steps/9/logs/stdio

  Clang :: CodeGen/compound-assign-overflow.c
  Clang :: CodeGen/sanitize-atomic-int-overflow.c
started failing with https://lab.llvm.org/buildbot/#/builders/52/builds/1570
2024-08-15 10:18:52 -07:00
Leandro Lupori
062e69a647
[flang][OpenMP] Fix 2 more regressions after #101009 (#101538)
PR #101009 exposed a semantic check issue with OPTIONAL dummy
arguments.
Another issue occurred when using %{re,im,len,kind}, as these also
need to be skipped when handling variables with implicitly defined
DSAs.

These issues were found by Fujitsu testsuite.
2024-08-15 14:14:18 -03:00
Volodymyr Vasylkun
d68d2172f9
[InstCombine] Fold ucmp/scmp(x, y) >> N to zext/sext(x < y) when N is one less than the width of the result of ucmp/scmp (#104009)
Proof: https://alive2.llvm.org/ce/z/4diUqN

---------

Co-authored-by: Nikita Popov <github@npopov.com>
2024-08-15 18:08:23 +01:00
Keith Smiley
dd3f1313ae
[bazel] Enable more lit self tests (#104285)
I assume the intent of the initial `*/*.py` was to also collect things
in `*.py`, but that's not what bazel does unless you use `**/*.py` which
is what we're doing now. A few of these tests fail so I explicitly
disabled them until someone has time to debug.
2024-08-15 09:59:29 -07:00
jeffreytan81
54154f9f06
Fix single thread stepping timeout race condition (#104195)
This PR fixes a potential race condition in
https://github.com/llvm/llvm-project/pull/90930.

This race can happen because the original code set `m_info->m_isAlive =
true` **after** the timer thread is created. So if there is a context
switch happens and timer thread checks `m_info->m_isAlive` before main
thread got a chance to run `m_info->m_isAlive = true`, the timer thread
may treat `ThreadPlanSingleThreadTimeout` as not alive and simply exit
resulting in async interrupt never being sent to resume all threads
(deadlock).

The PR fixes the race by initializing all states **before** worker timer
thread creates.

Co-authored-by: jeffreytan81 <jeffreytan@fb.com>
2024-08-15 09:57:01 -07:00
Koakuma
e61776a0ed
[SPARC][Utilities] Add names for SPARC ELF flags in LLVM binary utilities (#102843)
This allows us to use and print readable names in LLVM binary utilities.
2024-08-15 23:49:01 +07:00
Koakuma
6c270a8b9f
[SPARC][Driver] Add -m(no-)v8plus flags handling (#98713)
Implement handling for `-m(no-)v8plus` flags to allow the user to switch
between V8 and V8+ mode with 32-bit code.

Currently it only toggles the V8+ feature bit, ABI and codegen changes
will be done in future patches.
2024-08-15 23:46:09 +07:00
Hansang Bae
9e0ee0e104
[OpenMP] Add support for pause with omp_pause_stop_tool (#97100)
This patch adds support for pause resource with a new enumerator
omp_pause_stop_tool. The expected behavior of this enumerator is
* omp_pause_resource: not allowed
* omp_pause_resource_all: equivalent to omp_pause_hard
2024-08-15 11:44:50 -05:00
Alexey Bataev
b6bb208662 Revert "[SLP][NFC]Remove unused using declarations, reduce mem usage in containers, NFC"
This reverts commit 2d52eb6a434fe47e67086f5ec1c3789bf6e7a604 to fix
compile time regression found in https://llvm-compile-time-tracker.com/compare.php?from=fcefe957ddfdc5a2fe9463757b597635e3436e01&to=2d52eb6a434fe47e67086f5ec1c3789bf6e7a604&stat=instructions%3Au.
2024-08-15 09:19:01 -07:00
Nikita Popov
afa0f53f96 [ValueTracking] Fix f16 fptosi range for large integers
We were missing the signed flag on the negative value, so the
range was incorrectly interpreted for integers larger than 64-bit.

Split out from https://github.com/llvm/llvm-project/pull/80309.
2024-08-15 18:18:19 +02:00
Nikita Popov
46fb225f3a [InstSimplify] Add tests for f16 to i128 range (NFC) 2024-08-15 18:18:19 +02:00
Fangrui Song
64c856055a
Revert "[Object][x86-64] Add support for R_X86_64_GLOB_DAT relocations. (#103029)" (#103497)
This reverts commit 5ae9faa538d100ab38f6f4f99c924de0e4270272.

RelocationResolver is only supposed to handle static relocation types.
Introducing GLOB_DAT could negatively impact other RelocationResolver
users who solely handle static relocations and want to report errors for
dynamic relocations.

If GLOB_DAT is the sole required relocation, explicitly checking for it
in the caller would be more reliable. Additionally, the caller should
handle GLOB_DAT on other architectures.
2024-08-15 17:01:06 +01:00
sp
51328b78dc
[NFC] Fix spelling of "definitely". (#104455)
This corrects the misspelling of "definitely" as "definately". No
functional changes.
2024-08-15 18:00:03 +02:00
Kevin McAfee
e63b7ba0eb
[InstCombine][NFC] Add tests for shifts of constants by common factor (#103471) 2024-08-15 08:49:55 -07:00
Hansang Bae
5989709047
[OpenMP] Miscellaneous small code improvements (#95603)
Removes a few uninitialized variables, possible resource leaks, and
redundant code.
2024-08-15 10:42:22 -05:00
Daniel Grumberg
57abd4e4ab
[clang][ExtractAPI] Emit environment component of target triple in SGF (#103273)
rdar://133533830
2024-08-15 16:23:31 +01:00
Luke Lau
11c2da8fb7
[RISCV] Narrow indices to e16 for LMUL > 1 when lowering vector_reverse (#104427)
The vector_shuffle lowering already does this to reduce register
pressure, so also do it here.
2024-08-15 23:18:03 +08:00
Rahul Joshi
db8ef6188c
[NFC] Fix code line exceeding 80 columns (#104428) 2024-08-15 08:15:30 -07:00
Alexey Bataev
2d52eb6a43 [SLP][NFC]Remove unused using declarations, reduce mem usage in containers, NFC 2024-08-15 08:12:20 -07:00
Mital Ashok
c7df775440
[Clang] Check explicit object parameter for defaulted operators properly (#100419)
Previously, the type of explicit object parameters was not considered
for relational operators. This was defined by CWG2586,
<https://cplusplus.github.io/CWG/issues/2586.html>. This fix also means
CWG2547 <https://cplusplus.github.io/CWG/issues/2547.html> is now fully
implemented. Fixes #100329, fixes #104413.

Now start rejecting invalid rvalue reference parameters, which weren't
checked for, and start accepting non-reference explicit object
parameters (like `bool operator==(this C, C) = default;`) which were
previously rejected for the object param not being a reference.

Also start rejecting non-reference explicit object parameters for
defaulted copy/move assign operators (`A& operator=(this A, const A&) =
default;` is invalid but was previously accepted). Fixes #104414.
2024-08-15 19:12:11 +04:00
Jeffrey Byrnes
fcefe957dd
[LegalizeTypes][AMDGPU]: Allow for scalarization of insert_subvector (#104236)
Legalization for when the inserted subvector is to be scalarized.

https://godbolt.org/z/vx3joWqoh
2024-08-15 08:07:05 -07:00
Snehasish Kumar
95daf1aedf
Allow optimization of __size_returning_new variants. (#102258)
https://github.com/llvm/llvm-project/pull/101564 added support to TLI to
detect variants of operator new which provide feedback on the actual
size of memory allocated (http://wg21.link/P0901R5). This patch extends
SimplifyLibCalls to handle hot cold hinting of these variants.
2024-08-15 08:06:41 -07:00
Alexey Bataev
56140a8258 [SLP]Fix PR104422: Wrong value truncation
The minbitwidth restrictions can be skipped only for immediate reduced
values, for other nodes still need to check if external users allow
bitwidth reduction.

Fixes https://github.com/llvm/llvm-project/issues/104422
2024-08-15 08:00:08 -07:00
Tobias Stadler
13a6a79752
[GlobalISel] Combiner: Fix warning after #102163
Default case in covered switches is illegal.
https://llvm.org/docs/CodingStandards.html#don-t-use-default-labels-in-fully-covered-switches-over-enumerations

Pull Request: https://github.com/llvm/llvm-project/pull/104441
2024-08-15 16:27:18 +02:00
Alexey Bataev
65ac12d3c9 [SLP][NFC]Add a test with incorrect minbitwidth analysis for reduced operands 2024-08-15 07:26:44 -07:00
earnol
75cb7de404
[ubsan] Display correct runtime messages for negative _BitInt (#96240)
Without this patch compiler-rt ubsan library has a bug displaying
incorrect values for variables of the _BitInt (previously called
_ExtInt) type. This patch affects affects both: generation of metadata
inside code generator and runtime part. The runtime part provided only
for i386 and x86_64 runtimes. Other runtimes should be updated to take
full benefit of this patch.
The patch is constructed the way to be backward compatible and int and
float type runtime diagnostics should be unaffected for not yet updated
runtimes.

This patch fixes issue
https://github.com/llvm/llvm-project/issues/64100.

Co-authored-by: Eänolituri Lómitaurë <vladislav.aranov@ericsson.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Co-authored-by: Paul Kirth <paulkirth@google.com>
2024-08-15 10:15:27 -04:00
Nikita Popov
aaab4fcf65 Revert "[SLP][NFC]Remove unused using declarations, reduce mem usage in containers, NFC"
This reverts commit e1b15504a831e63af6fb9a6e83faaa10ef425ae6.

This causes compile-time regressions, see:
http://llvm-compile-time-tracker.com/compare.php?from=e687a9f2dd389a54a10456e57693f93df0c64c02&to=e1b15504a831e63af6fb9a6e83faaa10ef425ae6&stat=instructions:u

Probably some of the new SmallVector sizes are sub-optimal.
2024-08-15 15:50:48 +02:00
Sergei Barannikov
6543bd718e
[DataLayout] Extract loop body into a function to reduce nesting (NFC) (#104420)
Also, use `iterator_range` version of `split`.

Pull Request: https://github.com/llvm/llvm-project/pull/104420
2024-08-15 16:41:52 +03:00
Daniel Grumberg
026d963cb0
[clang][ExtractAPI] Compute inherited availability information (#103040)
Additionally this computes availability information for all platforms
ahead of possibly introducing a flag to enable this behavior.

rdar://123513706
2024-08-15 14:19:49 +01:00
Jie Fu
a4525fcc8f [CodeGen] Fix -Wcovered-switch-default in Combiner.cpp (NFC)
/llvm-project/llvm/lib/CodeGen/GlobalISel/Combiner.cpp:220:3:
error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
  default:
  ^
1 error generated.
2024-08-15 21:17:12 +08:00
Steven Wu
d2a8351be2
[CompilerRT][Tests] Fix profile/darwin-proof-of-concept.c (#104237)
Fix profile/darwin-proof-of-concept.c on AppleSilicon Mac where there is
a different page alignment. The previous fix to drop alignment is
actually breaking the tests on Apple Silicon Mac. Revert to the original
section alignment and requires an ARM64 target for this test to run.
2024-08-15 06:16:27 -07:00
Andrea Faulds
569698443d
[mlir][gpu] Fix typo in test filename (#104053)
The word "redule" doesn't appear anywhere else in the MLIR codebase and
seems to be a typo of "reduce".
2024-08-15 08:11:31 -05:00