Commit Graph

535721 Commits

Author SHA1 Message Date
Feng Zou
bd6addc032 [X86][APX] Suppress EGPR/NDD instructions for relocations (#136660)
Suppress EGPR/NDD instructions for relocations to avoid APX relocation
types emitted. This is to keep backward compatibility with old version
of linkers without APX support. The use case is to try APX features with
LLVM + old built-in linker on RHEL9 OS which is expected to be EOL in
2032.
If there are APX relocation types, the old version of linkers would
raise "unsupported relocation type" error. Example:
```
$ llvm-mc -filetype=obj -o got.o -triple=x86_64-unknown-linux got.s
$ ld got.o -o got.exe
ld: got.o: unsupported relocation type 0x2b
...

$ cat got.s
...
movq foo@GOTPCREL(%rip), %r16

$ llvm-objdump -dr got.o
...
1: d5 48 8b 05 00 00 00 00       movq    (%rip), %r16
0000000000000005:  R_X86_64_CODE_4_GOTPCRELX    foo-0x4
```
2025-04-29 19:12:59 +08:00
Aaron Ballman
df267d77f6 [C] Add new -Wimplicit-int-enum-cast to -Wc++-compat (#137658)
This introduces a new diagnostic group to diagnose implicit casts from
int to an enumeration type. In C, this is valid, but it is not
compatible with C++.

Additionally, this moves the "implicit conversion from enum type to
different enum type" diagnostic from `-Wenum-conversion` to a new group
`-Wimplicit-enum-enum-cast`, which is a more accurate home for it.
`-Wimplicit-enum-enum-cast` is also under `-Wimplicit-int-enum-cast`, as
it is the same incompatibility (the enumeration on the right-hand is
promoted to `int`, so it's an int -> enum conversion).

Fixes #37027
2025-04-29 07:06:08 -04:00
Michael Buch
ebeae6402d Reland "[lldb][Format] Make function name frame-format variables work without debug-info" (#137757)
This reverts commit da7099290c.

Same as the original PR. The failing test-case was resolved in https://github.com/llvm/llvm-project/pull/137763
2025-04-29 11:49:21 +01:00
Paul Walker
50d3febf17 [NFC][InstCombine][AArch64] Refactor SVE intrinsics tests.
Only test a single element type because the combines are not sensitive
to them. Extend coverage to cover the majority of SVE merging
intrinsics.
2025-04-29 10:44:08 +00:00
Christian Ulmann
89c5c3ba38 [MLIR][IR] Add assert to Operation::moveBefore (NFC) (#137772)
This commit adds an assert to `Operation::moveBefore` which ensures that
moving of operations without a parent block is detected early on. This
case otherwise runs into a segfault, as it's assumed that there is an
parent block.
2025-04-29 12:38:34 +02:00
Paul Walker
93321966d9 [NFC][InstCombine][AArch64] Add simplify tests for reversed SVE intrinsics.
Add missing tests for fdivr, fsubr, sdivr, subr & udivr.
Add test case to demonstrate incorrect poison propagation.
2025-04-29 10:33:47 +00:00
Jason Eckhardt
e33cf4b078 [TableGen][NFC] Refactor/deduplicate emitAction. (#137434)
Currently there is a fair amount of code duplication in various parts of
emitAction. This patch factors out commonality among CCAssignToReg,
CCAssignToRegAndStack, CCAssignToRegWithShadow, and CCAssignToStack.

`XXXGenCallingConv.inc` are identical before and after this patch for
all targets.
2025-04-29 05:24:23 -05:00
Paul Walker
6edcb52f40 [NFC][InstCombine][AArch64] Remove SVE mul idempotency tests.
They have been subsumed into the SVE binop simplification tests.
2025-04-29 10:03:04 +00:00
Victor Lomuller
082598a64d [SPIRV] Add intrinsic for OpGenericCastToPtrExplicit (#137626)
The patch adds an intrinsic to encode OpGenericCastToPtrExplicit and the
associated lowering logic.
2025-04-29 11:58:25 +02:00
Fraser Cormack
4609b6a3e7 [libclc] Move fmin & fmax to CLC library (#134218)
This is an alternative to #128506 which doesn't attempt to change the
codegen for fmin and fmax on their way to the CLC library.

The amdgcn and r600 custom definitions of fmin/fmax are now converted to
custom definitions of __clc_fmin and __clc_fmax.

For simplicity, the CLC library doesn't provide vector/scalar versions
of these builtins. The OpenCL layer wraps those up to the vector/vector
versions.

The only codegen change is that non-standard vector/scalar overloads of
fmin/fmax have been removed. We were currently (accidentally,
presumably) providing overloads with mixed elment types such as
fmin(double2, float), fmax(half4, double), etc. The only vector/scalar
overloads in the OpenCL spec are those with scalars of the same element
type as the vector in the first argument.
2025-04-29 10:51:24 +01:00
Ramkumar Ramachandra
f6b6fb89ec [VectorUtils] Improve computeMinimumValueSizes (NFC) (#137692)
The Worklist used by computeMinimumValueSizes is wastefully a
Value-vector, when the top of the loop attempts to cast the popped value
to an Instruction anyway. Improve the algorithm by cutting this wasteful
work, refining the type of Worklist, Visited, and Roots from
Value-vectors to Instruction-vectors.
2025-04-29 10:36:26 +01:00
Simon Pilgrim
8961f3ee75 [X86] shouldReduceLoadWidth - don't split loads if we can freely reuse full width legal binop (#129695)
Currently shouldReduceLoadWidth is very relaxed about when loads can be
split to avoid extractions from the original full width load - resulting
in many cases where the number of memory operations notably increases,
replacing the cost of a extract_subvector for additional loads.

This patch adjusts the 256/512-bit vector load splitting metric to
detect cases where ANY use of the full width load is be used directly -
in which case we will now reuse that load for smaller types, unless we'd
need to extract an upper subvector / integer element - i.e. we now
correctly treat (extract_subvector cst, 0) as free.

We retain the existing logic of never splitting loads if all uses are
extract+stores but we improve this by peeking through bitcasts while
looking for extract_subvector/store chains.

This required a number of fixes - shouldReduceLoadWidth now needs to
peek through bitcasts UP the use-chain to find final users (limited to
hasOneUse cases to reduce complexity). It also exposed an issue in
isTargetCanonicalConstantNode which assumed that a load of vector
constant data would always extract, which is no longer the case.
2025-04-29 10:35:15 +01:00
Jack Styles
bb9fa77c84 [ARM][Driver] Fix i8mm feature string (#137771)
#137595 changed the behaviour for SIMD on ARM to ensure it is enabled
and disabled correctly depending on the options used by the user. In
this, the functionality to disable all features that depend on SIMD was
added. However, there was a spelling error for the i8mm feature, which
caused the `+nosimd` command to fail.

This fixes the error, and allows the command to work again.
2025-04-29 10:32:50 +01:00
Carlos Galvez
014ab736dc [clang-tidy] Do not pass any file when listing checks in run_clang_ti… (#137286)
…dy.py

Currently, run_clang_tidy.py does not correctly display the list of
checks picked up from the top-level .clang-tidy file. The reason for
that is that we are passing an empty string as input file.

However, that's not how we are supposed to use clang-tidy to list
checks. Per
65eccb463d,
we simply should not pass any file at all - the internal code of
clang-tidy will pass a "dummy" file if that's the case and get the
.clang-tidy file from the current working directory.

Fixes #136659

Co-authored-by: Carlos Gálvez <carlos.galvez@zenseact.com>
2025-04-29 11:13:30 +02:00
TatWai Chong
3d47bc9d25 [mlir][tosa] Add error if and level checks for COND_IF & WHILE_LOOP (#136194)
Error if checks: verify whether the same length and type between input
list, output list, and control-flow blocks.

Level_checks: verify whether the nested depth exceeds MAX_NESTING.
2025-04-29 10:10:03 +01:00
Michael Buch
252b095b32 [lldb][test] Add more test-cases to MangledTest 2025-04-29 10:07:04 +01:00
Michael Buch
64b5bc876a [lldb][Format] Add function.suffix frame-format variable (#137763)
This patch adds another frame-format variable (currently only
implemented in the CPlusPlus language plugin) that represents the
"suffix" of a function. The name is derived from the `DotSuffix` node of
LLVM's Itanium demangler.

For a function name such as `int foo() (.cold)`, the suffix would be
`(.cold)`.
2025-04-29 10:02:44 +01:00
Brad Smith
76aa471698 Revert "[MIPS] Add Scheduling model for MIPS i6400 and i6500 CPUs (#132704)" (#137767)
This reverts commit ffcca5112b.
2025-04-29 05:01:36 -04:00
Timm Baeder
4bf356bbd2 [clang][bytecode] Start implementing builtin_is_within_lifetime (#137765) 2025-04-29 10:57:30 +02:00
Ramkumar Ramachandra
13b443f2ef [LAA] Improve convergent tests (#136758)
LoopAccessAnalysis has code for handling function calls where the
function is marked with the 'convergent' attribute, but the test
coverage is insufficient. Fix this by adding a test showing the case of
no-runtime-checks adapted from LoopDistribute, and clean up the existing
test with runtime-checks. Also regenerate the test file with
UpdateTestChecks.
2025-04-29 09:50:33 +01:00
Ramkumar Ramachandra
49842426f3 [LV] Fix MinBWs in WidenIntrinsic case (#137005)
There is a bug in the computation and handling of MinBWs in the case of
VPWidenIntrinsicRecipe: a crash is observed in
VPlanTransforms::truncateToMinimalBitwidths due to a mismatch between
the number of recipes processed and the number of entries in MinBWs. Fix
handling of calls in llvm::computeMinimumValueSizes, and handle
VPWidenIntrinsicRecipe in truncateToMinimalBitwidths, fixing the bug.

Fixes #87407.
2025-04-29 09:47:38 +01:00
Timm Baeder
980d027a3f [clang][bytecode] Allow This pointers in CPCE mode (#137761)
The outermost function doesn't have a This pointers, but inner calls
can. This still doesn't match the diagnostic output of the current
interpreter properly, but it's closer I think.
2025-04-29 10:14:15 +02:00
Vikram Hegde
86d8e8d9a6 [CodeGen][NewPM] Port "PrologEpilogInserter" to NPM (#130550) 2025-04-29 13:13:45 +05:30
Matthias Springer
a9b6185718 [mlir][memref] Fix memory leaks in print-memref.mlir (#137590)
This fixes the test when running with ASAN.
2025-04-29 09:42:59 +02:00
Mallikarjuna Gouda
ffcca5112b [MIPS] Add Scheduling model for MIPS i6400 and i6500 CPUs (#132704)
Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6
processor.

i6400 and i6500 share same instruction latencies.

CPU has following pipelines
  - Two ALUs
  - Multiply and Divide unit (MDU)
  - Branch Unit (CTU)
  - Load/Store Unit (LSU)
  - Short Floating-point Unit and
  - Long Floating-point Unit
 
Latency information is available at:
https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf
2025-04-29 03:36:27 -04:00
Kazu Hirata
ff66d34286 [Driver] Simplify string comparisons (NFC) (#137756) 2025-04-29 00:30:59 -07:00
Pavel Labath
a9ece2dc68 [lldb] Skip some Host::GetProcessInfo tests for macos
Some of the tests moved in #134354 do not currently pass on a mac. Disable
them.

The test for testing process priority also does not build on a mac.  I'm not
moving it (back) to the linux, since it's "almost" fine -- we'd just need to
implement the RLIMIT_NICE logic differently. I'm not doing that now since
(apart from linux) there are no systems which are able to retrieve the process
priority.
2025-04-29 09:28:43 +02:00
Jack Styles
ace8ceab73 [ARM][Driver] Ensure NEON is enabled and disabled correctly (#137595)
In #130623 support was added for `+nosimd` in the clang driver.
Following this PR, it was discovered that, if NEON is disabled in the
command line, it did not disable features that depend on this, such as
Crypto or AES. To achieve this, This PR does the following:
- Ensure that disabling NEON (e.g., via +nosimd) also disables dependent
features like Crypto and AES.
- Update the driver to automatically enable NEON when enabling features
that require it (e.g., AES).

This fixes inconsistent behavior where features relying on NEON could be
enabled without NEON itself being active, or where disabling NEON left
dependent features incorrectly enabled.
2025-04-29 08:28:10 +01:00
LLVM GN Syncbot
a618ae2c72 [gn build] Port e43e8ec7af 2025-04-29 06:46:28 +00:00
Nikolas Klauser
e43e8ec7af [libc++] Remove dead implementation of is_nothrow_convertible and merge the remaining code into is_convertible.h (#137717)
We can use the `__is_nothrow_convertible` builtin unconditionally now,
which makes the implementation very simple, so there isn't much of a
need to keep a separate header around.
2025-04-29 08:46:06 +02:00
Pavel Labath
15cd71afd2 [lldb] Make ValueObject::Dereference less aggressive (#137311)
The function was always trying to dereference both the synthetic and
non-synthetic view of the object. This is wrong as the caller should be
able to determine which view of the object it wants to access, as is
done e.g. for child member access.

This patch removes the nonsynthetic->synthetic fallback, which is the
more surprising path, and fixes the callers to try both versions of the
object (when appropriate). I also snuck in simplification of the member
access code path because it was possible to use the same helper function
for that, and I wanted to be sure I understand the logic correctly.

I've left the synthetic->nonsynthetic fallback in place. I think we may
want to keep that one as we often have synthetic child providers for
pointer types. They usually don't provide an explicit dereference
operation but I think users would expect that a dereference operation on
those objects would work. What we may want to do is to try the
*synthetic* operation first in this case, so that the nonsynthetic case
is really a fallback.

---------

Co-authored-by: Ilia Kuklin <kuklin.iy@mail.ru>
2025-04-29 08:27:18 +02:00
Pavel Labath
679cc0a1ed [lldb] Remove Function null checks in Block.cpp (#137611)
As of #117683, Blocks are always enclosed in a function, so these checks
never fail. We can't change the signature of
`CalculateSymbolContextFunction` as it's an abstract function (and some
of its implementations can return nullptr), but we can create a
different function that we can call when we know we're dealing with a
block.
2025-04-29 08:20:08 +02:00
Pavel Labath
ebaeecc429 [lldb] Use early returns in TypeSystemClang::IsPossibleDynamicType (#137630)
Remove a couple of levels of indentation before I need to add another
one to fix a bug.
2025-04-29 08:17:53 +02:00
Michael Buch
da7099290c Revert "[lldb][Format] Make function name frame-format variables work without debug-info" (#137757)
Reverts llvm/llvm-project#137408

This change broke `lldb/test/Shell/Unwind/split-machine-functions.test`.

The test binary has a symbol named `_Z3foov.cold` and the test expects
the backtrace to print the name of the cold part of the function like
this:

```
# SPLIT: frame #1: {{.*}}`foo() (.cold) +
```
but now it gets

```
frame #1: 0x000055555555514f split-machine-functions.test.tmp`foo() + 12
```
2025-04-29 07:13:04 +01:00
Timm Baeder
0ddb5794b7 [clang][bytecode] Remove base casts before doing memcpy (#137754)
We have to copy the entire thing, not just one of the bases.
2025-04-29 08:06:31 +02:00
LLVM GN Syncbot
fa1fe11e38 [gn build] Port d1bb8d6a5c 2025-04-29 05:54:01 +00:00
Hemang Gadhavi
d1bb8d6a5c [lldb][AIX] get host info for AIX (#134354)
This PR is in reference to porting LLDB on AIX.

Link to discussions on llvm discourse and github:

1. https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640
2. https://github.com/llvm/llvm-project/issues/101657
The complete changes for porting are present in this draft PR:
https://github.com/llvm/llvm-project/pull/102601

- Added changes to make the common host support functions under
`Host/posix` for unix-like system.
Also, created the `unittests/Host/posix/` to test the hostInfo & support
functions for unix-like system.
- Added changes to get the host information for AIX. (GetProcessInfo()) 
(Information like : executable path, arch, process status etc.)
2025-04-29 11:23:03 +05:30
Kazu Hirata
93145004b4 [Support] Construct SmallVector with ArrayRef (NFC) (#137586) 2025-04-28 22:25:17 -07:00
Kazu Hirata
bbbb178a35 [mlir] Fix a warning
This patch fixes:

  mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp:2905:17: error: unused
  variable 'var' [-Werror,-Wunused-variable]

  mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp:2908:42: error: unused
  variable 'dataClauseOptional' [-Werror,-Wunused-variable]
2025-04-28 22:18:55 -07:00
Bob Wilson
2f1ef1d183 [Clang] Add new -header-include-filtering=direct-per-file option (#137087)
This adds a new filtering option to be used along with the
-header-include-format=json option. The existing "only-direct-system"
filtering option is missing some things:
- It does not show module imports.
- It does not show includes of non-system headers. This new
"direct-per-file" filtering has a separate entry in the JSON output for
each non-system source file, showing the direct includes and imports
from that file. You can use this to see uses of non-system headers, and
also find the paths through non-system headers that lead up to module
imports and system headers. Modules are identified here by their
modulemap files.
2025-04-28 21:54:45 -07:00
Timm Baeder
15579a8e72 [clang][bytecode] Check array sizes against step limit (#137679) 2025-04-29 05:47:22 +02:00
Naveen Seth Hanig
7ce0f5a9cc [clang][modules] Validate input file format for GenerateModuleInterfaceAction (#132692) (#137711)
Fixes #132692.

`clang -cc1` crashes when generating a module interface with
`emit-module-interface` or `emit-reduced-module-interface` using an
input file which is already a precompiled module (`.pcm`) file.
This commit adds validation for the input file format and Clang will now
emit an error message instead of crashing.
2025-04-29 11:22:34 +08:00
Jonas Devlieghere
a37e475efc [lldb] Rely on operator== for std::vector (NFC)
Rely on operator== for std::vector instead of comparing the elements in
the vector element by element,
2025-04-28 20:10:56 -07:00
Sam Elliott
4e175b8896 [RISCV] Fix Defs/Uses for SiFive CLIC Support (#137724)
The expensive checks bots found issues with #132481, due to not setting
defs/uses correctly. In 31bd7a5071 I added verify flags, so that the
failure is reproduced without requiring expensive checks, and xfailed
the test.

This change:
- Ensures that registers are correctly marked as defs/uses.
- Removes the xfail.
- Leaves the tests with `-verify-machineinstrs` which should have been
present originally.
2025-04-28 19:35:11 -07:00
Luke Lau
7ca6490636 [VPlan] Factor out isUnrolled() helper in VPWidenIntOrFpInductionRecipe. NFC (#137635)
Split off from #129508, this generalizes getSplatVFValue and
getLastUnrolledPartOperand so they don't need changed if another operand
is added.
2025-04-29 10:18:47 +08:00
Thurston Dang
d913ea307e [msan] Implement support for avx512fp16.mask.{add/sub/mul/div/max/min}.sh.round (#137441)
This adds a handler, visitGenericScalarHalfwordInst, which works for
mask.{add/sub/mul/div/max/min}.sh.round.

Updates the tests in https://github.com/llvm/llvm-project/pull/136260
2025-04-28 18:41:23 -07:00
Elvis Wang
1fc0a1401a [LV][AArch64] Add test for fp128 fmuladd reduction.(NFC) (#137576)
This patch add the test for the fmuladd reduction to show the test
change/fail for the cost model change.

Note that without the fp128 load and trunc, there is no failure.

Pre-commit test for #113903.
2025-04-29 09:18:07 +08:00
Koakuma
5d0e26e571 [compiler-rt] Make sure __clzdi2 doesn't call itself recursively on sparc64 (#136737)
On 64-bit platforms, libgcc doesn't ship with __clzsi2, so __builtin_clz
gets lowered to __clzdi2. A check already exists for GCC, but as of
commit 8210ca0198 clang also lowers
__builtin_clz to __clzdi2 on sparc64.

Update the check so that building __clzdi2 with clang/sparc64 also
works.
2025-04-29 07:36:32 +07:00
Eugene Epshteyn
4def437cdc [flang][NFC] Fixed a typo in Exensions.md (#137738)
Fixed a small typo regarding F'2023 15.5.2.5 paragraph number.
2025-04-28 20:34:17 -04:00
erichkeane
aa940cedca [OpenACC][NFC] Fix GCC7 build after fec003a18a
A GCC 7 requirement on the completeness of types before using them in a
variant means we need a constructor for these (or define them outside the
current thing).  This patch should fix the build, as reported by
@kewen12
2025-04-28 17:30:58 -07:00