538618 Commits

Author SHA1 Message Date
Fangrui Song
bb03cdcb44
RISCV: Remove shouldForceRelocation and unneeded relocations
Follow-up to #140494

`shouldForceRelocation` is conservative and produces redundant
relocations.

For example, RISCVAsmBackend::ForceRelocs (introduced to support mixed
relax/norelax code) leads to redundant relocations in the following
example adapted from #77436

```
.option norelax
j label
// For assembly input, RISCVAsmParser::ParseInstruction sets ForceRelocs (https://reviews.llvm.org/D46423).
// For direct object emission, RISCVELFStreamer sets ForceRelocs (#77436)
.option relax
call foo  // linker-relaxable

.option norelax
j label   // redundant relocation due to ForceRelocs
.option relax

label:
```

Root problem: The `isSymbolRefDifferenceFullyResolvedImpl` condition in
MCAssembler::evaluateFixup does not check whether two locations are
separated by a fragment whose size can be indeterminate due to linker
instruction (e.g. MCDataFragment with relaxation, or MCAlignFragment
due to indeterminate start offst).

This patch

* Updates the fragment walk code in
  `attemptToFoldSymbolOffsetDifference` to treat MCRelaxableFragment
  (for --riscv-asm-relax-branches) as fixed size after finishLayout.
* Adds a condition in `addReloc` to complement
  `isSymbolRefDifferenceFullyResolvedImpl`.
* Removes the no longer needed `shouldForceRelocation`.

This fragment walk code path handles nicely handles
mixed relax/norelax case from
https://discourse.llvm.org/t/possible-problem-related-to-subtarget-usage/75283
and allows us to remove `MCSubtargetInfo` argument (#73721) as a follow-up.

This fragment walk code should be avoided in the absence of
linker-relaxable fragments within the current section.

Adjust two bolt/test/RISCV tests (#141310)

Pull Request: https://github.com/llvm/llvm-project/pull/140692
2025-05-23 18:44:15 -07:00
qazwsxedcrfvtg14
d5802c30ae
[mlir] Optimize const values AffineMap::compose (#141005)
The original implementation will create two intermediate AffineMap in
the context, calling this compose function with different values
multiple times will occupy a lot of memory.

To improve the performance, we can call the AffineExpr::replace
directly, so we don't need to store all combinations of values in the
context.
2025-05-23 17:30:48 -07:00
Qinkun Bao
e9dbf31be5
[NFCI][Sanitizer] Convert Matcher::Globs from StringMap to vector. (#140964)
As discussed in https://github.com/llvm/llvm-project/pull/139772 and
https://github.com/llvm/llvm-project/pull/140529, Matcher::Globs can
keep the order when parsing the case list.
2025-05-23 20:23:13 -04:00
Peter Collingbourne
b20801646a
CodeGen: Fix implementation of __builtin_trivially_relocate.
The builtin is documented to copy `count` elements, but the implementation
copies `count` bytes. Fix that.

Reviewers: cor3ntin, ojhunt

Pull Request: https://github.com/llvm/llvm-project/pull/140312
2025-05-23 17:02:49 -07:00
Paul Kirth
26fe803b9f
[clang-doc] Implement setupTemplateValue for HTMLMustacheGenerator (#138064)
This patch implements the business logic for setupTemplateValue, which
was split from #133161. The implementation configures the relative path
relationships between the various HTML components, and prepares them
prior to their use in the generator.

Co-authored-by: Peter Chou <peter.chou@mail.utoronto.ca>
2025-05-23 15:59:42 -07:00
Paul Kirth
a8be7a7489
[clang-doc] Extract Info into JSON values (#138063)
Split from #133161. This patch provides the implementation of a number
of extractValue overloads used with the different types of Info.

The new helper functions extract the relevant information from the
different *Infos and inserts them into the correct fields of the JSON
values that will be used with the specific Mustache templates, which
will land separately.

Co-authored-by: Peter Chou <peter.chou@mail.utoronto.ca>
2025-05-23 15:56:44 -07:00
Andy Kaylor
ea3c225786
[CIR] Add alignment support for global, store, and load ops (#141163)
This adds alignment support for GlobalOp, LoadOp, and StoreOp.

Tests which failed because cir.store/cir.load now print alignment were
updated with wildcard matches, except where the alignment was relevant
to the test. Tests which check for cir.store/cir.load in cases that
don't have explicit alignment were not updated.

New tests for alignment are alignment.c, align-load.c, and
align-store.c.
2025-05-23 15:34:59 -07:00
Craig Topper
1695e8b3d1 [RISCV] Fix typo '==' instead of '='. NFC 2025-05-23 14:26:21 -07:00
Bruno Cardoso Lopes
faa4505bcb
[MLIR][LLVM][DLTI] Handle data layout token 'Fn32' (#141167) 2025-05-23 14:17:45 -07:00
Philip Reames
77a3f81dc4
[RISCV] Custom lower fixed length partial.reduce to zvqdotq (#141180)
This is a follow on to 9b4de7 which handles the fixed vector cases. In
retrospect, this is simple enough if probably should have just been part
of the original commit, but oh well.
2025-05-23 13:56:49 -07:00
Nikolas Klauser
1d411f27c7
[libc++][NFC] Replace a few "namespace std" with the correct macro (#140510)
We've added a new macro for the unversioned `namespace std` cases in
#133009, but it seems we've missed a few places. This fixes the places I
just found.
2025-05-23 22:56:24 +02:00
Owen Pan
eb341f0b04
[clang-format][NFC] FormatTokenLexer.cpp cleanup (#141202) 2025-05-23 13:49:28 -07:00
Craig Topper
cd60ee9d6e
[RISCV] Prevent using dummy_reg_pair_with_x0 in more places. (#141273)
Similar to #141261.

These aren't easy to test without write MIR tests in areas we don't
currently have tests. I'm not sure we use X0_Pair anywhere today.

I'm going to try to migrate RISCVMakeCompressible to use copyToReg so we
can share that code instead of basically duplicating it.

I'm still concerned that target independent code may fold an
extract_subreg operation and get an incorrect register if we do start
using X0_Pair. We may have to special case dummy_reg_pair_with_x0 in the
encoder and printer to be safe.
2025-05-23 13:40:27 -07:00
Andre Kuhlenschmidt
df03f7ed4c
[flang][openacc] use location of end directive for exit operations (#140763)
Make sure to preserve the location of the end statement on data
declarations for use in debugging OpenACC runtime.
2025-05-23 13:39:11 -07:00
Florian Hahn
672e9263cb
Reapply "[VPlan] Support cloning initial VPlan (NFC)."
This reverts commit 204252e2df80876702616518a5154dccacf3ebac.

Recommit with a fix for the leak in a unit test.
2025-05-23 21:22:31 +01:00
Ely Ronnen
35c15e41ae
[lldb-dap] Fix address comparison in DisassembleRequestHandler (#140975)
Fix comparisons between addresses with the same load address that can
unexpectedly return false in `DisassembleRequestHandler`
2025-05-23 22:17:13 +02:00
Miguel A. Arroyo
795e889037
[Clang][CMake][MSVC] Install PDBs alongside executables (#126961)
Fixes the changes introduced in
https://github.com/llvm/llvm-project/pull/126675 and subsequently
reverted by https://github.com/llvm/llvm-project/pull/126934 .

Originally, I mistakenly put the `install` in the wrong location (should
have been in the `add_clang_tool` macro) which slipped through testing.
I've verified locally using the same CMake configure options.


For reference:
* **CMake Configure**
```
 cmake -B build -S llvm -GNinja -DLLVM_ENABLE_PROJECTS="llvm;clang;lld;compiler-rt" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PDB=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
```
* **Error**
```
TARGET_PDB_FILE is allowed only for targets with linker created artifacts.
```
2025-05-23 12:58:56 -07:00
Miguel A. Arroyo
e100f54a03
[LLD][CMake][MSVC] Install PDBs alongside executables (#126680)
* Follows up on https://github.com/llvm/llvm-project/pull/120683
installing PDBs for LLD.
2025-05-23 12:58:30 -07:00
Paul Kirth
1590ef3dec
[asan][test] Disable asan_lsan_deadlock test (#141145)
While the current test exercised the deadlock behavior prior to #131756,
deadlock still can occur intermittently. Since this results in test
flakes in CI, we disable this test until the locking behavior can be
fixed in the runtime. See #140646 for details.
2025-05-23 12:55:12 -07:00
Erick Velez
441b967ad9
[clang-doc] fix names of conversions for template parameters (#140856)
Fixes #59812

The names of conversion functions of template type parameters were being
emitted as "type-parameter-N-M". Now we check if the conversion type is
a TemplateTypeParmType and reconstruct the source name.
2025-05-23 19:35:32 +00:00
Mircea Trofin
c6be4566bc
[docs][mlgo] Document custom builds (#141243) 2025-05-23 12:23:58 -07:00
Luke Lau
7b2fc48c27
[InstCombine] Remove dead poison check. NFCI (#141264)
As far as I understand any binary op with poison as either operand will
constant fold to poison, so this check will never trigger.
`llvm::ConstantFoldBinaryInstruction` seems to confirm this?

I think this ended up getting left behind because originally
shufflevectors with undef indices produced undef elements, and we
couldn't pull the shuffle across some binops like `or undef, -1 --> -1`.

This code was added in 8c655150827b5d56772e628994db08441c554097 to
partially fix it and further extended in
f7499011ca29bebeda7c9d79d79b290cf0b8b46d, originally checking for undef
but changed to check for poison in cd54c47424456

But nowadays shufflevectors with undef indices are treated as poison
indices as of 575fdea70a86f68b0d303a9a3273fc47f810628a, and so produce
poison elements, so this is no longer an issue
2025-05-23 20:21:12 +01:00
bd1976bris
6520b21ce0
[DTLTO][LLVM] Integrated Distributed ThinLTO (DTLTO) (#127749)
This patch adds initial support for Integrated Distributed ThinLTO
(DTLTO) in LLVM, which manages distribution internally during the
traditional link step. This enables compatibility with any build
system that supports in-process ThinLTO. In contrast, existing
approaches to distributed ThinLTO, which split the thin-link
(--thinlto-index-only), backend compilation, and final link into
separate steps, require build system support, e.g. Bazel.

This patch implements the core DTLTO mechanism, which enables
delegation of ThinLTO backend jobs to an external process (the
distributor). The distributor can then manage job distribution through
systems like Incredibuild. A generic JSON interface is used to
communicate with the distributor, allowing for the creation of new
distributors (and thus integration with different distribution
systems) without modifying LLVM.

Please see llvm/docs/dtlto.rst for more details.

RFC: https://discourse.llvm.org/t/rfc-integrated-distributed-thinlto/69641
Design Review: https://github.com/llvm/llvm-project/pull/126654
2025-05-23 20:07:53 +01:00
Adam Nemet
9f5a670297
[TableGen] !subst on a dag should retain name of operator (#141195)
Without this patch the !subst in the test drops the name "$frag" from
(one_frag:$frag ...) and returns:

```
(set FPR32_NEW:$dst, (one_frag FPR32_NEW:$a, FPR32_NEW:$b))
```
2025-05-23 12:03:56 -07:00
Usama Hameed
afd3133945
Revert "[compiler-rt][cmake] Test COMPILER_RT_HAS_AARCH64_SME with ar… (#141280)
…m64 (#141115)"

This reverts commit a2ce5647200ad40ae356affd44db7d054de444d2.
2025-05-23 11:57:10 -07:00
Amr Hesham
99f1f0edb5
[CIR] Upstream comparison ops for VectorType (#140597)
This change adds support for Cmp ops for VectorType

Issue https://github.com/llvm/llvm-project/issues/136487
2025-05-23 20:54:42 +02:00
Paul Kirth
524ef164a7
[clang-doc] Avoid reading files in unit tests (#141269)
In #138062 it was brought up that this was an anti-pattern. We'll need
to Migrate all of the mustache unittests that need to read template 
files to lit tests, and disable them until tool support lands.
2025-05-23 11:47:20 -07:00
Benjamin Kramer
5efd1ae094 [bazel] Fix up fe30cde29e20 2025-05-23 20:44:12 +02:00
Bart Chrzaszcz
fe30cde29e
[mlir] Fix bazel build after 0fa3ba7. (#141241) 2025-05-23 20:39:52 +02:00
Craig Topper
75d62ee853
[RISCV] Correctly account for the copy cost of GPR pairs in RISCVMakeCompressible. (#141251)
GPR pairs require 2 ADDIs to copy, so we need to be updating more
instructions to get a benefit.
2025-05-23 11:37:42 -07:00
Craig Topper
a2d717d303
[RISCV] Prevent copying dummy_reg_pair_with_x0 in RISCVMakeCompressible. (#141261)
dummy_reg_pair_with_x0 is the odd subregister of X0_Pair, but it isn't a
real register. We need to copy X0 instead since X0_Pair reads as 0.
2025-05-23 11:35:49 -07:00
David Salinas
7b4d2a0206
Resolve Failing LIT test on Fuchsia (#141253) 2025-05-23 14:31:28 -04:00
John Harrison
b2bb0f9764
[lldb-dap] Minor change to stdio client name. (#141266)
Update the stdin <-> stdout client name to `stdio`. I noticed on macOS
if I get a crash report from lldb-dap the `/` in the client name causes
some thread names to be reported without the full name. For example
`Thread 6 Crashed:: */stdout.event_handler`. Switching to `stdio` I
think is still clear and not truncated in the macOS crash reports.
2025-05-23 11:09:19 -07:00
Tim Gymnich
dc8f2f011a
Move GenericFloatingPointPredicateUtils to fix linkage (#141258)
- move GenericFloatingPointPredicateUtils from ADT to IR
2025-05-23 19:41:58 +02:00
Kazu Hirata
961613bd24
[llvm] Fix a typo in documentation (#141204) 2025-05-23 10:33:02 -07:00
Kazu Hirata
6e91fb1e13
[llvm] Use llvm::erase_if (NFC) (#141185) 2025-05-23 10:32:58 -07:00
cmtice
b878e0d118
[LLDB] Fix warning about unused private members. (#141259) 2025-05-23 10:18:05 -07:00
Ely Ronnen
6087854472
[lldb] skip unnamed symbol test on windows (#141212)
https://lab.llvm.org/buildbot/#/builders/141/builds/8927/steps/6/logs/stdio
2025-05-23 18:52:42 +02:00
Stefan Bossbaly
0cf3c437c1
[HWASan] Improve symbol indexing (#135967)
Previously we would add any ELF that contained a build id regardless
whether the ELF contained symbols or not. This works for Android since
soong will strip the symbols into a new directory. However other
build systems, like BUCK, will write the stripped file in the same
directory as the unstripped file. This would cause the hwasan_symbolize
script sometimes add then stripped ELF to its index and ignore the
symbolized ELF. The logic has now been changed to only add ELFs that
contain symbols to the index. If two symbolized ELFs are encountered
with the same build id, we now exit out with an error.

Fixes #135966

---------

Co-authored-by: Stefan Bossbaly <sboss@meta.com>
2025-05-23 09:43:04 -07:00
Nico Weber
01cb390efd [gn] follow up to CLANG_DOC_TEST_ASSET_DIR
Left a comment here:
https://github.com/llvm/llvm-project/pull/138062#issuecomment-2905045589
2025-05-23 12:35:05 -04:00
Nico Weber
d045eb10fc [gn build] Port ed75e2114fd4 2025-05-23 12:35:05 -04:00
Nico Weber
21cbc8ade9 [gn build] Port 9502d1bcb27d 2025-05-23 12:35:05 -04:00
Nico Weber
710ef17b47 [gn build] Port 760bf4f116f9 2025-05-23 12:35:05 -04:00
Nico Weber
7c093ed795 [gn build] Port 58ab005d8db2 2025-05-23 12:35:05 -04:00
Nico Weber
9d103051c9 [gn build] Port 51a03ed27282 2025-05-23 12:35:05 -04:00
Kazu Hirata
3e3b02ff52 [Object] Fix warnings
This patch fixes:

  llvm/unittests/Object/OffloadingBundleTest.cpp:56:19: error: unused
  variable 'mbuf' [-Werror,-Wunused-variable]

  llvm/unittests/Object/OffloadingBundleTest.cpp:57:13: error: unused
  variable 'FileName' [-Werror,-Wunused-variable]

  llvm/unittests/Object/OffloadingBundleTest.cpp:72:19: error: unused
  variable 'mbuf' [-Werror,-Wunused-variable]

  llvm/unittests/Object/OffloadingBundleTest.cpp:73:13: error: unused
  variable 'FileName' [-Werror,-Wunused-variable]
2025-05-23 09:31:50 -07:00
Nico Weber
fe09550be1 [gn] port 7dc7c155251 2025-05-23 12:28:08 -04:00
Martin Storsjö
a2f72ede22
[compiler-rt] [test] Don't apply the "arm" or "armhf" patterns for targets starting with "arm64" (#141226)
This fixes finding the builtins library for arm64ec in tests.

This matches a corresponding condition added in cmake in
3764ba23484afda683eea390407103e609ef4354.
2025-05-23 19:25:09 +03:00
cor3ntin
9502d1bcb2
[Clang][NFC] Move the type trait logic to a separate file. (#141245)
Just to try to keep the size of SemaExprCXX.cpp in check.

As discussed in #141238
2025-05-23 18:22:49 +02:00
Martin Storsjö
cd7104eb87
[libcxx] [test] Extend mingw target checks to cover the arm64ec architecture too (#141227) 2025-05-23 19:13:51 +03:00