527646 Commits

Author SHA1 Message Date
Nikita Popov
e235fcb582
[BOLT] Only link and initialize supported targets (#127509)
Bolt currently links and initializes all LLVM targets. This
substantially increases the binary size, and link time if LTO is used.

Instead, only link the targets specified by BOLT_TARGETS_TO_BUILD. We
also have to only initialize those targets, so generate a
TargetConfig.def file with the necessary information. The way the
initialization is done mirrors what llvm-exegesis does.

This reduces llvm-bolt size from 137MB to 78MB for me.
2025-02-18 09:17:51 +01:00
Owen Pan
13de15c9c4
[clang-format] Fix a bug in annotating StartOfName (#127545)
Also ensure we can break before ClassHeadName like StartOfName.

Fixes #127470
2025-02-18 00:15:01 -08:00
Simon Pilgrim
1ae9dd31a2
[X86] combineConcatVectorOps - add EXTEND_VECTOR_INREG() 512-bit handling (#127530)
Support extension to 512-bit vectors on AVX512/BWI targets.
2025-02-18 08:08:58 +00:00
Simon Pilgrim
d49c3181e6
[X86] emitEpilogue - silence implicit integer extension warning. (#127185)
Silence compiler warning introduced in #125007 - assign the address delta to int64_t, assert it is negative and negate it only as part of the mergeSPAdd call

Fixes #125825
2025-02-18 08:08:24 +00:00
lonely eagle
b227c2578c
[mlir][scf] add unroll-full option to test-loop-unrolling pass (#127158)
Some loops cannot be unrolled by affine-loop-unroll pass. After running
lower-affine pass, they can be unrolled in scf.To enable conversion of
vector Ops in scf to llvm dialect, unroll-full option was added.

---------

Co-authored-by: Oleksandr "Alex" Zinenko <ftynse@gmail.com>
2025-02-18 15:49:58 +08:00
Matthew Devereau
251377c47d
[InstCombine] Fold shift+cttz with power of 2 operands (#127055)
#121386 Introduced cttz intrinsics which caused a regression where
vscale/vscale divisions could no longer be constant folded.

This fold was suggested as a fix in #126411.
https://alive2.llvm.org/ce/z/gWbtPw
2025-02-18 07:06:56 +00:00
Christian Sigg
77410f2a25
[mlir][tensor] Remove unnecessary include.
This include introduced an unwanted dependency from tensor to tensor utils.
2025-02-18 07:50:23 +01:00
Christian Sigg
ab8d99530d
[mlir][bazel] Fix after https://github.com/llvm/llvm-project/pull/127544 2025-02-18 07:38:23 +01:00
Christian Sigg
6e532700f8
[clang][bazel] Port d09cce166d 2025-02-18 07:26:10 +01:00
Pengcheng Wang
6b2e511aed
[RISCV] Implement isHighLatencyDef() (#127476)
And returns true for div/rem/sqrt/... operations.

This is an alternative if we don't support generic scheduling model.
2025-02-18 14:24:20 +08:00
Craig Topper
6ba34f9e73
[RISCV] Use policy instead of ForceTailAgnostic for vmsbf/vmsif/vmsof pseudos. (#127535)
ForceTailAgnostic is currently treated as an override of the policy
operand. It doesn't do anything else so we can just use the policy
directly.
2025-02-17 22:14:22 -08:00
Christian Sigg
a5e6ccf546
[mlir][bazel] Port 517800e37e (#127544)
Introduces a `LinalgInterfaces` target so that `TensorDialect` doesn't
need to depend on `LinalgDialect`, which would introduce a circular
dependency.
2025-02-18 07:13:59 +01:00
Nathan Ridge
d09cce166d
[clang][Index] Use HeuristicResolver in libIndex (#125153)
The uses replace hand-rolled code that did a subset of what
HeuristicResolver does.
2025-02-18 01:13:35 -05:00
Nathan Ridge
0b719d3d63
[clangd] Enable parsing of forwarding functions in the preamble by default (#127359)
Fixes https://github.com/clangd/clangd/issues/2324
2025-02-18 00:59:45 -05:00
Vikram Hegde
663db5c70d
[AMDGPU][NewPM] Port GCNNSAReassign pass to new pass manager (#125034)
tests to be added while porting virtregrewrite and greedy regalloc
2025-02-18 11:13:31 +05:30
Craig Topper
ef9f0b3c41
[DAGCombiner] Don't peek through truncates of shift amounts in takeInexpensiveLog2. (#126957)
Shift amounts in SelectionDAG don't have to match the result type
of the shift. SelectionDAGBuilder will aggressively truncate shift
amounts to the target's preferred type. This may result in a zero extend
that existed in IR being removed.
    
If we look through a truncate here, we can't guarantee the upper bits
of the truncate input are zero. There may have been a zext that was
removed. Unfortunately, this regresses tests where no truncate was
involved. The only way I can think to fix this is to add an assertzext
when SelectionDAGBuilder truncates a shift amount or remove the
early truncation of shift amounts from SelectionDAGBuilder all together.
    
Fixes #126889.
2025-02-17 20:26:05 -08:00
Matt Arsenault
c5def84ca4
AMDGPU: Handle brev and not cases in getConstValDefinedInReg (#127483)
We should not encounter these cases in the peephole-opt use today,
but get the common helper function to handle these.
2025-02-18 11:23:49 +07:00
Matt Arsenault
83d7f4b8c3
AMDGPU: Implement getConstValDefinedInReg and use in foldImmediate (NFC) (#127482)
This is NFC because it currently only matters for cases that are not
isMoveImmediate, and we do not yet implement any of those. This just
moves the implementation of foldImmediate to use the common  interface,
similar to how x86 does it.
2025-02-18 11:21:02 +07:00
yingopq
af1e2a374e
[Mips] Support llvm.readcyclecounter intrinsic (#127553)
The llvm.readcyclecounter intrinsic can be implemented via the `rdhwr
$2, $hwr_cc` instruction.
$hwr_cc: High-resolution cycle counter. This register provides read
access to the coprocessor 0 Count Register.

Fix #106318.
2025-02-18 11:57:23 +08:00
Matt Arsenault
4dee305ce2
AMDGPU: Fix foldImmediate breaking register class constraints (#127481)
This fixes a verifier error when folding an immediate materialized
into an aligned vgpr class into a copy to an unaligned virtual register.
2025-02-18 10:34:48 +07:00
Matt Arsenault
fe1ef413ab
AMDGPU: Add more tests for peephole-opt immediate folding (#127480) 2025-02-18 10:31:46 +07:00
Jonas Devlieghere
f71b83b359
[lldb] Add a release note for #127419 2025-02-17 18:29:24 -08:00
Stanislav Mekhanoshin
d19187f5fe
[AMDGPU] Move into SIProgramInfo and cache getFunctionCodeSize. NFCI. (#127111)
This moves function as is, improvements to the estimate go into
a subseqent patch.
2025-02-17 18:22:48 -08:00
Vy Nguyen
51c91095ab
Reapply "Make llvm::telemetry::Manager::preDispatch protected. (#127114) (#127431)
This reverts commit 66465c3b0ab1b32403ad5a1c3114174d87830f54.

New change: added missing return statement.
2025-02-17 20:59:12 -05:00
Timm Baeder
09d14149f6
[clang][bytecode] Fix return value of array CXXNewExprs (#127526)
Just like with the __builtin_operator_new version, we need to point to
the first array element, not the array element itself.
2025-02-18 02:41:25 +01:00
Matt Arsenault
b5b8a59a53
AMDGPU: Implement getRequiredProperties for SIFoldOperands (#127522)
Fix the broken MIR tests violating isSSA.
2025-02-18 08:22:45 +07:00
Matt Arsenault
ed38d6702f
PeepholeOpt: Handle subregister compose when looking through reg_sequence (#127051)
Previously this would give up on folding subregister copies through
a reg_sequence if the input operand already had a subregister index.
d246cc618adc52fdbd69d44a2a375c8af97b6106 stopped introducing these
subregister uses, and this is the first step to lifting that restriction.

I was expecting to be able to implement this only purely with compose /
reverse compose, but I wasn't able to make it work so relies on testing
the lanemasks for whether the copy reads a subset of the input.
2025-02-18 08:07:29 +07:00
Roland McGrath
8fe290efa6
[libc] Canonicalize generated fenv.h (#127363)
This removes the custom template for fenv.h by declaring all the
standard-specified macros using macro_header.
2025-02-17 17:06:59 -08:00
Jonas Devlieghere
2b41277a09
[lldb] Disable test_step_out_thunk on Windows
On Windows we end up in assembly. Not sure if the thread plans behave
differently or this is a debug info issue. I have no environment to
reproduce and investigate this in, so I'm disabling the test for now.
2025-02-17 16:25:13 -08:00
Jonas Devlieghere
a3dc77c00a
[lldb] Support stepping through C++ thunks (#127419)
This PR fixes LLDB stepping out, rather than stepping through a C++
thunk. The implementation is based on, and upstreams, the support for
runtime thunks in the Swift fork.

Fixes #43413
2025-02-17 15:44:41 -08:00
Brad Smith
0b8bd472b0
[OpenMP][libomp] Add OpenBSD, NetBSD and DragonFly stdarg handling (#126182)
Fixes build on OpenBSD/aarch64.

```
FAILED: openmp/runtime/src/CMakeFiles/omp.dir/kmp_runtime.cpp.o
/home/brad/tmp/llvm-build/bin/clang++ --target=aarch64-unknown-openbsd7.6 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Domp_EXPORTS -I/home/brad/tmp/llvm-build/runtimes/runtimes-bins/openmp/runtime/src -I/home/brad/tmp/llvm-brad/openmp/runtime/src -I/home/brad/tmp/llvm-brad/openmp/runtime/src/i18n -I/home/brad/tmp/llvm-brad/openmp/runtime/src/include -I/home/brad/tmp/llvm-brad/openmp/runtime/src/thirdparty/ittnotify -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -fcolor-diagnostics -Wcast-qual -Wformat-pedantic -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -fno-semantic-interposition -fdata-sections -O3 -DNDEBUG -std=c++17 -fPIC   -D _GNU_SOURCE -D _REENTRANT -U_GLIBCXX_ASSERTIONS -UNDEBUG -fno-exceptions -fno-rtti -Wno-covered-switch-default -Wno-frame-address -Wno-strict-aliasing -Wno-switch -Wno-uninitialized -Wno-return-type-c-linkage -Wno-cast-qual -Wno-int-to-void-pointer-cast -MD -MT openmp/runtime/src/CMakeFiles/omp.dir/kmp_runtime.cpp.o -MF openmp/runtime/src/CMakeFiles/omp.dir/kmp_runtime.cpp.o.d -o openmp/runtime/src/CMakeFiles/omp.dir/kmp_runtime.cpp.o -c /home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp
/home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp:1449:47: error: value of type 'kmp_va_list' (aka '__builtin_va_list') is not contextually convertible to 'bool'
 1449 |   return (master_th->th.th_teams_microtask && ap &&
      |                                               ^~
/home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp:1449:44: error: invalid operands to binary expression ('microtask_t' (aka 'void (*)(int *, int *, ...)') and 'kmp_va_list' (aka '__builtin_va_list'))
 1449 |   return (master_th->th.th_teams_microtask && ap &&
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~
/home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp:1457:15: warning: comparison between NULL and non-pointer ('kmp_va_list' (aka '__builtin_va_list') and NULL) [-Wnull-arithmetic]
 1457 |   return ((ap == NULL && active_level == 0) ||
      |            ~~ ^  ~~~~
/home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp:1457:15: error: invalid operands to binary expression ('kmp_va_list' (aka '__builtin_va_list') and 'long')
 1457 |   return ((ap == NULL && active_level == 0) ||
      |            ~~ ^  ~~~~
/home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp:1458:12: error: value of type 'kmp_va_list' (aka '__builtin_va_list') is not contextually convertible to 'bool'
 1458 |           (ap && teams_level > 0 && teams_level == level));
      |            ^~
/home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp:1458:15: error: invalid operands to binary expression ('kmp_va_list' (aka '__builtin_va_list') and 'bool')
 1458 |           (ap && teams_level > 0 && teams_level == level));
      |            ~~ ^  ~~~~~~~~~~~~~~~
/home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp:1735:9: error: invalid argument type 'kmp_va_list' (aka '__builtin_va_list') to unary expression
 1735 |     if (!ap) {
      |         ^~~
/home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp:2169:66: warning: comparison between NULL and non-pointer ('kmp_va_list' (aka '__builtin_va_list') and NULL) [-Wnull-arithmetic]
 2169 |             !(microtask == (microtask_t)__kmp_teams_master || ap == NULL))
      |                                                               ~~ ^  ~~~~
/home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp:2169:66: error: invalid operands to binary expression ('kmp_va_list' (aka '__builtin_va_list') and 'long')
 2169 |             !(microtask == (microtask_t)__kmp_teams_master || ap == NULL))
      |                                                               ~~ ^  ~~~~
/home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp:2284:9: error: value of type 'kmp_va_list' (aka '__builtin_va_list') is not contextually convertible to 'bool'
 2284 |     if (ap) {
      |         ^~
/home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp:2302:58: error: invalid argument type 'kmp_va_list' (aka '__builtin_va_list') to unary expression
 2302 |     __kmp_fork_team_threads(root, team, master_th, gtid, !ap);
      |                                                          ^~~
/home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp:2363:9: error: value of type 'kmp_va_list' (aka '__builtin_va_list') is not contextually convertible to 'bool'
 2363 |     if (ap) {
      |         ^~
/home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp:7803:3: error: no matching function for call to '__kmp_fork_call'
 7803 |   __kmp_fork_call(loc, gtid, fork_context_intel, team->t.t_argc,
      |   ^~~~~~~~~~~~~~~
/home/brad/tmp/llvm-brad/openmp/runtime/src/kmp_runtime.cpp:1927:5: note: candidate function not viable: no known conversion from 'long' to 'kmp_va_list' (aka '__builtin_va_list') for 7th argument
 1927 | int __kmp_fork_call(ident_t *loc, int gtid,
      |     ^
 1928 |                     enum fork_context_e call_context, // Intel, GNU, ...
 1929 |                     kmp_int32 argc, microtask_t microtask, launch_t invoker,
 1930 |                     kmp_va_list ap) {
      |                     ~~~~~~~~~~~~~~
2 warnings and 11 errors generated.
```
2025-02-17 17:46:02 -05:00
David Green
798890ea10 [AArch64] Remove unused HasFPAC. NFC
It contains a syntax error, but us it is unused it can be removed until we need
it.
2025-02-17 22:17:33 +00:00
Vyacheslav Levytskyy
44cfb6b434
[SPIR-V] Ensure that a correct pointer type is deduced from the Value argument of OpAtomic* instructions (#127492)
This PR improves the set of rules for type inference by ensuring that a
correct pointer type is deduced from the Value argument of OpAtomic*
instructions, also when a pointer argument is coming from an `inttoptr
.. to` instruction that caused problems earlier. Existing test cases are
updated accordingly. This fixes
https://github.com/llvm/llvm-project/issues/127491
2025-02-17 23:16:47 +01:00
Michael Buch
a377cdd23d
[lldb][TypeSystemClang] Add support for floating point template argument constants (#127206)
This patch adds support for template arguments of
`clang::TemplateArgument::ArgKind::StructuralValue` kind (added in
https://github.com/llvm/llvm-project/pull/78041). These are used for
non-type template parameters such as floating point constants. When LLDB
created `clang::NonTypeTemplateParmDecl`s, it previously assumed
integral values, this patch accounts for structural values too.

Anywhere LLDB assumed a `DW_TAG_template_value_parameter` was
`Integral`, it will now also check for `StructuralValue`, and will
unpack the `TemplateArgument` value and type accordingly.

We can rely on the fact that any `TemplateArgument` of `StructuralValue`
kind that the `DWARFASTParserClang` creates will have a valid value,
because it gets those from `DW_AT_const_value`.
2025-02-17 22:03:53 +00:00
Henrich Lauko
93a1184409
[MLIR][LLVM] Fix import split marker in alias test (#127540) 2025-02-17 22:44:10 +01:00
Florian Hahn
88e72c401b [LAA] Add test where GEPs may wrap. 2025-02-17 21:49:40 +01:00
Florian Hahn
620a51535b [VPlan] Add message to assert in HCFGBuilder (NFC).
Suggested in https://github.com/llvm/llvm-project/pull/126388.
2025-02-17 21:36:53 +01:00
Jacek Caban
a92bfaa7d9
[LLD][COFF] Support MinGW constructor and destructor lists on ARM64X (#127205)
Split the chunks for EC and native views, inserting headers and tails for both.
2025-02-17 21:34:12 +01:00
Florian Hahn
a8b177aa60 [LAA] Remove unneeded hasNoOverflow call (NFC).
The function already calls hasNoOverflow above.
2025-02-17 21:14:01 +01:00
Joseph Huber
9a584b07d7
[Clang] Add handlers for 'match_any' and 'match_all' to gpuintrin.h (#127504)
Summary:
These helpers are very useful but currently absent. They allow the user
to get a bitmask representing the matches within the warp. I have made
an executive decision to drop the `predicate` return from `match_all`
because it's easily testable with `match_all() == __activemask()`.
2025-02-17 14:06:24 -06:00
Alex Voicu
a7a356833d
[NFC][Clang][CodeGen] Remove vestigial assertion (#127528)
This removes a vestigial assertion, which would erroneously trigger even
though we now correctly handle valid arg mismatches
(<2dda529838/clang/lib/CodeGen/CGCall.cpp (L5397)>),
after #114062 went in.
2025-02-17 22:05:22 +02:00
Louis Dionne
3fa85c7cce
[libc++] Document that libc++ does not and will never implement the Networking TS (#127508)
There has been discussion around this a few times already, and there
seemed to be consensus that we would never pursue an implementation of
the Networking TS. This patch solidifies that discussion by documenting
it and closing issues related to the Networking TS.

Closes #103799
Closes #100223
Closes #100228
Closes #100231
Closes #100232
2025-02-17 14:51:47 -05:00
Akira Hatanaka
f5c5bc5ed5
[CodeGen][ObjC] Invalidate cached ObjC class layout information after parsing ObjC class implementations if new ivars are added to the interface (#126591)
The layout and the size of an ObjC interface can change after its
corresponding implementation is parsed when synthesized ivars or ivars
declared in categories are added to the interface's list of ivars. This
can cause clang to mis-compile if the optimization that emits fixed
offsets for ivars (see 923ddf65f4e21ec67018cf56e823895de18d83bc) uses an
ObjC class layout that is outdated and no longer reflects the current
state of the class.

For example, when compiling `constant-non-fragile-ivar-offset.m`, clang
emits 20 instead of 24 as the offset for `IntermediateClass2Property` as
the class layout for `SuperClass2`, which is created when the
implementation of IntermediateClass3 is parsed, is outdated when the
implementation of `IntermediateClass2` is parsed.

This commit invalidates the stale layout information of the class and
its subclasses if new ivars are added to the interface.

With this change, we can also stop using ObjC implementation decls as
the key to retrieve ObjC class layouts information as the layout
retrieved using the ObjC interface as the key will always be up to date.

rdar://139531391
2025-02-17 11:50:44 -08:00
Ethan Luis McDonough
83e180cb70
[Clang][PGO] Fix profile function visibility bug (#127257)
This pull request fixes an issue that was introduced in #93365.
`__llvm_write_custom_profile` visibility was causing issues on Darwin.
This function needs to be publicly accessible in order to be accessed by
libomptarget, so this pull request makes `__llvm_write_custom_profile`
an explicitly exported symbol on Darwin. Tested on M3 and X86 macs.
2025-02-17 13:46:37 -06:00
Dave Lee
6fde8fe9ad
[lldb] Provide default impl for MightHaveChildren (NFC) (#119977)
The vast majority of `SyntheticChildrenFrontEnd` subclasses provide
children, and as such implement `MightHaveChildren` with a constant
value of `true`. This change makes `true` the default value. With this
change, `MightHaveChildren` only needs to be implemented by synthetic
providers that can return `false`, which is only 3 subclasses.
2025-02-17 11:19:14 -08:00
Ahmed Bougacha
f0e39c45df
[AArch64] Add aliases for processors apple-a18/s6..10. (#127152)
apple-a18 is an alias of apple-m4.
apple-s6/s7/s8 are aliases of apple-a13.
apple-s9/s10 are aliases of apple-a16.

As with some other aliases today, this reflects identical ISA feature
support, but not necessarily identical microarchitectures and
performance characteristics.
2025-02-17 11:18:45 -08:00
Jacek Caban
15944056aa
[LLD][COFF] Split native and EC .CRT chunks on ARM64X (#127203) 2025-02-17 20:03:32 +01:00
Joseph Huber
0d2722c20d [libc][Docs] Add proper 'offload' build to use libc with offload
Summary:
Since this was added the offloading target now requires `offload`.

Fixes: https://github.com/llvm/llvm-project/issues/127458
2025-02-17 12:42:37 -06:00
Scott Linder
29ca3b8b28
[AMDGPU] Push amdgpu-preload-kern-arg-prolog after livedebugvalues (#126148)
This is effectively a workaround for a bug in livedebugvalues, but seems
to potentially be a general improvement, as BB sections seems like it
could ruin the special 256-byte prelude scheme that
amdgpu-preload-kern-arg-prolog requires anyway. Moving it even later
doesn't seem to have any material impact, and just adds livedebugvalues
to the list of things which no longer have to deal with pseudo
multiple-entry functions.

AMDGPU debug-info isn't supported upstream yet, so the bug being avoided
isn't testable here. I am posting the patch upstream to avoid an
unnecessary diff with AMD's fork.
2025-02-17 13:29:56 -05:00
Scott Linder
eaa460ca49
[AMDGPU] Remove dead function metadata after amdgpu-lower-kernel-arguments (#126147)
The verifier ensures function !dbg metadata is unique across the module,
so ensure the old nameless function we leave behind doesn't violate
this invariant.

Removing the function via e.g. eraseFromParent seems like a better
option, but doesn't seem to be legal from a FunctionPass.
2025-02-17 13:27:23 -05:00