Commit Graph

557323 Commits

Author SHA1 Message Date
Timm Baeder
f29235d698 [clang][bytecode] Don't diagnose defined functions that will have a body (#165002)
Don't use `hasBody()`, which checks all declarations.

Fixes https://github.com/llvm/llvm-project/issues/164995
2025-10-27 14:06:54 +01:00
Aiden Grossman
f80b27349d [X86][NewPM] Port X86LowerAMXType to NewPM
To enable the eventual migration of everything to the NewPM.

Reviewers: RKSimon, phoebewang, paperchalice, arsenm, topperc

Reviewed By: arsenm

Pull Request: https://github.com/llvm/llvm-project/pull/165084
2025-10-27 06:06:25 -07:00
Ivan Kosarev
6658933288 [Utils][update_mc_test_checks] Support updating round-trip tests. (#164425) 2025-10-27 12:49:12 +00:00
Lauren
e964acf85f [DAG] Fold mismatched widened avg idioms to narrow form (#147946) (#163366)
[DAG] Fold mismatched widened avg idioms to narrow form (fixes half of
[llvm#147946](https://github.com/llvm/llvm-project/issues/147946))

1. `trunc(avgceilu(sext(x), sext(y))) -> avgceils(x, y)` 
2. `trunc(avgceils(zext(x), zext(y))) -> avgceilu(x, y)`

When inputs are sign-extended, unsigned and signed averaging operations
produce identical results after truncation, allowing us to use the
semantically correct narrow operation.

alive2: https://alive2.llvm.org/ce/z/ZRbfHT
2025-10-27 12:24:41 +00:00
Jean-Didier PAILLEUX
1f65ab134f [flang] Fix build on different of cores from #164630 (#164841)
Normally fix incorrect linking introduced
in [#161179](https://github.com/llvm/llvm-project/pull/161179) with
build in parallel.
2025-10-27 12:45:16 +01:00
Michael Buch
ff5a7370c8 [lldb][test] TestFrameVarDILGlobalVariableLookup: only XFAIL earlier DWARF versions on macOS
On Linux we would use the manual DWARF index and the failing test assertion (see `c40b6904751da529a0436faf72d5d63d35484689`) would still pass.
2025-10-27 10:58:16 +00:00
Timm Baeder
e624048f5c [clang][bytecode] Check overflow ops for block pointers (#165221)
We can't save the result in a non-block pointer.

Fixes https://github.com/llvm/llvm-project/issues/165076
2025-10-27 11:55:52 +01:00
David Spickett
67de7106b9 [lldb-dap][test] Disable DisconnectTriggersTerminateCommands on Linux
It is flaky, see https://github.com/llvm/llvm-project/issues/154763.
2025-10-27 10:42:49 +00:00
Benjamin Kramer
d11f0bc56e [clang-tidy] Remove unused #include. NFC. 2025-10-27 11:34:12 +01:00
Jay Foad
60f20ea465 [AMDGPU] Add target feature for waits before system scope stores. NFC. (#164993) 2025-10-27 10:31:37 +00:00
Michael Buch
74bb1f435f [lldb][test] TestFrameVarDILGlobalVariableLookup: XFAIL on older Clang versions
Failing on macOS Clang-15 and Clang-17 bots with:
```
07:26:20  ======================================================================
07:26:20  FAIL: test_frame_var (TestFrameVarDILGlobalVariableLookup.TestFrameVarDILGlobalVariableLookup)
07:26:20  ----------------------------------------------------------------------
07:26:20  Traceback (most recent call last):
07:26:20    File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 156, in wrapper
07:26:20      return func(*args, **kwargs)
07:26:20    File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/commands/frame/var-dil/basics/GlobalVariableLookup/TestFrameVarDILGlobalVariableLookup.py", line 48, in test_frame_var
07:26:20      self.expect_var_path("ExtStruct::static_inline", value="16")
07:26:20    File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2599, in expect_var_path
07:26:20      value_check.check_value(self, eval_result, str(eval_result))
07:26:20    File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 302, in check_value
07:26:20      test_base.assertSuccess(val.GetError())
07:26:20    File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2607, in assertSuccess
07:26:20      self.fail(self._formatMessage(msg, "'{}' is not success".format(error)))
07:26:20  AssertionError: '<user expression 0>:1:1: use of undeclared identifier 'ExtStruct::static_inline'
07:26:20     1 | ExtStruct::static_inline
07:26:20       | ^' is not success
```

I suspect Clang-17 (and earlier) used DWARFv4 on macOS by default. So we
would use the Apple accelerator tables, which didn't index `ExtStruct`
(based on what I observed locally). We already XFAIL this test for
DWARFv4, hence XFAIL it also for older Clang versions.
2025-10-27 10:26:32 +00:00
Michael Buch
c40b690475 [lldb][test] TestFrameVarDILGlobalVariableLookup: skip for older DWARF versions
Test fails on the DWARFv2 and DWARFv5 macOS bot with:
```
07:00:39  FAIL: test_frame_var (TestFrameVarDILGlobalVariableLookup.TestFrameVarDILGlobalVariableLookup)
07:00:39  ----------------------------------------------------------------------
07:00:39  Traceback (most recent call last):
07:00:39    File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 156, in wrapper
07:00:39      return func(*args, **kwargs)
07:00:39    File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/commands/frame/var-dil/basics/GlobalVariableLookup/TestFrameVarDILGlobalVariableLookup.py", line 48, in test_frame_var
07:00:39      self.expect_var_path("ExtStruct::static_inline", value="16")
07:00:39    File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2599, in expect_var_path
07:00:39      value_check.check_value(self, eval_result, str(eval_result))
07:00:39    File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 302, in check_value
07:00:39      test_base.assertSuccess(val.GetError())
07:00:39    File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2607, in assertSuccess
07:00:39      self.fail(self._formatMessage(msg, "'{}' is not success".format(error)))
07:00:39  AssertionError: '<user expression 0>:1:1: use of undeclared identifier 'ExtStruct::static_inline'
07:00:39     1 | ExtStruct::static_inline
07:00:39       | ^' is not success
07:00:39  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/lldb-build/bin/clang
```

Possibly something to do with accelerator table differences between the versions.
2025-10-27 10:14:44 +00:00
paperchalice
9a39076d39 [test][DebugInfo] Remove unsafe-fp-math uses (NFC) (#164966)
Post cleanup for #164534.
Not all attributes are stripped, some of them may affect debug info.
2025-10-27 18:14:27 +08:00
David Spickett
33185e7d43 [lldb][docs] Add example output for standalone debugging script
Varies by host but I think it's useful to give some expectation.
2025-10-27 10:13:09 +00:00
Michael Buch
313b95f3a8 [lldb][test] Add test for parsing Objective-C synthesized properties
Prior to https://github.com/llvm/llvm-project/pull/164998, recent LLDB
versions would fail to parse synthesized property setters correctly. The
only way this failure would manifest is an error to the console:
```
error: main.o [0x00000000000000cd]: invalid Objective-C method DW_TAG_subprogram (DW_TAG_subprogram), please file a bug and attach the file at the start of this error message
```

There weren't any Objective-C tests that failed when the original regression (https://github.com/llvm/llvm-project/pull/100355) landed. This patch adds a test that explicitly checks that the type of the setter is sensible.

This test fails without https://github.com/llvm/llvm-project/pull/164998
and passes with it.

I decided not to check for the absence of the console error because that kind of test would be fragile to the removal of (or any changes to) the error message.
2025-10-27 10:01:07 +00:00
Afanasyev Ivan
538c8509ef [clang][docs] Fix typos in SafeBuffers.rst (#163547) 2025-10-27 17:45:52 +08:00
Timm Baeder
5d1e1cfa08 [clang][bytecode] Check memcmp for block pointers (#165070)
We can't read from non-block pointers anyway.

Fixes https://github.com/llvm/llvm-project/issues/165061
2025-10-27 10:43:01 +01:00
Igor Wodiany
046ed90d3f [mlir][spirv] Ensure function declarations precede definitions (#164956)
SPIR-V spec requires that any calls to external functions are preceded
by declarations of those external functions. To simplify the
implementation, we sort functions in the serializer using a stronger
condition: any functions declarations are moved before any functions
definitions - this ensures that external functions are always declared
before being used.
2025-10-27 09:28:50 +00:00
Timm Baeder
9af49ee474 [clang][bytecode] Handle discarded AddrLabelExprs properly (#165000)
emitDummyPtr() doesn't like to be called with DiscardResult set, so
check this first.

Fixes https://github.com/llvm/llvm-project/issues/164979
2025-10-27 10:28:09 +01:00
Igor Wodiany
bcfd6da5db [mlir][spirv] Enable validation of global vars tests (#164974)
Currently the target test will fail with:

```
error: line 12: Initializer type must match the data type
  %var2 = OpVariable %_ptr_Uniform_float Uniform %var1
```

When passed:

```mlir
spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
  spirv.GlobalVariable @var1 : !spirv.ptr<f32, Uniform>
  spirv.GlobalVariable @var2 initializer(@var1) bind(1, 0) : !spirv.ptr<f32, Uniform>
}
```

The problem is that we try to initialize `f32` pointer with `f32`
pointer, but the validator fails because it expects `var1` to be `f32`,
not a pointer to `f32`. `spirv.GlobalVariable` only allows pointer type,
so in the current design we cannot initialize one `spirv.GlobalVariable`
with another.

So, for now we disallow initialization of one global variable with
another. In the future we may want to re-work global variables if we
want to support that.
2025-10-27 09:27:49 +00:00
ZhaoQi
cf6db6303b [LoongArch] Optimize for reversing vector using shufflevector (#163151) 2025-10-27 17:16:55 +08:00
Juan Manuel Martinez Caamaño
efcc6135da [Clang][AMDGPU] Enable type-checking on __builtin_amdgcn_raw_ptr_buffer_atomic_{{add|fadd|fmin|fmax}} (#164824)
The "t" flag is used to mark the builtin signature as meaningless.
This is done on several builtins taking pointers since otherwise HIP
code would not compile
during compilation for the host (even if the builtin is only used in
device code, compilation would fail).

The builtins changed by this patch are not affected by this issue, so
they do not need the "t" flag in the first place.
2025-10-27 09:59:54 +01:00
Albert Huang
aa550cdc5f [ARM] [AArch32] Add support for Arm China STAR-MC3 CPU (#163709)
STAR-MC3 is an Armv8.1m CPU.
Technical specificationa available at:
https://www.armchina.com/download/Documents/TRM?infoId=240
2025-10-27 08:55:28 +00:00
Durgadoss R
e86a42940a [NVPTX] Add missing mbarrier intrinsics (#164864)
This patch adds a few more mbarrier intrinsics,
completing support for all the mbarrier variants
up to Blackwell architecture.

* Docs are updated in NVPTXUsage.rst.
* lit tests are added for all the variants.
* lit tests are verified with PTXAS from CUDA-12.8 toolkit.

Signed-off-by: Durgadoss R <durgadossr@nvidia.com>
2025-10-27 14:23:40 +05:30
Timm Baeder
bc37018a0b [clang][bytecode] Fail on reads from constexpr-unknown pointers (#164996)
If they aren't const.

Fixes https://github.com/llvm/llvm-project/issues/164985
2025-10-27 09:38:23 +01:00
Nikita Popov
de9e18dc75 [InstCombine] Handle ptrtoaddr in gep of pointer sub fold (#164818)
This extends the `ptradd x, ptrtoint(y) - ptrtoint(x)` to `y`
InstCombine fold to support ptrtoaddr. In the case where x and y have
the same underlying object, this is handled by InstSimplify already. If
the underlying object may differ, the replacement can only be performed
if provenance does not matter.

For pointers with non-address bits we need to be careful here, because
the pattern will return a pointer with the non-address bits of x and the
address bits of y. As such, uses in ptrtoaddr are safe to replace, but
uses in ptrtoint are not. Whether uses in icmp are safe to replace
depends on the outcome of the pending discussion on icmp semantics (I'll
adjust this in https://github.com/llvm/llvm-project/pull/163936 if/when
that lands).
2025-10-27 09:16:48 +01:00
Antonio Frighetto
00f5a1e30b [SimplifyCFG] Extend simplifySwitchOfPowersOfTwo to reachable defaults
Favour a `cttz`-indexed table lookup over an indirect jump table when
the default switch case is reachable, by branching non-power-of-two
inputs to the default case.

Proofs: https://alive2.llvm.org/ce/z/HeRAtf.
2025-10-27 08:51:43 +01:00
Antonio Frighetto
29346628e9 [SimplifyCFG] Precommit tests for PR161807 (NFC) 2025-10-27 08:51:20 +01:00
Michael Buch
f8b004dd7b [clang][DebugInfo] Don't mark explicit parameter of synthesized ObjC property accessors artificial (#164998)
In the past we used to only mark variables artificial that were
`isImplicit`. We would also omit the location information if the
variable's parent was implicit. Since
https://github.com/llvm/llvm-project/pull/100355 we made the logic to
mark variables as artificial the same as determining whether to omit its
location or not. This was to support binding variable declarations,
which we would like to have line information for (and don't want to mark
artificial as they are explicitly named in source).

However, this doesn't quite do the expected for parameters of
Objective-C synthesised property accessors. An Objective-C setter will
have an explicit parameter, which is the ivar to write to. However,
because the parent (i.e., the synthesised method) is artificial, we now
mark that parameter artificial. This is example debug-info for such an
accessor:
```
0x00000118:   DW_TAG_subprogram                                                                           
                DW_AT_low_pc    (0x0000000000000044)
                DW_AT_high_pc   (0x0000000000000078)
                DW_AT_frame_base        (DW_OP_reg29 W29)   
                DW_AT_object_pointer    (0x00000128)
                DW_AT_specification     (0x00000068 "-[Foo setFooProp:]")
                                                     
0x00000128:     DW_TAG_formal_parameter
                  DW_AT_location        (DW_OP_fbreg -8)
                  DW_AT_name    ("self")                                                                  
                  DW_AT_type    (0x00000186 "Foo *")
                  DW_AT_artificial      (true)    
                                                     
0x00000131:     DW_TAG_formal_parameter
                  DW_AT_location        (DW_OP_breg31 WSP+16)
                  DW_AT_name    ("_cmd")
                  DW_AT_type    (0x0000018b "SEL")
                  DW_AT_artificial      (true)      
                                                     
0x0000013a:     DW_TAG_formal_parameter                                                                   
                  DW_AT_location        (DW_OP_breg31 WSP+8)
                  DW_AT_name    ("fooProp")                                                               
                  DW_AT_type    (0x000000aa "id")
                  DW_AT_artificial      (true)    
```

Note how the `fooProp` parameter is marked artificial, although it
technically is an explicitly passed parameter. We want to treat the
synthesised method like any other, where explicitly passed parameters
aren't artificial. But we do want to omit the file/line info because it
doesn't exist in the source.

This patch prevents such parameters from being marked artificial. We
could probably generalise this to any kind of synthesised method, not
just Objective-C. But I'm currently not aware of such synthesised
functions, so made it Objective-C specific for now for testability.

*Motivator*
Marking such parameters artificial makes LLDB fail to parse the ObjC
method and emit an error such as:
```
error: Foo.o [0x00000000000009d7]: invalid Objective-C method DW_TAG_subprogram (DW_TAG_subprogram), please file a bug and attach the file at the start of this error message
```

rdar://163063569
2025-10-27 07:49:06 +00:00
Vitaly Buka
1322e71f2b [SpecialCaseList] Add RadixTree for substring matching (#164545)
This commit adds a new RadixTree to `SpecialCaseList` for handling
substring matches. Previously, `SpecialCaseList` only supported prefix
and suffix matching. With this change, patterns that have neither
prefixes nor suffixes can now be efficiently filtered.

According to SpecialCaseListBM:

Lookup benchmarks (significant improvements):
```
OVERALL_GEOMEAN                       -0.7809
```

Lookup `*test*` like benchmarks (huge improvements):
```
OVERALL_GEOMEAN                       -0.9947
```

https://gist.github.com/vitalybuka/ee7f681b448eb18974386ab35e2d4d27
2025-10-27 05:30:38 +00:00
Kazu Hirata
f19bce3172 [AArch64] Remove an unused local variable (NFC) (#165194) 2025-10-26 22:10:12 -07:00
Kazu Hirata
2bb95311ee [llvm] Proofread YamlIO.rst (#165193) 2025-10-26 22:10:04 -07:00
Kazu Hirata
8983127af5 [Support] Use "static constexpr" for a constant in ProcessInfo (NFC) (#165192) 2025-10-26 22:09:55 -07:00
Kazu Hirata
ee25edf2d2 [DebugInfo] Fold a namespace into a std::hash specialization (NFC) (#165191)
This patch folds "std" into the std::hash specialization so that the
template mentions std::hash.  std::hash is much easier to recognize
than std and hash separated by a couple of lines.
2025-10-26 22:09:48 -07:00
Kazu Hirata
133ac3ad3f [ADT] Achieve the "Rule of Zero" in DGNode (#165190)
This patch achieves the "Rule of Zero" in DGNode by removing the
copy/move constructors and copy/move assignment operators.

Note that the code being deleted does a couple of unusual things that
are most likely oversight:

- The copy constructor with "explicit" is highly unusual.  This means
  that we allow "DGNode<N, E> A(B);" but disallow
  "DGNode<N, E> A = B;".

- The move assignment operator with const r-value reference is also
  unusual, especially given that the move constructor is correctly
  implemented.
2025-10-26 22:09:40 -07:00
Florian Hahn
0e28c9bc9d [LAA] Skip undef/poison strides in collectStridedAccess.
The map returned by collectStridedAccess is used to replace strides with
their versioned values. This does not work for Undef/Poison, which don't
have use-lists. Don't try to version them, as versioning won't be useful in
practice.

Fixes https://github.com/llvm/llvm-project/issues/162922.
2025-10-27 05:01:17 +00:00
Wenju He
a61e016565 [libclc] Implement integer __clc_abs using __builtin_elementwise_abs (#164957)
Previous implementation was cmp, select and @llvm.smax sequence in LLVM IR.
__CLC_GEN_U/__CLC_GEN_S is upstreamed from intel/llvm repo.
2025-10-27 12:58:14 +08:00
Victor Chernyakin
81de86123f [clang-tidy] Add new check: readability-redundant-typename (#161574)
Closes #158374.
2025-10-26 21:38:02 -07:00
Victor Chernyakin
3b8f63dcc9 [clang-tidy][NFC] Remove unused parameter in function (#164202)
82289aa refactored this function to not need this parameter.
2025-10-26 21:36:05 -07:00
Matt Arsenault
3dce567e44 AArch64: Clean up some casts to target subclasses (#165189)
Prefer getSubtarget<AArch64>(). Also avoids one unnecessary
null check.
2025-10-26 21:11:48 -07:00
Matt Arsenault
0a34cbe51c AArch64: Use Register in FrameLowering (#165188) 2025-10-27 04:09:58 +00:00
Matt Arsenault
b549ea7764 ARM: Avoid adding default libcalls overridden by AEABI functions (#164983)
Avoids adding alternative libcall impls for the same libcall.

I'm not sure if the default names exist or not, or are just not
preferred. compiler-rt appears to define aliases for all of these,
so I'm not sure why we bother distinguishing these in the first place.
2025-10-26 21:09:16 -07:00
Matt Arsenault
bbf5c410e1 X86: Make sure compiler-rt div calls are not added for msvc (#164591)
The current predicate system is primitive, we ought to have
a way to list a chain of alternatives.
2025-10-26 21:08:54 -07:00
Matt Arsenault
6b885c3e58 RuntimeLibcalls: Make sure _Unwind_Resume entries are mutually exclusive (#164195) 2025-10-26 21:08:41 -07:00
Florian Hahn
57ba58d558 [LV] Modernize version-mem-access.ll tests.
Auto-generate CHECK lines and simplify tests a bit.
2025-10-27 03:37:59 +00:00
Jianjian Guan
279a81e240 [RISCV][GISel] Support select vector load intrinsics (#160720)
Include unit-stride, strided and mask vector load intrinsics.
2025-10-27 10:51:26 +08:00
Florian Hahn
3cb8a52e2d [LAA] Add additional tests for #161445.
Add extra test variants for
https://github.com/llvm/llvm-project/pull/161445.
2025-10-27 02:39:09 +00:00
Matt Arsenault
1fae9db3d5 AArch64: Fix undefined behavior in sme calling convention test (#165183)
Mismatch of callsite and callee calling conventions
2025-10-27 02:08:42 +00:00
Matt Arsenault
c197718cdf AArch64: Reformat some debug printing blocks (#165178)
Add {} in LLVM_DEBUG for nicer clang-format handling.
2025-10-27 01:57:10 +00:00
Kazu Hirata
6cb942cec4 [llvm] Remove argument_type in std::hash specializations (NFC) (#165167)
The argument_type and result_type type aliases in std::hash are
deprecated in C++17 and removed in C++20.  This patch aligns two
specializations of ours with the C++ standard.
2025-10-26 15:20:07 -07:00