524984 Commits

Author SHA1 Message Date
Owen Pan
6330f1e052
[clang-format] Fix a regression in PointerAlignment: Left (#124085)
Don't insert a space between a type declaration r_paren and &/&&.

Fixes #124073.
2025-01-23 21:44:29 -08:00
Justin Bogner
2f39d138dc
[DirectX] Handle dx.RawBuffer in DXILResourceAccess (#121725)
This adds handling for raw and structured buffers when lowering resource
access via `llvm.dx.resource.getpointer`.

Fixes #121714
2025-01-23 21:35:34 -08:00
vporpo
6db73fa481
[SandboxVec][Scheduler] Fix clear() to clear all state (#124214)
This patch fixes the scheduler's clear() function to also clear the
ReadyList. Not doing so is a bug and results in crashes when the
ReadyList contains stale instructions, because it was never clered.
2025-01-23 21:27:53 -08:00
David CARLIER
f3d2e75ead
[compiler-rt][rtsan] inotify api for Linux interception. (#124177) 2025-01-24 05:07:49 +00:00
David CARLIER
02a3004992
[compiler-rt][rtsan] preadv(64)/pwritev(64) interception. (#124115) 2025-01-24 05:07:33 +00:00
Lang Hames
fd174f0ff3 [clang-repl] Try to XFAIL testcase on arm32 without affecting arm64 darwin.
See discussion in https://github.com/llvm/llvm-project/commit/4f0325873faccfbe1.
2025-01-24 15:31:31 +11:00
Pradeep Kumar
435609b70c
[LLVM][NVPTX] Add support for griddepcontrol instruction (#123511)
This commit adds support for griddepcontrol PTX instruction with tests
under griddepcontrol.ll
2025-01-24 09:33:16 +05:30
Lang Hames
c9bc242e38 [clang-repl] The simple-exception test now passes on arm64-darwin. 2025-01-24 14:59:10 +11:00
Lang Hames
a001cc0e6c [ORC] Destroy defunct MaterializationUnits outside the session lock.
MaterializationUnits may contain arbitrary resources that need cleanup. We want
to do this outside the JIT's session lock.

This should fix a lock-order-inversion warning in clang-repl (for details see
https://github.com/llvm/llvm-project/issues/124215).
2025-01-24 03:43:08 +00:00
Kazu Hirata
9fecb4f907 [CodeGen] Fix a warning
This patch fixes:

  llvm/lib/CodeGen/MachineSink.cpp:1667:22: error: unused variable
  'Preheader' [-Werror,-Wunused-variable]
2025-01-23 19:37:28 -08:00
Cinhi Young
6735d527f9
[MIPS] [MSA] Widen v2i8, v216 and v2i32 vectors (#123040)
- Widen v2i8, v2i16 and v2i32 vectors so they don't cast back and forth,
and make sure that instructions with correct data unit is being used.
- Handle undef indices for VSHF when lowering VECTOR_SHUFFLE (it crashes
if such index is present).
2025-01-24 11:23:34 +08:00
Chuanqi Xu
378dcf6101
[C++20] [Modules] Fix may-be incorrect ADL for module local entities (#123931)
Close https://github.com/llvm/llvm-project/issues/123815

See the comments for details. We can't get primary context arbitrarily
since the redecl may have different context and information.

There is a TODO for modules specific case, I'd like to make it after
this PR.
2025-01-24 10:51:10 +08:00
Matt Arsenault
0ef39a882b
MachineCSE: Remove check for subreg on a def operand (#124095)
There are no subregister defs in SSA.
2025-01-24 09:35:30 +07:00
Sam Elliott
e06b703030
[RISCV][NFC] Remove Redundant Inline Asm Logic (#124202)
This was left over from 408659c5b5c7d745042ae71db344d1ed10601512.
2025-01-23 17:40:36 -08:00
lntue
b11529bfa2
[libc] Use -fno-math-errno to for __builtin_fma* to generate fma instructions. (#124200)
Fixes https://github.com/llvm/llvm-project/issues/123387
2025-01-23 20:38:53 -05:00
Henry Jiang
4405f72881
[llvm][NFC] Remove CV-qualified base class in PassManagerInternal.h (#124193)
This resolves the `-Wignored-qualifiers` warning introduced by the new
warnign in https://github.com/llvm/llvm-project/pull/121419. First
caught in buildbot `ppc64le-lld-multistage-test`

https://lab.llvm.org/buildbot/#/builders/168/builds/7756

---------

Co-authored-by: Henry Jiang <henry.jiang1@ibm.com>
2025-01-23 20:36:13 -05:00
Nathan Ridge
0013264374
[clang][test] Add .cuh as a recognized extension for lit test files (#124080)
Fixes https://github.com/llvm/llvm-project/issues/124079
2025-01-23 20:21:11 -05:00
Jeffrey Byrnes
acb7859f07
[MachineSink] Extend loop sinking capability (#117247)
The current MIR cycle sinking capabilities are rather limited. It only
support sinking copies into a single successor block while obeying
limits.

This opt-in feature adds a more aggressive option, that is not limited
to the above concerns. The feature will try to "sink" by duplicating any
top-level preheader instruction (that we are sure is safe to sink) into
any user block, then does some dead code cleanup. In particular, this is
useful for high RP situations when loop bodies have control flow.
2025-01-23 17:08:23 -08:00
Phoebe Wang
24f177df61
[X86][AVX10.2-BF16] Update VCOMISBF16 intrinsics and instructions (#123307)
- Add `I` to intrinsics and instructions
- Add `_` before sbf16 in intrinsics

Ref.: https://cdrdv2.intel.com/v1/dl/getContent/828965
2025-01-24 08:37:29 +08:00
Thurston Dang
969eb4ec4c [msan][NFC] Correct and clarify comment for getShadowPtrOffset()
The stated return type was incorrect; this patch corrects it. More generally, it explains how the Offset and its components fits into the overall shadow mapping calculation.
2025-01-24 00:36:40 +00:00
vporpo
d2234ca163
[SandboxVec][BottomUpVec] Fix packing when PHIs are present (#124206)
Before this patch we might have emitted pack instructions in between PHI
nodes. This patch fixes it by fixing the insert point of the new packs.
2025-01-23 16:29:01 -08:00
Sam Elliott
33c4407471
[RISCV] Support cR Inline Asm Constraint (#124174)
This denotes RVC-compatible GPR Pairs, which are used by the Zclsd
extension.

C API PR: riscv-non-isa/riscv-c-api-doc#102
2025-01-23 16:19:19 -08:00
Alexander Kornienko
788318484d
Revert "[InstCombine] Teach foldSelectOpOp about samesign" (#124123)
Reverts llvm/llvm-project#122723 due to a miscompilation

See
https://github.com/llvm/llvm-project/pull/122723#issuecomment-2608777844
for details and the test case.
2025-01-24 01:08:10 +01:00
Lang Hames
26fc07d5d8 [ORC] Add explicit narrowing casts to fix build errors.
This should fix the compile errors seen in
https://lab.llvm.org/buildbot/#/builders/154/builds/10779.
2025-01-23 23:54:57 +00:00
Valentin Clement (バレンタイン クレメン)
67a8857989
[flang][cuda] Handle pointer allocation with double descriptors (#124183) 2025-01-23 15:54:22 -08:00
Haopeng Liu
13dae34819
[DSE] Enable the initializes improvement in DSE (#124058)
(Retry) enable the initializes improvement in DSE.

Initially enabled in https://github.com/llvm/llvm-project/pull/119116.

Fix the aliasing issue through global variables in
https://github.com/llvm/llvm-project/pull/120044.

The compile-time comparison of this enabling (no meaningful diff):
https://llvm-compile-time-tracker.com/compare.php?from=b46fcb9fa32f24660b1b8858d5c4cbdb76ef9d8b&to=33dc817b81f7898c87b052d1ddfd3d6e6f5b5dbd&stat=instructions%3Au
2025-01-23 15:51:04 -08:00
alx32
c676104875
[lld-macho] Implement symbol string deduplication (#123874)
The symbol string table does not have deduplication. 
Here we add code to deduplicate the symbol string table. 
This has a rather large size impact (20-30%) on unstripped binaries
(typically debug binaries) but no size impact on stripped
binaries(typically release binaries).

We enable deduplication by default and add a flag to disable it
(`-no-deduplicate-symbol-strings`).
2025-01-23 15:48:11 -08:00
Matheus Izvekov
28ad8978ee
Reland: [clang] unified CWG2398 and P0522 changes; finishes implementation of P3310 (#124137)
This patch relands the following PRs:
* #111711
* #107350
* #111457

All of these patches were reverted due to an issue reported in
https://github.com/llvm/llvm-project/pull/111711#issuecomment-2406491485,
due to interdependencies.

---
[clang] Finish implementation of P0522

This finishes the clang implementation of P0522, getting rid
of the fallback to the old, pre-P0522 rules.

Before this patch, when partial ordering template template parameters,
we would perform, in order:
* If the old rules would match, we would accept it. Otherwise, don't
  generate diagnostics yet.
* If the new rules would match, just accept it. Otherwise, don't
  generate any diagnostics yet again.
* Apply the old rules again, this time with diagnostics.

This situation was far from ideal, as we would sometimes:
* Accept some things we shouldn't.
* Reject some things we shouldn't.
* Only diagnose rejection in terms of the old rules.

With this patch, we apply the P0522 rules throughout.

This needed to extend template argument deduction in order
to accept the historial rule for TTP matching pack parameter to non-pack
arguments.
This change also makes us accept some combinations of historical and P0522
allowances we wouldn't before.

It also fixes a bunch of bugs that were documented in the test suite,
which I am not sure there are issues already created for them.

This causes a lot of changes to the way these failures are diagnosed,
with related test suite churn.

The problem here is that the old rules were very simple and
non-recursive, making it easy to provide customized diagnostics,
and to keep them consistent with each other.

The new rules are a lot more complex and rely on template argument
deduction, substitutions, and they are recursive.

The approach taken here is to mostly rely on existing diagnostics,
and create a new instantiation context that keeps track of this context.

So for example when a substitution failure occurs, we use the error
produced there unmodified, and just attach notes to it explaining
that it occurred in the context of partial ordering this template
argument against that template parameter.

This diverges from the old diagnostics, which would lead with an
error pointing to the template argument, explain the problem
in subsequent notes, and produce a final note pointing to the parameter.

---
[clang] CWG2398: improve overload resolution backwards compat

With this change, we discriminate if the primary template and which partial
specializations would have participated in overload resolution prior to
P0522 changes.

We collect those in an initial set. If this set is not empty, or the
primary template would have matched, we proceed with this set as the
candidates for overload resolution.

Otherwise, we build a new overload set with everything else, and proceed
as usual.

---
[clang] Implement TTP 'reversed' pack matching for deduced function template calls.

Clang previously missed implementing P0522 pack matching
for deduced function template calls.
2025-01-23 20:37:33 -03:00
Min-Yih Hsu
bc74a1edbe
[IA] Generalize the support for power-of-two (de)interleave intrinsics (#123863)
Previously, AArch64 used pattern matching to support
llvm.vector.(de)interleave of 2 and 4; RISC-V only supported
(de)interleave of 2.

This patch consolidates the logics in these two targets by factoring out
the common factor calculations into the InterleaveAccess Pass.
2025-01-23 15:27:51 -08:00
Igor Kudrin
10772807ab Reapply "[llvm-objcopy][ELF] Add an option to remove notes (#118739)"
This fixes "unused-local-typedef" warnings in 9324e6a7a5.

This adds an option `--remove-note=[name/]type` to selectively delete
notes in ELF files, where `type` is the numeric value of the note type
and `name` is the name of the originator. The name can be omitted, in
which case all notes of the specified type will be removed. For now,
only `SHT_NOTE` sections that are not associated with segments are
handled. The implementation can be extended later as needed.

RFC: https://discourse.llvm.org/t/rfc-llvm-objcopy-feature-for-editing-notes/83491
2025-01-23 15:22:04 -08:00
Valentin Clement (バレンタイン クレメン)
3d59e30cbc
[flang][cuda] Allow DO CONCURRENT in cuf kernel (#124190) 2025-01-23 15:09:39 -08:00
Valentin Clement (バレンタイン クレメン)
4065d985ab
[flang][cuda] Allow complex type in cuf kernel reduce (#124185) 2025-01-23 15:09:24 -08:00
vporpo
c7053ac202
[SandboxVec][BottomUpVec] Disable crossing BBs (#124039)
Crossing BBs is not currently supported by the structures of the
vectorizer. This patch fixes instances where this was happening,
including:
- a walk of use-def operands that updates the UnscheduledSuccs counter,
- the dead instruction removal is now done per BB,
- the scheduler, which will reject bundles that cross BBs.
2025-01-23 15:08:13 -08:00
Igor Kudrin
621e5cd820 Revert "[llvm-objcopy][ELF] Add an option to remove notes (#118739)"
This reverts commit 9324e6a7a5c5adc5b5c38c3e3cbecd7e1e98876a.
2025-01-23 14:57:29 -08:00
Lang Hames
4f0325873f [ORC] Enable JIT support for the compact-unwind frame info format on Darwin.
For Darwin/arm64 (including Apple Silicon Macs) this will enable exception
handling and stack unwinding in JIT'd code.

Darwin supports two unwind-info formats: DWARF eh-frames and compact-unwind. On
Darwin/x86-64 compilers usually produce both by default, and ORC supported
exceptions and unwinding via eh-frames (same as on Linux), discarding the
redundant compact-unwind info. On Darwin/arm64 compilers typically default to
producing compact-unwind only, with DWARF eh-frames as a fallback for functions
that can't be described in compact-unwind. Since ORC did not previously support
the compact-unwind format and eh-frames were not present ORC was unable to
handle exceptions or unwinding by default in Darwin/arm64 JIT'd code.

This patch enables support for the compact-unwind-info format, and contains
three major moving parts:

(1) The JITLink CompactUnwindManager class is responsible for transforming the
    __compact_unwind records produced by the linker into the __unwind_info
    tables that libunwind parses during unwinding. To enable this the
    CompactUnwindManager class provides three JITLink passes: The
    prepareForPrune pass that splits the __compact_unwind section into
    single-record blocks, allowing unused records to be dead-stripped; the
    processAndReserveUnwindInfo pass that reserves space for the final
    __unwind_info section, and the writeUnwindInfo pass that writes the
    __unwind_info section.

(2) The OrcTargetProcess UnwindInfoManager class maintains a table of
    registered JIT'd __unwind_info and __eh_frame sections, and handles
    requests from libunwind for unwind info sections (by registering a callback
    with libunwind's __unw_add_find_dynamic_unwind_sections function).

(3) The Orc UnwindInfoRegistrationPlugin, which scans LinkGraphs for
    __unwind_info and __eh_frame sections to register with the
    UnwindInfoManager.

This commit adds the CompactUnwindManager passes to the default JITLink
pipelines for Darwin/arm64 and Darwin/x86-64, and UnwindInfoManager intances to
the SelfExecutorProcessControl class (when built for apple platforms) and the
llvm-jitlink-executor tool.

The LLJIT class will now create an UnwindInfoRegistrationPlugin when targeting
a process running on Darwin if it detects that an UnwindInfoManager is
available to handle the registrations.

The ORC runtime macho_platform class already supported libunwind callbacks, so
out-of-process execution and unwinding support will work when loading the ORC
runtime.

The llvm-jitlink tool will only support compact-unwind when the orc-runtime is
loaded, as the UnwindInfoRegistrationPlugin requires access to an IR compiler
to load a helper module and llvm-jitlink does not provide an IR compiler.
2025-01-23 22:55:01 +00:00
Heejin Ahn
25825d4ac9
[WebAssembly] Enable Wasm EH features only once (#124042)
#122466 had an unexpected side effect that,
`EnableFeaturesForWasmEHSjLj` and `BanIncompatibleOptionsForWasmEHSjLj`
can be called multiple times now, every time a Wasm EH flag
(`-fwasm-exceptions`, `-wasm-enable-eh`, `-wasm-enable-sjlj`, ..) was
checked and handled. This resulted in unnecessarily adding the same
feature-enabling arguments multiple times to the command line, for
example, `-target-feature +exception-handling` could be added as many as
three times, which didn't cause any errors but unnecessary. Also we ran
`BanIncompatibleOptionsForWasmEHSjLj` more than once, which was harmless
but unnecessary.

This guards these functions with a static variable so that we only run
them once.
2025-01-23 14:47:15 -08:00
David Blaikie
42043c423f Reapply "Verifier: Add check for DICompositeType elements being null"
This remove some erroneous debug info from tests that should address the
test failures that showed up when the this was previously committed.

This reverts commit 6716ce8b641f0e42e2343e1694ee578b027be0c4.
2025-01-23 22:29:30 +00:00
Igor Kudrin
9324e6a7a5
[llvm-objcopy][ELF] Add an option to remove notes (#118739)
This adds an option `--remove-note=[name/]type` to selectively delete
notes in ELF files, where `type` is the numeric value of the note type
and `name` is the name of the originator. The name can be omitted, in
which case all notes of the specified type will be removed. For now,
only `SHT_NOTE` sections that are not associated with segments are
handled. The implementation can be extended later as needed.


RFC: https://discourse.llvm.org/t/rfc-llvm-objcopy-feature-for-editing-notes/83491
2025-01-23 14:27:40 -08:00
Michael Maitland
f5bd623d06 [RISCV][VLOPT] Rename vx to vf where appropriate in test case 2025-01-23 14:02:15 -08:00
Vitaly Buka
0e213834df
Revert "[LoopVectorizer] Add support for chaining partial reductions (#120272)" (#124198)
Introduced stack buffer overflow, see #120272.

`getScaledReduction` can return empty vector, and there is not check for
that.

This reverts commit c9b7303b9b18129c4ee6b56aaa2a0a9f59be2d09.
This reverts commit caf0540b91b0fee31353dc7049ae836e0f814cff.
2025-01-23 14:00:33 -08:00
David Green
fc952b2a69 [AArch64] Add pre-index store patterns for bf16.
These, like the postinc patterns, need adding very similarly to fp16.

Fixes #97870
2025-01-23 21:52:20 +00:00
Michael Maitland
bf258dbd57
[RISCV][VLOPT] support fp sign injection instructions (#124195) 2025-01-23 16:50:35 -05:00
Michael Maitland
f402e06e7d
[RISCV][VLOPT] Add vector fp min/max instructions to isSupportedInstr (#124196) 2025-01-23 16:47:14 -05:00
Ellis Hoag
d87441a242
[llvm-profdata] Fix detailed summary format on Windows (#124169)
The detailed summary format was changed in
https://github.com/llvm/llvm-project/pull/105915 which broke
`llvm/test/tools/llvm-profdata/general.proftext` (XFAILed in
https://github.com/llvm/llvm-project/pull/124165). Apparently the
behavior of `%lu` is different between Linux and Windows, so I reverted
back to using `<<` style formats.
2025-01-23 13:46:26 -08:00
Nick Desaulniers
631a6e0004
[libc][wchar] implement wcslen (#124150)
Update string_utils' string_length to work with char* or wchar_t*, so that it
may be reusable when implementing wmemchr, wcspbrk, wcsrchr, wcsstr.

Link: #121183
Link: #124027

Co-authored-by: Nick Desaulniers <ndesaulniers@google.com>

---------

Co-authored-by: Tristan Ross <tristan.ross@midstall.com>
2025-01-23 13:33:04 -08:00
Benjamin Kramer
3ed28bbf19 [bazel] Generate CXX11AttributeInfo.inc for 4018317407006b2c632fbb75729de624a2426439 2025-01-23 22:13:46 +01:00
mingmingl
1688c8719f s/requires/REQUIRES to fix the test on release build 2025-01-23 12:59:42 -08:00
Jeffrey Byrnes
f2942b9077
[CodeGen] NFC: Move isDead to MachineInstr (#123531)
Provide isDead interface for access to ad-hoc isDead queries.
LivePhysRegs is optional: if not provided, pessimistically check
deadness of a single MI without doing the LivePhysReg walk; if provided
it is assumed to be at the position of MI.
2025-01-23 12:54:29 -08:00
Craig Topper
76ed4b1cec
[TableGen] Add StringInit pools to RecordKeeperImpl::dumpAllocationStats. (#124164)
Remove duplicate print of TheBitsInitPool.

I don't know who or what uses this information. I happened to notice
TheBitsInitPool was printed twice which lead to auditing the whole list.
2025-01-23 12:53:13 -08:00
Craig Topper
e30a4fc3e2
[TargetLowering] Improve one signature of forceExpandWideMUL. (#123991)
We have two forceExpandWideMUL functions. One takes the low and high
half of 2 inputs and calculates the low and high half of their product.
This does not calculate the full 2x width product.

The other signature takes 2 inputs and calculates the low and high half
of their full 2x width product. Previously it did this by sign/zero
extending the inputs to create the high bits and then calling the other
function.

We can instead copy the algorithm from the other function and use the
Signed flag to determine whether we should do SRA or SRL. This avoids
the need to multiply the high part of the inputs and add them to the
high half of the result. This improves the generated code for signed
multiplication.

This should improve the performance of #123262. I don't know yet how
close we will get to gcc.
2025-01-23 12:49:35 -08:00