549970 Commits

Author SHA1 Message Date
Timm Baeder
9cc89bb238
[clang][bytecode] Simplify Pointer (#155170)
Now that we don't have the PointeeStorage pointer anymore, it's simpler
to access the members of the anonymous union directly instead of using
asBlockPointer(), etc.
2025-08-26 06:01:06 +02:00
Chaitanya
21019a3c11
[flang][openmp] Add Lowering to omp mlir for workdistribute construct (#154378)
This PR adds lowering of workdistribute construct in flang to omp mlir dialect workdistribute op.

The work in this PR is c-p and updated from @ivanradanov commits from coexecute implementation:
flang_workdistribute_iwomp_2024
2025-08-26 09:30:21 +05:30
Craig Topper
56289647be
[DAGCombiner] Preserve nuw when converting mul to shl. Use nuw in srl+shl combine. (#155043)
If the srl+shl have the same shift amount and the shl has the nuw flag,
we can remove both.

In the affected test, the InterleavedAccess pass will emit a udiv after
the `mul nuw`. We expect them to combine away. The remaining shifts on
the RV64 tests are because we didn't add the zeroext attribute to the
incoming evl operand.
2025-08-25 20:44:06 -07:00
Kane Wang
81740e0c97
[RISCV][GlobalISel] Legalize and select G_ATOMICRMW_ADD instruction (#153791)
This patch adds legalization and instruction selection support for the
`G_ATOMICRMW_ADD` opcode in the RISCV GlobalISel backend. Support for
other opcodes will be added in subsequent PRs.

Co-authored-by: Kane Wang <kanewang95@foxmail.com>
2025-08-25 20:38:41 -07:00
Timm Baeder
fadd87ed9f
[clang][bytecode] Check that a ltor cast to a complex value is possible (#155152)
When we get to this point, the pointer might _not_ be backed by a
primitive array, so the later code will fail.

Fixes #155144
2025-08-26 05:38:25 +02:00
Matheus Izvekov
0a675f553c
[clang] fix uniquing of some TagTypes created from the injected class name (#155347)
This fixes a bug in the fast path for the creation of TagTypes from
injected class names.

The creation of TagTypes has a fast path which, when there is no
elaboration, uses storage in the declaration itself for memoizing the
resuling type node, instead of using the folding set.

This memoizing would fail when the type was created from the injected
class name, as we would look for the node in the injected declaration
but store it in the non-injected one, so a different type would be
created each time.

This regression was reported here:
https://github.com/llvm/llvm-project/pull/147835#discussion_r2299248995

Since this regression was never released, there are no release notes.
2025-08-26 00:26:04 -03:00
Timm Baeder
07b2ba2600
Reapply "[clang][bytecode] Fix incorrect offset in elem() (#155157)" (#155276)
This reverts commit 9642aadf7064192164d1687378d28d6bda1978c9.

Since elem() only works on primitive arrays anyway, we don't have to do
the isArrayRoot() check at all.
2025-08-26 05:24:18 +02:00
Matheus Izvekov
89ce8718be
[clang] fix TemplateName Subst* nodes transform (#155342)
This makes sure NestedNameSpecifierLocs don't apply to the replacement
TemplateName of SubstTemplate* nodes.

Also removes improper name qualification over these Subst Nodes, causing
some canonical TemplateNames to not be fully qualified when printed.

Since this is a regression introduced in #147835, which was never
released, there are no release notes.

Fixes #155281
2025-08-26 00:08:41 -03:00
Šárka Holendová
86bca2963f
[flang] Register and lower SECNDS (stubbed implementation) (#151878)
This patch registers and lowers the GNU extension intrinsic `SECNDS` in
Flang.

- Registration and lowering are wired through the intrinsic
infrastructure.
- genSecnds() currently emits a TODO fatal error, marking it as
unimplemented.
- Includes an XFAIL test to exercise the lowering path and reflect
current status.

Fixes https://github.com/llvm/llvm-project/issues/58728

---

CC @eugeneepshteyn @klausler

---------

Co-authored-by: Eugene Epshteyn <eepshteyn@nvidia.com>
2025-08-25 22:31:48 -04:00
Sergei Barannikov
e49946b27f
[TableGen][DecoderEmitter] Factor out DecoderTableBuilder (#155220)
Extract the table building methods from FilterChooser into a separate
class to relieve it of one of its responsibilities.
2025-08-26 05:10:19 +03:00
Matt Arsenault
3134e696e4
AMDGPU: Add target feature for aligned VGPR requirement (#155336)
This now applies to gfx90a+ and gfx1250, so add a dedicated feature
for it so the feature check can be composed correctly with unrelated
properties. Probably would be better to invert this, but that turns
out to be difficult given the current assumptions.
2025-08-26 01:36:51 +00:00
Mingjie Xu
8c692b4917
[StandardInstrumentations] Make -print-after-pass-number/-print-after-pass-number options allow multiple pass numbers specified (#155228)
`-print-before` and `-print-after` support multiple passes as a list of
strings, so it makes sense that we also support
`-print-before-pass-number` and `-print-after-pass-number` taking a list
of pass numbers as input. This is useful if you want to print out the
IRs before/after specified passes with pass numbers reported by
print-pass-numbers in a single run.
2025-08-26 10:22:50 +09:00
LLVM GN Syncbot
78baec318f [gn build] Port 5cdd8832330e 2025-08-26 01:11:16 +00:00
Gedare Bloom
5cdd883233
[clang-format][NFC] Move AlignAfterOpenBracket tests (#154978)
Add AlignBracketsTest.cpp to collect tests from FormatTest.cpp related
to alignment and breaking after open brackets.
2025-08-25 18:08:29 -07:00
Elvis Wang
ed52bdd453
[VPlan] Get Addr computation cost with scalar type if it is uniform for gather/scatter. (NFC) (#150371)
This patch query `getAddressComputationCost()` with scalar type if the
address is uniform. This can help the cost for gather/scatter more
accurate.

In current LV, non consecutive VPWidenMemoryRecipe (gather/scatter) will
account the cost of address computation. But there are some cases that
the address is uniform across all lanes, that makes the address can be
calculated with scalar type and broadcast.

I have a followup optimization that tries to convert gather/scatter with
uniform memory access to scalar load/store + broadcast (and select if
needed). With this optimization, we can remove this temporary change.

This patch is preparation for #149955 to prevent regressions.
2025-08-26 09:04:15 +08:00
Kito Cheng
9db7e8d070
[RISCV] Refactor RVV builtin code generation for reduce compilation time [NFC] (#154906)
Extract ManualCodegen blocks from riscv_vector.td to dedicated helper
functions in RISCV.cpp to improve compilation times and code
organization.

This refactoring:
- Reduces riscv_vector_builtin_cg.inc from ~70,000 lines to ~30,000
lines
- Extracts lots of ManualCodegen blocks into helper functions in
RISCV.cpp
- Moves complex code generation logic from TableGen to C++
- Marks extracted functions with LLVM_ATTRIBUTE_NOINLINE to prevent
excessive inlining in EmitRISCVBuiltinExpr's large switch statement,
which would cause compilation time to increase significantly

Performance Impact on AMD Ryzen 9 3950X 16-Core with SSD (Release build)
with GCC 11:

Before: real 1m4.560s, user 0m0.529s, sys 0m0.175s
After:  real 0m22.577s, user 0m0.498s, sys 0m0.152s

Which reduced around 65% of compilation time.

During this refactoring, I also found few more opportunities to optimize
and simplify the code generation logic, but I think leave to next PR
since it already change a lot of code.

Fix #88368
2025-08-26 08:57:11 +08:00
Carl Ritson
1f6648ccaa
[AMDGPU] AMDGPUPromoteAlloca: increase default max-regs to 32 (#155076)
Increase promote-alloca-to-vector-max-regs to 32 from 16.
This restores default promotion of 16 x double which was disabled by
#127973.

Fixes SWDEV-525817.
2025-08-26 09:30:16 +09:00
Augusto Noronha
3c91d58040
Revert "[NFC][lldb] Add a null check, actually use new SharedModuleLi… (#155327)
…st class"

This reverts commit 234e075c1dbdaacd2e1b4199ae983f5c4439223c.


I'm reverting this because the ASAN build fails running the
TestMiniDumpUUID.py test. This happens because the pointer is already
freed before the call to `RemoveIfOrpahaned`. The ModuleList
implementation never actually dereferences the pointer, so it worked
correctly, but the new map implementation does dereference it, hence the
crash.
2025-08-25 17:21:47 -07:00
Maksim Panchenko
e665cf3976
[BOLT] Fix handling of ambiguous jump table entries (#155291)
Jump tables may contain entries that point immediately past the end of
their parent function. Normally, such entries are generated by the
compiler as a result of builtin_unreachable() case. We used to replace
those entries with a label belonging to their parent function assuming
the destination doesn't matter if it's an undefined behavior.

However, if such entry is at the end of the jump table, it could be a
real function pointer, not a jump table entry. We rely on heuristics to
detect such cases and can drop the trailing function pointer entries
from the table.

The problem presents when the "unreachable" ambiguous entry is followed
by another ambiguous entry corresponding to the start of the parent
function. In this case we accept pointers as entries and may incorrectly
update the function pointer.

The solution is to keep ambiguous "unreachable" jump table entries
identical to the original input, i.e. point to the same function. This
change does not affect CFG, but results in the entries being updated
with the new function address if it gets relocated.
2025-08-25 17:13:30 -07:00
Matheus Izvekov
dc8596d548
[clang] NFC: change more places to use Type::getAsTagDecl and friends (#155313)
This changes a bunch of places which use getAs<TagType>, including
derived types, just to obtain the tag definition.

This is preparation for #155028, offloading all the changes that PR used
to introduce which don't depend on any new helpers.
2025-08-25 20:18:56 -03:00
Jonas Devlieghere
1ba8b36fef
[lldb] Adopt JSONTransport in the MCP Server (Reland) (#155322)
This PR adopts JSONTransport in the MCP server implementation. It
required a slight change in design in the relationship between the two
server classes. Previously, these two had an "is-a" connection, while
now they have a "has-a" connection.

The "generic" protocol server in Protocol/MCP now operates using a
single connection (Transport). This matches the design in DAP where each
DAP instance has its own connection. The protocol server in Plugins
still supports multiple clients and creates a new server instance for
each connection.

I believe the new design makes sense in the long term (as proved by DAP)
and allows us to make the server stateful if we choose to do so. There's
no reason that multiple client support can't live in the generic
protocol library, but for now I kept it in ProtocolServerMCP to avoid
creating unnecessary abstractions.

This is a reland of #155034 but with significant changes to the tests.
The unit tests now test the generic server implementation, which matches
the original intent. This also means the test are now single threaded
and therefore fully deterministic using the MainLoop.
2025-08-25 16:18:21 -07:00
Finn Plummer
508ef1796c
[HLSL][RootSignature] Introduce HLSLFrontendAction to implement rootsig-define (#154639)
This pr implements the functionality of `rootsig-define` as described
[here](https://github.com/llvm/wg-hlsl/blob/main/proposals/0029-root-signature-driver-options.md#option--rootsig-define).

This is accomplished by:
- Defining the `fdx-rootsignature-define`, and `rootsig-define` alias,
driver options. It simply specifies the name of a macro that will expand
to a `LiteralString` to be interpreted as a root signature.
- Introduces a new general frontend action wrapper,
`HLSLFrontendAction`. This class allows us to introduce `HLSL` specific
behaviour on the underlying action (primarily `ASTFrontendAction`).
Which will be further extended, or modularly wrapped, when considering
future DXC options.
- Using `HLSLFrontendAction` we can add a new `PPCallback` that will
eagerly parse the root signature specified with `rootsig-define` and
push it as a `TopLevelDecl` to `Sema`. This occurs when the macro has
been lexed.
- Since the root signature is parsed early, before any function
declarations, we can then simply attach it to the entry function once it
is encountered. Overwriting any applicable root signature attrs.

Resolves https://github.com/llvm/llvm-project/issues/150274

##### Implementation considerations

To implement this feature, note that:
1. We need access to all defined macros. These are created as part of
the first `Lex` in `Parser::Initialize` after `PP->EnterMainSourceFile`
2. `RootSignatureDecl` must be added to `Sema` before
`Consumer->HandleTranslationUnit` is invoked in `ParseAST`

Therefore, we can't handle the root signature in
`HLSLFrontendAction::ExecuteAction` before (from 1.) or after (from 2.)
invoking the underlying `ASTFrontendAction`.

This means we could alternatively:
- Manually handle this case
[here](ac8f0bb070/clang/lib/Parse/ParseAST.cpp (L168))
before parsing the first top level decl.
- Hook into when we [return the entry function
decl](ac8f0bb070/clang/lib/Parse/Parser.cpp (L1190))
and then parse the root signature and override its `RootSignatureAttr`.

The proposed solution handles this in the most modular way which should
work on any `FrontendAction` that might use the `Parser` without
invoking `ParseAST`, and, is not subject to needing to call the hook in
multiple different places of function declarators.
2025-08-25 16:09:34 -07:00
Aiden Grossman
1d3c302171 Revert "[compiler-rt] Remove %T from shared object substitutions (#155302)"
This reverts commit 769155912787941edd32f91ef9acd7493ba64f14.

This took out at least three buildbots. Reverting until I can figure out what
is going on.
2025-08-25 23:02:44 +00:00
Josh Stone
e6ae4e689c
[PowerPC] Indicate that PPC32PICGOT clobbers LR (#154654)
This pseudo-instruction emits a local `bl` writing LR, so that must be
saved and restored for the function to return to the right place. If
not, we'll return to the inline `.long` that the `bl` stepped over.

This fixes the `SIGILL` seen in rayon-rs/rayon#1268.
2025-08-25 15:31:27 -07:00
Stanislav Mekhanoshin
94e4ef5f65
[AMDGPU] gfx1250 waitcnt related codegen tests update. NFC (#155317) 2025-08-25 15:23:59 -07:00
Stanislav Mekhanoshin
f3ea46a31b
[AMDGPU] Add few missing gfx1250 codegen tests. NFC (#155314) 2025-08-25 15:22:33 -07:00
cmtice
c31b670e49
[llvmn][CI] Update libc++ metrics to count running & queued aggregates. (#155298)
Update the code that collects the workflow_queue_size and the
running_workflow_count data to also collect those statistics for the
libc++ aggregates.
2025-08-25 15:21:35 -07:00
Stanislav Mekhanoshin
f13a35c447
[AMDGPU] gfx1250 intrinscs codegen tests update. NFC (#155312) 2025-08-25 15:18:27 -07:00
Stanislav Mekhanoshin
68107bb360
[AMDGPU] gfx1250 run line in the fp atomics test. NFC (#155306) 2025-08-25 15:15:22 -07:00
Justin Fargnoli
33de41988f
Partial revert "[NVPTX] Enhance mul.wide and mad.wide peepholes #150477" (#155024)
Fix
https://github.com/llvm/llvm-project/pull/150477#issuecomment-3191367837

Undo `add (mul.wide a, b), c` -> `mad.wide a, b, c` instruction
selection pattern, but preserve `mul.wide` DAG combine.
2025-08-25 22:11:18 +00:00
Stanislav Mekhanoshin
43a9b666b6
[AMDGPU] gfx1250 trans instructions bf16 codegen tests update. NFC (#155310)
Co-authored-by: Shilei Tian <Shilei.Tian@amd.com>
2025-08-25 15:10:12 -07:00
Stanislav Mekhanoshin
efd8143c24
[AMDGPU] gfx1250 codegen load tests update. NFC. (#155305) 2025-08-25 15:09:41 -07:00
Stanislav Mekhanoshin
e903a6c2b5
[AMDGPU] gfx1250 SADDR tests update. NFC (#155307) 2025-08-25 15:07:15 -07:00
Henrik G. Olsson
31948b3a46
[Util] Make pass-test-update.py test case more resilient (NFC) (#155303)
This test case matches against python traceback output, which seems to
vary slightly between versions. This relaxes the constraints a bit to
make the test pass on buildbots.
2025-08-25 22:03:06 +00:00
Aiden Grossman
7691559127
[compiler-rt] Remove %T from shared object substitutions (#155302)
Given we are trying to deprecate %T and remove it, we also need to
remove it from the substitutions within compiler-rt. This is the last
remaining upstream user.

This slightly increases the complexity of using these substitutions
because now you need to create/cd into a %t.dir (specifically named
that) at the beginning of the directory, but I'm not sure that's more
knowledge than what was needed before to write a test using this
substitution. These tests also definitely were not race safe previously.
2025-08-25 14:55:28 -07:00
Stanislav Mekhanoshin
c6c48b4585
[AMDGPU] gfx1250 s_buffer_load tests. NFC. (#155295) 2025-08-25 14:32:50 -07:00
Stanislav Mekhanoshin
c8b46f3c5d
[AMDGPU] gfx1250 sram-ecc feature codegen tests. NFC. (#155293)
sram-ecc is always on.
2025-08-25 14:32:29 -07:00
Stanislav Mekhanoshin
b412d7d111
[AMDGPU] gfx1250 min/max codegen tests. NFC. (#155292) 2025-08-25 14:32:08 -07:00
Abhinav Gaba
bb1cb6a198
[NFC][OpenMP] Add several use_device_ptr/addr tests. (#154939)
Most tests are either compfailing or runfailing.

They should start passing once we start using ATTACH map-type based
codegen. (#153683)

Even after they start passing, there are a few places where the EXPECTED
and actual CHECKs are different, due to two main issues:
* use_device_ptr translation on `&p[0]` is not succeeding in looking-up
a previously mapped `&p[1]`
* privatization of byref use_device_addr operands is not happening
correctly.

The above should be fixed as separate standalone changes.
2025-08-25 14:23:26 -07:00
Florian Hahn
f0df62f7b6
[IndVars,LV] Add tests for missed SCEV simplifications with muls. 2025-08-25 22:09:15 +01:00
Craig Topper
6bbae4d465
[RISCV] Add underscores to instructions names for Zimop/Zcmop. (#155289)
This matches the position of the periods in the mnemonics.

I didn't rename the intrinsics because I'm not sure who uses them.
2025-08-25 14:06:28 -07:00
Florian Hahn
c950a72974
[VPlan] Support scalar VF for ExtractLane and FirstActiveLane.
Extend ExtractLane and FirstActiveLane to support scalable VFs. This
allows correct handling when interleaving with VF = 1.

Alive2 proofs:
 - Fixed codegen with this patch: https://alive2.llvm.org/ce/z/8Y5_Vc
   (verifies as correct)
 - Original codegen: https://alive2.llvm.org/ce/z/twdg3X (doesn't
   verify)

Fixes https://github.com/llvm/llvm-project/issues/154967.
2025-08-25 21:45:21 +01:00
Ely Ronnen
3cbbc075be
[lldb-dap] improve symbol table style (#155097)
* apply odd table rows color from vscode theme
* apply hover color from vscode theme

[Screencast From 2025-08-23
14-48-44.webm](https://github.com/user-attachments/assets/a738ac3c-3e56-4a57-b713-7430c614c415)
2025-08-25 22:33:39 +02:00
Kazu Hirata
83910de75a [libclang] Fix a warning
This patch fixes:

  clang/tools/libclang/CXIndexDataConsumer.cpp:1235:11: error:
  enumeration value 'IncludeDirective' not handled in switch
  [-Werror,-Wswitch]
2025-08-25 13:33:22 -07:00
Henrik G. Olsson
58996c0ba6
[Util] Only run --update-tests functions on failing tests (#155148)
The early exit we relied on to only invoke test updaters for failing
tests requires that there was no output to stdout or stderr, and that
timeouts weren't enabled. When these conditions weren't fulfilled, test
updaters would be invoked even on passing or XFAILed tests.
2025-08-25 13:29:10 -07:00
joaosaffran
c6dfbc5cc7
[DirectX] Refactor RootSignature Backend to remove to_underlying from Root Parameter Header (#154249)
This patch is refactoring Root Parameter Header in DX Container backend
to remove the usage of `to_underlying`. This requires some changes:
first, MC Root Signature should not depend on Object/DXContainer.h;
Second, we need to assume data to be valid in scenarios where it was
originally not expected, this made some tests be removed.
2025-08-25 16:28:07 -04:00
Victor Mustya
6a5cb5afdc
[GISel] Fix crash in GlobalISel utils method (#153334)
The `getDefSrcRegIgnoringCopies` method in GlobalISel Utils crashed when
the first operand of the input instruction was not a register, e.g.,
the `INLINEASM` instruction has a non-register first operand.

---------

Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
2025-08-25 12:59:01 -07:00
Nikolas Klauser
e4eccd6a3c
[libc++] Optimize __hash_table::erase(iterator, iterator) (#152471)
Instead of just calling the single element `erase` on every element of
the range, we can combine some of the operations in a custom
implementation. Specifically, we don't need to search for the previous
node or re-link the list every iteration. Removing this unnecessary work
results in some nice performance improvements:
```
-----------------------------------------------------------------------------------------------------------------------
Benchmark                                                                                             old           new
-----------------------------------------------------------------------------------------------------------------------
std::unordered_set<int>::erase(iterator, iterator) (erase half the container)/0                    457 ns        459 ns
std::unordered_set<int>::erase(iterator, iterator) (erase half the container)/32                   995 ns        626 ns
std::unordered_set<int>::erase(iterator, iterator) (erase half the container)/1024               18196 ns       7995 ns
std::unordered_set<int>::erase(iterator, iterator) (erase half the container)/8192              124722 ns      70125 ns
std::unordered_set<std::string>::erase(iterator, iterator) (erase half the container)/0            456 ns        461 ns
std::unordered_set<std::string>::erase(iterator, iterator) (erase half the container)/32          1183 ns        769 ns
std::unordered_set<std::string>::erase(iterator, iterator) (erase half the container)/1024       27827 ns      18614 ns
std::unordered_set<std::string>::erase(iterator, iterator) (erase half the container)/8192      266681 ns     226107 ns
std::unordered_map<int, int>::erase(iterator, iterator) (erase half the container)/0               455 ns        462 ns
std::unordered_map<int, int>::erase(iterator, iterator) (erase half the container)/32              996 ns        659 ns
std::unordered_map<int, int>::erase(iterator, iterator) (erase half the container)/1024          15963 ns       8108 ns
std::unordered_map<int, int>::erase(iterator, iterator) (erase half the container)/8192         136493 ns      71848 ns
std::unordered_multiset<int>::erase(iterator, iterator) (erase half the container)/0               454 ns        455 ns
std::unordered_multiset<int>::erase(iterator, iterator) (erase half the container)/32              985 ns        703 ns
std::unordered_multiset<int>::erase(iterator, iterator) (erase half the container)/1024          16277 ns       9085 ns
std::unordered_multiset<int>::erase(iterator, iterator) (erase half the container)/8192         125736 ns      82710 ns
std::unordered_multimap<int, int>::erase(iterator, iterator) (erase half the container)/0          457 ns        454 ns
std::unordered_multimap<int, int>::erase(iterator, iterator) (erase half the container)/32        1091 ns        646 ns
std::unordered_multimap<int, int>::erase(iterator, iterator) (erase half the container)/1024     17784 ns       7664 ns
std::unordered_multimap<int, int>::erase(iterator, iterator) (erase half the container)/8192    127098 ns      72806 ns
```
2025-08-25 21:45:20 +02:00
AZero13
79dfe48865
[ARM] Set isCheapToSpeculateCtlz as true for hasV5TOps and no Thumb 1 (#154848)
This is so that we don't expand to include unneeded 0 checks.

Also fix the logic error in LegalizerInfo so it is NOT legal on Thumb1
in Fast-ISEL.

Finally, Remove the README entry regarding this issue.
2025-08-25 12:43:48 -07:00
Jonas Devlieghere
aa1dd4b0d6
Revert "[lldb] Adopt JSONTransport in the MCP Server" (#155280)
Reverts llvm/llvm-project#155034 because the unit tests are flakey on
the Debian bot: https://lab.llvm.org/buildbot/#/builders/162.
2025-08-25 12:34:36 -07:00