Commit Graph

541398 Commits

Author SHA1 Message Date
Pengcheng Wang
602c3089f7 [TargetParser] Increase MAX_SUBTARGET_FEATURES to 384 (#144326)
There are 314 features in RISC-V backend, which is about to exceed
the maxinum 320 as there are some ongoing new extensions.

We increase the `MAX_SUBTARGET_FEATURES` to 384 so that we won't
surprise anyone.
2025-06-17 11:17:37 +08:00
Jim Lin
9093bc7eff [llvm-exegesis] Ignore the instructions for which InstrDesc.getSchedClass() == 0 (#143840)
This allows llvm-exegesis to skip instructions that lack scheduling
information, avoiding invalid benchmarking. e.g. `InstB` in RISC-V.
2025-06-17 10:57:36 +08:00
Slava Zakharin
ab7aaaca93 [flang][tests] Remove stale module files to fix buildbots. 2025-06-16 19:50:43 -07:00
Jinyang He
2e3d212e40 [LoongArch] Allow difference across sections (#141722)
For SecA != SecB but SecB is current section, fallback for pcrel{64,32}
relocations. For linker relaxation being disabled and SecA == SecB,
return directly for avoid record relocations. In other cases, record
relocations which also allows across sections.
2025-06-17 10:41:08 +08:00
Rahul Joshi
f626620e33 [LLVM][TableGen] Use StringRef for CodeGenInstruction::AsmString (#144440) 2025-06-16 18:19:17 -07:00
Matt Arsenault
8b1528fad9 RuntimeLibcalls: Use array initializers for default values (#143082) 2025-06-17 10:00:41 +09:00
Bryan Chan
d4e2c0b359 [Driver] Add options to control workaround for Cortex-A53 Erratum 843419 (#143915)
Implement the -mfix-cortex-a53-843419 and -mno-fix-cortex-a53-843419 options,
which have been introduced to GCC to allow the user to control the workaround
for the erratum. If the option is enabled (which is the default, unchanged by
this patch), Clang passes --fix-cortex-a53-843419 to the linker when it cannot
ensure that the target is not a Cortex A53, otherwise it doesn't.

See https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html#index-mfix-cortex-a53-843419
for information on the GCC options.
2025-06-16 20:59:18 -04:00
Matt Arsenault
6e8cf9c63f AArch64: Add arm64ec libcall tests for __arm_sc_* functions (#144356) 2025-06-17 09:55:41 +09:00
Matt Arsenault
24631e5440 AArch64: Fix outline atomic libcall names for arm64ec (#144378)
Add a missing # prefix to each libcall name
2025-06-17 09:52:50 +09:00
Matt Arsenault
9bd234a433 AArch64: Move outline atomic libcalls configuration (#144374)
This de-conditionalizes the setting of the libcall names
on outlineAtomics() && !hasLSE(). The existence of the
libcall is a module level property, which cannot depend on the
subtarget so this is fine. It's better if the initial list of
calls has more entries than will be used than to have missing
ones. There aren't any alternative names set, so this is also
fine.

Currently RuntimeLibcallsInfo conflates the existence of the calls
with the lowering usage decision, so this suboptimally will report
the libcall name on subtargets that should not use the calls. This
doesn't matter in this case though, as the atomic lowering actions
are already separately controlled and aren't based on decisions on
libcall availability. We could be paranoid and clear the names in
TargetLowering.

Also fixes not catching all aarch64 triples in the RuntimeLibcallsInfo
construction; the previous check missed aarch64_be.
2025-06-17 09:49:55 +09:00
Matt Arsenault
1ffd9f553c RuntimeLibcalls: Cleanup sincos predicate functions (#143081)
The darwinHasSinCos wasn't actually used for sincos, only the stret
variant. Rename this to reflect that, and introduce a new one for
enabling sincos.
2025-06-17 09:46:17 +09:00
Matt Arsenault
97bfb936af DAG: Move soft float predicate management into RuntimeLibcalls (#142905)
Work towards making RuntimeLibcalls the centralized location for
all libcall information. This requires changing the encoding from
tracking the ISD::CondCode to using CmpInst::Predicate.
2025-06-17 09:42:53 +09:00
John Harrison
6421bd94ea [lldb-dap] Creating protocol types for setExceptionBreakpoints. (#144153)
This adds new types for setExceptionBreakpoints and adds support for
`supportsExceptionFilterOptions`, which allows exception breakpoints to
set a condition.

While testing this, I noticed that obj-c exception catch breakpoints may
not be working correctly in lldb-dap.
2025-06-16 17:24:48 -07:00
PiJoules
d882670d49 Revert "[llvm][StackProtector] Add noreturn to __stack_chk_fail call" (#144452)
Reverts llvm/llvm-project#143976

Reverting since this broke a builder:
https://lab.llvm.org/buildbot/#/builders/190/builds/21563
2025-06-16 16:34:40 -07:00
Slava Zakharin
ac7af53d05 [flang] Fixed LIT tests to create modfiles in a temp dir. (#144448) 2025-06-16 16:26:03 -07:00
PiJoules
964888d01f [llvm][CFI] Ensure COFF comdat renaming applies for imported functions (#143421)
I ran into the same issue as
https://github.com/llvm/llvm-project/pull/139962 regarding the comdat
corresponding to a renamed key function but for thinlto. My last patch
had not considered the thinlto case, so this applies the same fix for
imported functions.
2025-06-16 16:24:45 -07:00
PiJoules
99e53cb413 [llvm][StackProtector] Add noreturn to __stack_chk_fail call (#143976)
It's possible for __stack_chk_fail to be an alias when using CrossDSOCFI
since it will make a jump table entry for this function and replace it
with an alias. StackProtector can crash since it always expects this to
be a regular function. Instead add the noreturn attribute to the call.
2025-06-16 15:47:43 -07:00
sribee8
6e12442354 Revert "[libc] utf8 to 32 CharacterConverter" (#144446)
Reverts llvm/llvm-project#143973
This merge broke the build and I'm currently looking into the issue to
fix it.
2025-06-16 22:33:32 +00:00
sribee8
98eee4b554 [libc] utf8 to 32 CharacterConverter (#143973)
Implemented push and pop for utf8 to 32 conversion and tests.

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-06-16 22:20:08 +00:00
Daniel Paoliello
2488f26d15 [win][x64] Unwind v2 3/n: Add support for requiring unwind v2 to be used (equivalent to MSVC's /d2epilogunwindrequirev2) (#143577)
#129142 added support for emitting Windows x64 unwind v2 information,
but it was "best effort". If any function didn't follow the requirements
for v2 it was silently downgraded to v1.

There are some parts of Windows (specifically kernel-mode code running
on Xbox) that require v2, hence we need the ability to fail the
compilation if v2 can't be used.

This change also adds a heuristic to check if there might be too many
unwind codes, it's currently conservative (i.e., assumes that certain
prolog instructions will use the maximum number of unwind codes).

Future work: attempting to chain unwind info across multiple tables if
there are too many unwind codes due to epilogs and adding a heuristic to
detect if an epilog will be too far from the end of the function.
2025-06-16 15:06:41 -07:00
Morris Hafner
4bcf9732c7 [CIR] Add Support For Library Builtins (#143984)
This patch upstreams support for builtins that map to a standard library
function. Examples would be abort() and printf().

It also fixes a minor issue with the errorNYI for all remaining
unimplemented builtins using the mlir::Location instead of the clang AST
SourceLocation.
2025-06-16 23:03:49 +01:00
Florian Hahn
30b16ec341 [VPlan] Simplify trivial VPFirstOrderRecurrencePHI recipes.
VPFirstOrderRecurrencePHIRecipes where the incoming values are the same
can be simplified and removed.

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

The new test is added together with other related tests from
first-order-recurrence.ll
2025-06-16 22:54:26 +01:00
Finn Plummer
a383b1a95b Reland "[HLSL][RootSignature] Implement serialization of RootConstants and RootFlags" (#143019)
This relands #141130.

The initial commit uncovered that we are missing the correct linking of
FrontendHLSL into clang/lib/Parse and clang/lib/unittests/Parse.

This change addreses this by linking them accordingly.

It was also checked and ensured that the LexHLSLRootSignature libraries
do not depend on FrontendHLSL and so we are not required to link there.

Resolves: #138190 and #138192
2025-06-16 14:52:59 -07:00
Vlad Lazar
6cbb67f84c [mlir][emitc] Fix the emitc::ExpressionOp (#143894)
Fix the lack of verification that the definingOp of the return value
belongs to emitc::ExpressionOp.
2025-06-16 23:51:49 +02:00
Peter Klausler
2bf3ccabfa [flang] Restructure runtime to avoid recursion (relanding) (#143993)
Recursion, both direct and indirect, prevents accurate stack size
calculation at link time for GPU device code. Restructure these
recursive (often mutually so) routines in the Fortran runtime with new
implementations based on an iterative work queue with
suspendable/resumable work tickets: Assign, Initialize, initializeClone,
Finalize, and Destroy.

Default derived type I/O is also recursive, but already disabled. It can
be added to this new framework later if the overall approach succeeds.

Note that derived type FINAL subroutine calls, defined assignments, and
defined I/O procedures all perform callbacks into user code, which may
well reenter the runtime library. This kind of recursion is not handled
by this change, although it may be possible to do so in the future using
thread-local work queues.

(Relanding this patch after reverting initial attempt due to some test
failures that needed some time to analyze and fix.)

Fixes https://github.com/llvm/llvm-project/issues/142481.
2025-06-16 14:37:01 -07:00
Peter Klausler
65b06cd983 [flang][runtime] Check SOURCE= conformability on ALLOCATE (#144113)
The SOURCE= expression of an ALLOCATE statement, when present and not
scalar, must conform to the shape of the allocated objects. Check this
at runtime, and return a recoverable error, or crash, when appropriate.

Fixes https://github.com/llvm/llvm-project/issues/143900.
2025-06-16 14:36:35 -07:00
Peter Klausler
9c25ca78f9 [flang] Don't generate module file for hermetic USE'd dependency (#144143)
It's possible for the module file generation code to think that it needs
to (re)generate a module file for a dependent module read from a
hermetic module file, if it defines contains a procedure imported via
renaming due to a name clash. Adjust the logic that determines whether a
module file should be written to include a check for having originated
in a module file.
2025-06-16 14:36:13 -07:00
Justin King
95418bc8a8 lsan: Support free_sized and free_aligned_sized from C23 (#144415)
Adds support to LSan for `free_sized` and `free_aligned_sized` from C23.

Other sanitizers will be handled with their own separate PRs.

For #144435

Signed-off-by: Justin King <jcking@google.com>
2025-06-16 14:29:08 -07:00
Uzair Nawaz
38daa6d4ef [libc] build fix: always use our char8_t headers even in overlay mode (#144433)
Build fix caused by certain platforms not providing char8_t when
expected
Temporary fix to just always use our own definition, even in overlay
mode.
2025-06-16 21:28:51 +00:00
Yuta Saito
60a59e350b [ASan] Recognize WASI platform in sanitizer_platform.h (#139017) 2025-06-17 06:23:50 +09:00
Steven Perron
a027eb4472 [HLSL] Use hidden visibility for external linkage. (#140292)
Implements

https://github.com/llvm/wg-hlsl/blob/main/proposals/0026-symbol-visibility.md.

The change is to stop using the `hlsl.export` attribute. Instead,
symbols with "program linkage" in HLSL will have export linkage with
default visibility, and symbols with "external linkage" in HLSL will
have export linkage with hidden visibility.
2025-06-16 16:44:55 -04:00
Ebuka Ezike
34be09ad73 [lldb-dap][test] fix not supported error. (#144419)
Fixes #144072 

buildbot error.
2025-06-16 21:18:21 +01:00
Florian Hahn
d3bc834ece [LV] Update check to find epilogue resume value to check all incoming.
This fixes a crash where all incoming values for the epilogue resume
value are zero, because there are no remaining iterations to execute for
the epilogue loop.
2025-06-16 21:10:12 +01:00
Kazu Hirata
1e60dd4f23 [lldb] Fix a warning
This patch fixes:

  lldb/tools/lldb-dap/Handler/StepInTargetsRequestHandler.cpp:89:2:
  error: extra ';' outside of a function is incompatible with C++98
  [-Werror,-Wc++98-compat-extra-semi]
2025-06-16 13:09:57 -07:00
Uzair Nawaz
8adccaee2a [libc] Implemented CharacterConverter push/pop for utf32->utf8 conversions (#143971)
Implemented CharacterConverter methods for conversion between utf32 ->
utf8
Added tests

---------

Co-authored-by: Michael Jones <michaelrj@google.com>
2025-06-16 20:06:46 +00:00
DrSergei
a637584fad [lldb-dap] Add supported languages in package.json (#144414)
This patch fixes the [problem]. It was caused by missing supported
languages list in `package.json`. VSCode uses `guessDebugger` [function]
to find supported debuggers based on supported languages in case of
opened file. It uses `interestedInLanguage` [function][1] to do that, so
we should provide list of supported languages. Also, fixed typo in
`fortran`.

[problem]: https://github.com/llvm/llvm-project/issues/144239
[function]: https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/debug/browser/debugAdapterManager.ts#L344
[1]: https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/debug/common/debugger.ts#L171
2025-06-16 14:56:02 -05:00
Matthias Braun
b0378e7ca9 [AArch64TargetParser]Fix reconstructFromParsedFeatures ignoring negative features (#142236)
The `targetFeatureToExtension` function used by
reconstructFromParsedFeatures only found positive `+FEATURE` strings,
but not negative `-FEATURE` strings. Extend the function to handle both
to fix `reconstructFromParsedFeatures`.
2025-06-16 12:55:12 -07:00
Philip Reames
25781221d6 [instcombine] Delete dead transform for reverse of binop (#143967)
We canonicalize reverse to after a binop in foldVectorBinop, and
simplify reverse pairs in InstSimplify, so these elimination transforms
are redundant.
2025-06-16 12:43:13 -07:00
William Huynh
402c376daa [libc] Change default behaviour of baremetal/printf to use stdout (#143703)
In #94078, `write_to_stdout` had not been fully implemented. However,
now that it has been implemented, to conform with the C standard
(7.23.6.3. The printf function, specifically point 2), we use `stdout`.
This issue is tracked in #94685.

- Also prefer `static constexpr`
- Made it explicit that we are writing to `stdout`
2025-06-16 12:22:58 -07:00
Daniel Rodríguez Troitiño
a0662ceba8 [objcopy][MachO] Revert special handling of encryptable binaries (#144058)
Code originally added in #120995 and later corrected in #130517 but
apparently still not correct according to #141494 and
rust-lang/rust#141913.

Revert the special handling because the test written in #120995 and
#130517 still passes without those changes. Kept the test and improved
it with a `__DATA` section to keep the current behaviour checked in case
other changes modify the behaviour and break this edge case.
2025-06-16 12:06:25 -07:00
Diego Caballero
a00b736a79 [mlir][Vector] Support vector.extract(xfer_read) folding with dynamic indices (#143269)
This PR is part of the last step to remove `vector.extractelement` and `vector.insertelement` ops.
RFC: https://discourse.llvm.org/t/rfc-psa-remove-vector-extractelement-and-vector-insertelement-ops-in-favor-of-vector-extract-and-vector-insert-ops

It adds support for folding `vector.transfer_read(vector.extract) ->
memref.load` with dynamic indices, which is currently supported by
`vector.extractelement`.
2025-06-16 12:05:20 -07:00
Scott Linder
e8362234f6 [Object][AMDGPU] Support REL relocations (#143966)
Shaders compiled with DXC/LLPC generate these relocations, and even if
that changes in the future we want to handle existing binaries. The
friction to support this and the maintenance cost long term both seem
incredibly low, considering other targets like ARM support both REL/RELA
static relocations behind the same interface.
2025-06-16 15:03:02 -04:00
Aaron Ballman
f83d09a1f6 Revert "[RISCV] Remove B and Zbc extension from Andes series cpus." (#144402)
Reverts llvm/llvm-project#144022

This has been failing postcommit CI for two days:
https://lab.llvm.org/buildbot/#/builders/63
2025-06-16 14:53:15 -04:00
Aaron Ballman
fcc10e55ca Remove unnecessary BOM from file; NFC
Fixes #144373
2025-06-16 14:52:48 -04:00
Finn Plummer
63b80dd01d [NFC][RootSignature] Use llvm::EnumEntry for serialization of Root Signature Elements (#144106)
It has pointed out
[here](https://github.com/llvm/llvm-project/pull/143198#discussion_r2132877388)
that we may be able to use `llvm::EnumEntry` so that we can re-use the
printing logic across enumerations.

- Enables re-use of `printEnum` and `printFlags` methods via templates
- Allows easy definition of `getEnumName` function for enum-to-string
conversion, eliminating the need to use a string stream for constructing
the Name SmallString

- Also, does a small fix-up of the operands for descriptor table clause
to be consistent with other `Build*` methods

For reference, the
[test-cases](https://github.com/llvm/llvm-project/blob/main/llvm/unittests/Frontend/HLSLRootSignatureDumpTest.cpp)
that must not change expected output.
2025-06-16 11:45:19 -07:00
Jon Roelofs
8ed43c47de [Matrix] Hoist IRBuilder<> out of Visit* functions. NFC (#144369) 2025-06-16 11:38:27 -07:00
Rahman Lavaee
0058272876 [NFC] Remove unused test code from ELFObjectFileTest.cpp 2025-06-16 11:27:25 -07:00
Andy Kaylor
b5c6245cb4 [CIR][NFC] Refactor constant pointer l-value handling (#144165)
This change introduces a ConstantLValueEmitter class, which will be
needed for emitting CIR for non-trivial constant pointers. This change
introduces the class with most branches reaching an NYI diagnostic. The
only path that is currently implemented is the case where an absolute
pointer (usually a null pointer) is emitted. This corresponds to the
existing handler for emitting l-value constants.
2025-06-16 11:26:23 -07:00
Ebuka Ezike
539cf82425 [lldb-dap] Use structured types for stepInTargets request (#144072)
uses the `SendTargetCapabilities` from #142831
2025-06-16 19:24:59 +01:00
Craig Topper
a3d35b87ea [RISCV] Use RISCV::RVVBitsPerBlock instead of 64 in getLMUL1VT. NFC (#144401) 2025-06-16 11:24:33 -07:00