Commit Graph

541104 Commits

Author SHA1 Message Date
Aaron Ballman
ddea4fe85a Fix some "not all control paths return" warnings; NFC 2025-06-16 07:51:25 -04:00
Rolf Morel
e00853859e [MLIR][Transform] apply_registered_pass: support ListOptions (#144026)
Interpret an option value with multiple values, either in the form of an
`ArrayAttr` (either static or passed through a param) or as the multiple
attrs associated to a param, as a comma-separated list, i.e. as a
ListOption on a pass.
2025-06-16 12:40:50 +01:00
Yingwei Zheng
299a55a88f [InstCombine][Docs] Update InstCombine contributor guide (#144228)
Update the guideline to reduce the chance of miscompilation/performance
regression.

---------

Co-authored-by: Nikita Popov <github@npopov.com>
Co-authored-by: Antonio Frighetto <me@antoniofrighetto.com>
2025-06-16 18:07:27 +08:00
Nikita Popov
3824a2dbce [MemoryBuiltins] Support allocas in getInitialValueOfAllocation (NFC) 2025-06-16 11:52:16 +02:00
Simon Pilgrim
b2bf017acd [X86] X86FixupInstTuning - prefer VPBLENDD to VPBLENDW shuffles on AVX2+ targets (#144269)
On many Intel AVX2 targets (Haswell+), VPBLENDD has notably better throughput than VPBLENDW - and the remaining Intel/AMD targets have no preference.

This patch replaces VPBLENDW shuffles if the shuffle mask can be safely widened from vXi16 to vXi32 and that the scheduler model doesn't consider it a regression (I haven't found any target where this is true, but we should retain the model check).

Noticed while working on #142972 where VMOVSS nodes were regressing to VPBLENDW nodes during domain switching.
2025-06-16 10:31:24 +01:00
Oliver Hunt
eddab9b757 [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (#143969)
This adds a number of functions to ASTContext to query whether a
type contains data protected with address discriminated pointer
authentication, and whether the protected values are just vtable
pointers, or if there are other address discriminated types included.

For the standardized version, __builtin_is_cpp_trivially_relocatable
this means accepting types where the only address discriminated
values are vtable pointers. Other address discriminated types are
not considered relocatable. In addition to that any union containing
any address discriminated data, including vtable pointers, is not
relocatable.

For the old deprecated __builtin_is_trivially_relocatable we reject
any type containing any address discriminated value, as it is
semantically intended as being a "is this memcopyable" which is
not true for anything with address discrimination.

This PR does not update the codegen for __builtin_trivially_relocate,
that will be in a follow on PR that is much more complex.
2025-06-16 12:12:22 +03:00
Nikolas Klauser
79a2b15a4c [libc++] Remove a few workarounds for old Clang versions (#143858) 2025-06-16 11:12:15 +02:00
David Sherwood
a75e0627f9 [LV] Use vscale for tuning when updating profile information (#143690)
In fixVectorizedLoop we call setProfileInfoAfterUnrolling to update the
profile information after vectorising, however for scalable VFs we
pessimistically assume vscale=1. We can improve upon this by using the
value of vscale used for tuning, i.e. when targeting neoverse-v1 the
expected value is 2.
2025-06-16 10:02:38 +01:00
Sam Tebbs
3dd61c1876 [LV] Fix MVE regression from #132190 (#141736)
Register pressure was only considered if the vector bandwidth was being
maximised (chosen either by the target or user options), but #132190
inadvertently caused high pressure VFs to be pruned even when max
bandwidth wasn't enabled. This PR returns to the previous behaviour.
2025-06-16 09:58:03 +01:00
Ricardo Jesus
f12dd8f86a [ValueTracking] Remove unused variable in matchSimpleRecurrence (NFC). (#144316) 2025-06-16 09:57:21 +01:00
Javier Lopez-Gomez
383b326879 [llvm-debuginfo-analyzer] Fix ODR violation in llvm::logicalview::LVObject (#140265)
Some data members are only part of a class definition in a Debug build,
e.g. `LVObject::ID`. If `debuginfologicalview` is used as a library,
`NDEBUG` cannot be used for this purpose, as this PP macro may have a
different definition in a downstream project, which in turn triggers an
ODR violation. Fix it by
- Making `LVObject::ID` an unconditional data member.
- Making `LVObject::dump()` non-virtual. Rationale: `virtual` is not
needed (and it calls `print()`, which is virtual anyway).

Fixes #139098.
2025-06-16 10:47:00 +02:00
Paschalis Mpeis
0952992ac6 [BOLT] Fix LLVM_APPEND_VC_REV support (#142410)
The CMake flag LLVM_APPEND_VC_REV can be passed when building BOLT a
BOLT to prevent including a VC Revision. This patch enables this
functionality.

Usage: `-DLLVM_APPEND_VC_REV=OFF` when running CMake.
2025-06-16 09:42:59 +01:00
Ricardo Jesus
cca454b54c [ValueTracking] Remove opcode whitelist from matchSimpleRecurrence. (#144031)
This also patches HashRecognize to avoid it mishandling some opcodes.
2025-06-16 09:12:42 +01:00
Ramkumar Ramachandra
fbade95ebf [LV] Strip unnecessary make_{pair,optional} (NFC) (#141924) 2025-06-16 08:55:46 +01:00
Mariya Podchishchaeva
e61405033b [clang] Fix -fclang-abi-compat for clang 20 (#144109)
The value was known already, but it was parsed as latest which is
incorrect because we are already doing clang 21.
2025-06-16 09:55:22 +02:00
mayanksolanki393
4e0dd007ac [InstCombine] Combine trunc (lshr X, BW-1) to i1 --> icmp slt X, 0 (#142593) (#143846)
Fixes #142593, the issue was fixed using the suggestion on the ticket
itself.

Godbolt: https://godbolt.org/z/oW5b74jc4
alive2 proof: https://alive2.llvm.org/ce/z/QHnD7e
2025-06-16 09:46:52 +02:00
Fangrui Song
ee2d7a6975 MIPS: Remove unneeded printImpl
Follow-up to 05a9ad9776
2025-06-16 00:35:18 -07:00
Fangrui Song
0bb4d9c302 ARM: Migrate to the new relocation specifier representation
Use MCSpecifierExpr directly and remove the ARMMCExpr subclass. Define
printImpl and evaluateAsRelocationImpl within ARM*MCAsmInfo classes.
While there is some duplication, it enables better separation for
object file formats.
2025-06-16 00:21:14 -07:00
Henrich Lauko
9fcd14d9b0 [MLIR][ODS] Optionally generate public C++ functions for attribute constraints (#144275)
Add `gen-attr-constraint-decls` and `gen-attr-constraint-defs`, which
generate public C++ functions for attribute constraints. The name of the C++
function is specified in the `cppFunctionName` field.

This generalize `cppFunctionName` from `TypeConstraint` introduced in
 https://github.com/llvm/llvm-project/pull/104577 to be usable also in `AttrConstraint`.
2025-06-16 09:21:05 +02:00
Eli Friedman
222ab28a92 [aarch64] Fix Arm64EC libcall lowering after recent refactoring. (#143977)
The refactored code accidentally tokenized a string instead of just
concatenating it.

Add a regression test and some assertions to ensure consistency.

Fixes #143890 .
2025-06-16 00:15:06 -07:00
Sudharsan Veeravalli
7d9a451d87 [RISCV] Change input register type for QC_SWM and QC_SWMI (#144294)
Version 0.13 of the `Xqci` spec changes the register type of input
operand `rs3` from `GPR` to `GPRNoX0` for these two instructions.

The spec can be found at
https://github.com/quic/riscv-unified-db/releases/tag/Xqci-0.13.0
2025-06-16 12:28:12 +05:30
Jim Lin
f875efe1d8 [RISCV] Use GetVTypeMinimalPredicates instead of GetVTypePredicates for vrgatherei16/vslideup/vslidedown. NFC. 2025-06-16 14:41:19 +08:00
David Green
7efc861ec4 [AArch64][GlobalISel] Add test coverage for fdiv-combine.ll. NFC 2025-06-16 07:29:18 +01:00
Fangrui Song
f3021e79fd ARM: Rename ARMMCExpr::VK_ to ARM::S_
Prepare for removing ARMMCExpr. Adopt the new naming convention (S_
instead of VK_; the relocation specifier was previously named
`VariantKind`)) used by most other targets.

Make ARMMCAsmInfo.h include ARMMCExpr.h and change .cpp files to include
ARMMCAsmInfo.h. We will eventually remove ARMMCExpr.h.
2025-06-15 23:29:07 -07:00
Timm Baeder
4f9e6bad84 [clang][bytecode] Fix calling operator new with nothrow/align parameter (#144271)
Discard all the parameters we don't care about.
2025-06-16 08:28:52 +02:00
Fangrui Song
4ea616d072 AArch64: Move AArch64MCExpr functions to AArch64MCAsmInfo
To migrate away from the legacy
XXXMCExpr::printImpl/evaluateAsRelocatableImpl overrides and align with
other targets.

While the AArch64MCAsmInfoXXX hooks introduce some duplication, they
enable better separation for object file formats.
2025-06-15 22:41:36 -07:00
LLVM GN Syncbot
945b12f6c8 [gn build] Port 05a9ad9776 2025-06-16 04:53:40 +00:00
Fangrui Song
05a9ad9776 Lanai: Migrate to the new relocation specifier representation
Use MCSpecifierExpr directly and remove the LanaiMCExpr subclass. Define
MCSpecifierExpr::printImpl to print the relocation specifier in decimal
for llvm-mc -show-inst. The output is not guaranteed to be stable.

Depends on f8e0518120
("MC: Adjust -show-inst output for MCExpr")
2025-06-15 21:50:48 -07:00
Fangrui Song
f8e0518120 MC: Adjust -show-inst output for MCExpr
This dump feature does not pass MCAsmInfo to the printer function.
When we remove MCSpecifierExpr subclasses (and the printImpl overrides),
we will not be able to print target-specific specifier strings.
Just print a textual representation.
2025-06-15 21:46:09 -07:00
Fangrui Song
29fcad000c AVR: Replace deprecated MCExpr::print with MCAsmInfo::printExpr 2025-06-15 21:27:12 -07:00
Jim Lin
e2afda6fc9 [RISCV] Fix incorrect predicates for fp16 permutation intrinsics (#144063)
vrgatherei16, vslideup and vslidedown should be supported with fp16 type
for Zvfhmin.

Fixes https://github.com/llvm/llvm-project/issues/143975.
2025-06-16 12:15:30 +08:00
Yingwei Zheng
cab09e76e0 [InstCombine] Propagate FMF from fptrunc when folding fptrunc fabs(X) -> fabs(fptrunc X) (#143352)
Alive2: https://alive2.llvm.org/ce/z/DWV3G3
fptrunc yields infinity when the input cannot fit in the target type. So
ninf should be propagated from fptrunc. For other intrinsics, the
previous check ensures that the result is never an infinity:

5d3899d293/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp (L1910-L1917)

Closes https://github.com/llvm/llvm-project/issues/143122.
2025-06-16 12:07:47 +08:00
Kazu Hirata
c01532177f [clang] Remove unused includes (NFC) (#144285)
These are identified by misc-include-cleaner.  I've filtered out those
that break builds.  Also, I'm staying away from llvm-config.h,
config.h, and Compiler.h, which likely cause platform- or
compiler-specific build failures.
2025-06-15 21:00:36 -07:00
Kazu Hirata
7a4a83b551 [TableGen] Use range-based for loops (NFC) (#144283) 2025-06-15 21:00:29 -07:00
Kazu Hirata
f71fb2dc01 [clang] Use StringRef in range-based for loops (NFC) (#144242)
When we iterate over std::vector<std::string>, we can directly assign
each element to StringRef.  We do not need to go through separate
statements.
2025-06-15 21:00:22 -07:00
Ming-Yi Lai
9adde28df7 [LLD][ELF][RISCV][Zicfilp][Zicfiss] Support -z zicfilp= and -z zicfiss= to force enable/disable features (#143114)
+ If `-z zicfilp=implicit` or option not specified, the output would
have the ZICFILP feature enabled/disabled based on input objects
+ If `-z zicfilp=<never|unlabeled|func-sig>`, the output would have
ZICFILP feature forced <off|on to the "unlabeled" scheme|on to the
"func-sig" scheme>
+ If `-z zicfiss=implicit` or option not specified, the output would
have the ZICFISS feature enabled/disabled based on input objects
+ If `-z zicfiss=<never|always>`, the output would have the ZICFISS
feature forced <off|on>
2025-06-16 11:18:41 +08:00
LLVM GN Syncbot
167223f8c2 [gn build] Port b591f6dad4 2025-06-16 02:26:58 +00:00
Fangrui Song
b591f6dad4 SystemZ: Migrate to newer relocation specifier representation
z/OS creates SystemZMCExpr objects (https://reviews.llvm.org/D153788)
while ELF doesn't. Define the SystemZMCAsmInfoGOFF hooks
instead of the legacy MCSpecifierExpr:: hooks.
2025-06-15 19:26:40 -07:00
Jim Lin
d64ee2cd4f [RISCV] Add GetVTypeMinimalPredicates for the operation supported by zvfhmin. NFC. (#143847)
This patch adds a new `GetVTypeMinimalPredicates` for `f16` operation
supported by `Zvfhmin`. Split the type predicates for minimal support
and full compute support. This is a refactor patch for implementing
vector compute support for bf16 (Zvfbfa), that we can check `bf16` type
whether with `Zvfbfa` extension in `GetVTypePredicates`.
2025-06-16 10:12:51 +08:00
Fangrui Song
cf679e66fa SystemZ: Rename SystemZMCExpr::VK_ to SystemZ::S_
Prepare for removing SystemZMCExpr. Adopt the newer naming convention
used by most other targets.
2025-06-15 18:59:16 -07:00
Fangrui Song
993c158a30 MIPS: Reduce MipsMCExpr uses 2025-06-15 18:46:51 -07:00
Matt Arsenault
ba7369c49c WebAssembly: Move runtime libcall setting out of TargetLowering (#142624)
RuntimeLibcallInfo needs to be correct outside of codegen contexts.
2025-06-16 10:46:05 +09:00
Fangrui Song
f23b841f0f MIPS: Move MipsMCExpr functions to MipsMCAsmInfo 2025-06-15 18:35:07 -07:00
Owen Pan
1506ba95d7 [clang-format][NFC] Clean up DisallowLineBreaks lambda (#144255)
See also
https://github.com/llvm/llvm-project/pull/141576/files#r2141808121
2025-06-15 18:28:06 -07:00
Tom Vijlbrief
ad94f77a6a [AVR] Add many new AVR MCU model definitions (#144229)
1. Added the missing XMEGA2 definition. The avr64 devices use xmega2 which has SPM(X) defined.

2. The avr16/avr32 devices do have SPM and SPMX features, but the current xmega3 definition has not.
   Xmega3 is also used for modern attiny series which do not have SPM(X), so that is correct.
   Leave the avr16/avr32 devices unchanged (using xmega3 to be in sync with gcc definitions).

Fixes https://github.com/llvm/llvm-project/issues/116116
2025-06-16 09:25:40 +08:00
Fangrui Song
d793168e3b MIPS: Rename MipsMCExpr::MEK_ to Mips::S_
Prepare for removing MipsMCExpr. Adopt the newer naming convention (S_)
used by AMDGPU/WebAssembly/VE/M68k/PowerPC/LoongArch/RISCV.
2025-06-15 18:04:23 -07:00
Fangrui Song
c9d511bc64 Replace deprecated MCExpr::print with MCAsmInfo::printExpr 2025-06-15 17:41:17 -07:00
Fangrui Song
22ad0359f9 NVPTX: Replace deprecated MCExpr::print with MCAsmInfo::printExpr 2025-06-15 17:34:31 -07:00
Fangrui Song
178fac3d61 Hexagon: Replace deprecated MCExpr::print with MCAsmInfo::printExpr 2025-06-15 17:31:08 -07:00
Fangrui Song
dca2b261d7 Lanai: Replace deprecated MCExpr::print with MCAsmInfo::printExpr 2025-06-15 17:25:13 -07:00