558313 Commits

Author SHA1 Message Date
Doug Wyatt
fa6cc7eade
[Clang] FunctionEffects: ignore (methods of) local CXXRecordDecls. (#166078)
In the following example, `Functor::method()` inappropriately triggers a
diagnostic that `outer()` is blocking by allocating memory.

```
void outer() [[clang::nonblocking]]
{
	struct Functor {
		int* ptr;
		
		void method() { ptr = new int; }
	};
}
```

---------

Co-authored-by: Doug Wyatt <dwyatt@apple.com>
2025-11-05 07:45:33 -08:00
Nico Weber
4334b43c65 [gn] port bb4ed55acdbc 2025-11-05 10:44:32 -05:00
Mircea Trofin
52cb6e9d49
[ProfCheck][NFC] Make Function argument from branch weight setter optional (#166032)
This picks up from #166028, making the `Function` argument optional:
most cases don't need to provide it, but in e.g. InstCombine's case,
where the instruction (select, branch) is not attached to a function
yet, the function needs to be passed explicitly.

Co-authored-by: Florian Hahn <flo@fhahn.com>
2025-11-05 07:40:37 -08:00
Jean-Didier PAILLEUX
87fb7b002d
[flang] Adding NOTIFY specifier in image selector and add notify type checks (#148810)
This PR adds support for the NOTIFY specifier in the image selector as
described in the 2023 standard, and add checks for the NOTIFY_TYPE type.
2025-11-05 16:35:25 +01:00
Elvina Yakubova
338fb02c98
[BOLT][NFC] Rename funtions with _negative suffix to _unknown when th… (#166536)
…e size is unknown

Keep _negative suffix only for test cases when the size is negative
2025-11-05 15:28:31 +00:00
Durgadoss R
9762ab0c3d
[MLIR][NVVM] Fix the lowering of mbarrier.test.wait (#166555)
PR #165993 accidentally broke the lowering of the `test.wait` Op.

This patch fixes the issue and adds tests to verify the lowering to
intrinsics for all mbarrier Ops, ensuring similar regressions are caught in the
future.

Additionally, the `cp-async-mbarrier` test is moved to the
`mbarriers.mlir` test file to keep all related tests together.

Signed-off-by: Durgadoss R <durgadossr@nvidia.com>
2025-11-05 20:57:26 +05:30
Lei Huang
3a84aef64a
[PowerPC][NFC] auto gen checks vec rounding tests (#166435)
Update tests to contain auto generated checks.
2025-11-05 10:24:16 -05:00
Matt Arsenault
ad8f6b44be
DAG: Avoid some libcall string name comparisons (#166321)
Move to the libcall impl based functions.
2025-11-05 07:09:02 -08:00
Timm Baeder
14c76437ee
[clang][bytecode] Check types when loading values (#165385)
We need to allow BitCasts between pointer types to different prim types,
but that means we need to catch the problem at a later stage, i.e. when
loading the values.

Fixes https://github.com/llvm/llvm-project/issues/158527
Fixes https://github.com/llvm/llvm-project/issues/163778
2025-11-05 16:02:19 +01:00
Santanu Das
63d6e3eb46
[DebugInfo] Assign best possible debugloc to bundle (#164573)
The debug info attached to the BUNDLE is the first instruction in the
BUNDLE, even if a better debug info (line:column) is present in the
later instructions of the bundle. The patch tries to get a better debug
info first. If not, then a worse debug info without line number is
chosen.

---------

Co-authored-by: Vladislav Dzhidzhoev <dzhidzhoev@gmail.com>
Co-authored-by: Orlando Cazalet-Hyams <orlandoch.och@gmail.com>
2025-11-05 20:26:00 +05:30
Chanho Lee
3426f9c481
[clang][NFC] Rename stale TypeSourceInfo DI variables (#166082)
Fixes #165346

This patch renames stale variable names where `TypeSourceInfo` objects
were still using the old `DI` (`DeclaratorInfo`) naming convention.

Specifically, variables of type `TypeSourceInfo` have been updated from
`DI` to `TSI` to improve code clarity and maintain consistency with the
current naming.
2025-11-05 09:45:11 -05:00
Alex Bradbury
dd14eb8242
[RISCV] Introduce pass to promote double constants to a global array (#160536)
As discussed in #153402, we have inefficiences in handling constant pool
access that are difficult to address. Using an IR pass to promote double
constants to a global allows a higher degree of control of code
generation for these accesses, resulting in improved performance on
benchmarks that might otherwise have high register pressure due to
accessing constant pool values separately rather than via a common base.

Directly promoting double constants to separate global values and
relying on the global merger to do a sensible thing would be one
potential avenue to explore, but it is _not_ done in this version of the
patch because:
* The global merger pass needs fixes. For instance it claims to be a
function pass, yet all of the work is done in initialisation. This means
that attempts by backends to schedule it after a given module pass don't
actually work as expected.
* The heuristics used can impact codegen unexpectedly, so I worry that
tweaking it to get the behaviour desired for promoted constants may lead
to other issues. This may be completely tractable though.

Now that #159352 has landed, the impact on terms if dynamically executed
instructions is slightly smaller (as we are starting from a better
baseline), but still worthwhile in lbm and nab from SPEC. Results below
are for rva22u64:

```
Benchmark                  Baseline         This PR   Diff (%)
============================================================
============================================================
500.perlbench_r         180668945687    180666122417     -0.00%
502.gcc_r               221274522161    221277565086      0.00%
505.mcf_r               134656204033    134656204066      0.00%
508.namd_r              217646645332    216699783858     -0.44%
510.parest_r            291731988950    291916190776      0.06%
511.povray_r             30983594866     31107718817      0.40%
519.lbm_r                91217999812     87405361395     -4.18%
520.omnetpp_r           137699867177    137674535853     -0.02%
523.xalancbmk_r         284730719514    284734023366      0.00%
525.x264_r              379107521547    379100250568     -0.00%
526.blender_r           659391437610    659447919505      0.01%
531.deepsjeng_r         350038121654    350038121656      0.00%
538.imagick_r           238568674979    238560772162     -0.00%
541.leela_r             405660852855    405654701346     -0.00%
544.nab_r               398215801848    391352111262     -1.72%
557.xz_r                129832192047    129832192055      0.00%

```

---
Notes for reviewers:
* As discussed at the sync-up meeting, the suggestion is to try to land
an incremental improvement to the status quo even if there is more work
to be done around the general issue of constant pool handling. We can
discuss here if that is actually the best next step or not, but I just
wanted to clarify that's why this is being posted with a somewhat narrow
scope.
* I've disabled transformations both for RV32 and on systems without D
as both cases saw some regressions.
2025-11-05 14:31:17 +00:00
Tomer Shafir
5fedb7c588
[Clang][ARM] Fix tests using thumb instead arm arch on cc1 (#166416)
Currently, the ARM backend incorrectly parses every `arm` prefixed arch
to be non-thumb, but `armv6m` is THUMB and doesnt have ARM ops causing
the test to fail when compiling to assembly and not LLVM IR: `error:
Function 'foo' uses ARM instructions, but the target does not support
ARM mode execution.` This only happens when invoking cc1 directly and
not the Clang driver.

As a quick triage, this patch changes the tests to use `thumb`.

Uncovered by https://github.com/llvm/llvm-project/pull/151404
2025-11-05 16:29:05 +02:00
Simon Pilgrim
438a18c1e1
[X86] Add test coverage for #166534 (#166552) 2025-11-05 13:50:32 +00:00
Valery Pykhtin
ba1dbdd44a
Revert "[utils][UpdateLLCTestChecks] Add MIR support to update_llc_test_checks.py." (#166549)
Reverts llvm/llvm-project#164965
2025-11-05 14:30:27 +01:00
Michael Kruse
305cf623d7
[Polly] Check for ISL errors after schedule optimization (#166551)
When ISL encounters an internal error, it sets the error flag, but it is
not isl_error_quota that was already checked. Check for general errors
and abort the schedule optimization if that happens, instead of
continuing on the good path.

The error occured when compiling llvm-test-suite's
MultiSource/Applications/JM/lencod/leaky_bucket.c with Polly enabled.
Not adding a test case because it depends on ISL internals. We do not
want to a test case to depend on which version of ISL is used.
2025-11-05 13:17:05 +00:00
Ramkumar Ramachandra
1de55c9693
[VPlan] Avoid sinking allocas in sinkScalarOperands (#166135)
Use cannotHoistOrSinkRecipe to forbid sinking allocas.
2025-11-05 13:06:24 +00:00
Mikhail Gudim
b675c0c498
[RISCV] Add a test for multiple save locations of a callee-saved register (#164479)
Technically, it is possible that the a callee-saved register is saved in
different locations. CFIInstrInserter should handle this, but currently
it does not.
2025-11-05 08:05:43 -05:00
Nikolas Klauser
a389472e0b
[Clang][NFC] Refactor SemaCXX/dllexport.cpp to use -verify= instead of macros (#165855) 2025-11-05 13:58:24 +01:00
mitchell
98ca2e8545
[clang-tidy][NFC] Fix broken link in bugprone-default-operator-new-on-overaligned-type (#166546) 2025-11-05 15:51:22 +03:00
Muhammad Bassiouni
0d77cba6e1
[libc][math] Refactor exp2m1f16 implementation to header-only in src/__support/math folder. (#162019)
Part of #147386

in preparation for: https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2025-11-05 14:50:40 +02:00
Nico Weber
04c01f0660 [gn] port 0c7300923638403 2025-11-05 07:40:42 -05:00
hev
a4105707ee
[llvm][LoongArch] Introduce LASX and LSX conversion intrinsics (#157818)
This patch introduces the LASX and LSX conversion intrinsics:

- <8 x float> @llvm.loongarch.lasx.cast.128.s(<4 x float>)
- <4 x double> @llvm.loongarch.lasx.cast.128.d(<2 x double>)
- <4 x i64> @llvm.loongarch.lasx.cast.128(<2 x i64>)
- <8 x float> @llvm.loongarch.lasx.concat.128.s(<4 x float>, <4 x
float>)
- <4 x double> @llvm.loongarch.lasx.concat.128.d(<2 x double>, <2 x
double>)
- <4 x i64> @llvm.loongarch.lasx.concat.128(<2 x i64>, <2 x i64>)
- <4 x float> @llvm.loongarch.lasx.extract.128.lo.s(<8 x float>)
- <2 x double> @llvm.loongarch.lasx.extract.128.lo.d(<4 x double>)
- <2 x i64> @llvm.loongarch.lasx.extract.128.lo(<4 x i64>)
- <4 x float> @llvm.loongarch.lasx.extract.128.hi.s(<8 x float>)
- <2 x double> @llvm.loongarch.lasx.extract.128.hi.d(<4 x double>)
- <2 x i64> @llvm.loongarch.lasx.extract.128.hi(<4 x i64>)
- <8 x float> @llvm.loongarch.lasx.insert.128.lo.s(<8 x float>, <4 x
float>)
- <4 x double> @llvm.loongarch.lasx.insert.128.lo.d(<4 x double>, <2 x
double>)
- <4 x i64> @llvm.loongarch.lasx.insert.128.lo(<4 x i64>, <2 x i64>)
- <8 x float> @llvm.loongarch.lasx.insert.128.hi.s(<8 x float>, <4 x
float>)
- <4 x double> @llvm.loongarch.lasx.insert.128.hi.d(<4 x double>, <2 x
double>)
- <4 x i64> @llvm.loongarch.lasx.insert.128.hi(<4 x i64>, <2 x i64>)
2025-11-05 20:36:38 +08:00
Valery Pykhtin
c782ed3440
[utils][UpdateLLCTestChecks] Add MIR support to update_llc_test_checks.py. (#164965)
This change enables update_llc_test_checks.py to automatically generate
MIR checks for RUN lines that use `-stop-before` or `-stop-after` flags
allowing tests to verify intermediate compilation stages (e.g., after
instruction selection but before peephole optimizations) alongside the
final assembly output. If `-debug-only` flag is present in the run line it's
considered as the main point of interest for testing and stop flags above
are ignored (that is no MIR checks are generated).

This resulted from the scenario, when I needed to test two instruction
matching patterns where the later pattern in the peepholer reverts the
earlier pattern in the instruction selector and distinguish it from the
case when the earlier pattern didn't worked at all.

Initially created by Claude Sonnet 4.5 it was improved later to handle
conflicts in MIR <-> ASM prefixes and formatting.
2025-11-05 13:31:10 +01:00
Matthias Springer
6c640b86e6
[mlir][LLVM] Fix unsupported FP lowering in VectorConvertToLLVMPattern (#166513)
Fixes a bug in `VectorConvertToLLVMPattern`, which converted operations
with unsupported FP types. E.g., `arith.addf ... : f4E2M1FN` was lowered
to `llvm.fadd ... : i4`, which does not verify. There are a few more
patterns that have the same bug. Those will be fixed in follow-up PRs.

This commit is in preparation of adding an `APFloat`-based lowering for
`arith` operations with unsupported floating-point types.
2025-11-05 12:24:59 +00:00
Matthias Springer
a38e094240
[mlir] Dialect Conversion: Add support for post-order legalization order (#166292)
By default, the dialect conversion driver processes operations in
pre-order: the initial worklist is populated pre-order. (New/modified
operations are immediately legalized recursively.)

This commit adds a new API for selective post-order legalization.
Patterns can request an operation / region legalization via
`ConversionPatternRewriter::legalize`. They can call these helper
functions on nested regions before rewriting the operation itself.

Note: In rollback mode, a failed recursive legalization typically leads
to a conversion failure. Since recursive legalization is performed by
separate pattern applications, there is no way for the original pattern
to recover from such a failure.
2025-11-05 21:04:32 +09:00
Sirui Mu
c1dc064ba0
[CIR] Add support for storing into _Atomic variables (#165872) 2025-11-05 19:32:34 +08:00
Congcong Cai
e8564830c1
[clang-tidy][doc] add more information in twine-local's document (#166266)
explain more about use-after-free in llvm-twine-local
add note about manually adjusting code after applying fix-it.
fixed: #154810
2025-11-05 11:25:53 +00:00
Timm Baeder
fedd3b0399
[clang][bytecode] Remove dummy variables once they are proper globals (#166174)
Dummy variables have an entry in `Program::Globals`, but they are not
added to `GlobalIndices`. When registering redeclarations, we used to
only patch up the global indices, but that left the dummy variables
alone. Update the dummy variables of all redeclarations as well.


Fixes https://github.com/llvm/llvm-project/issues/165952
2025-11-05 12:15:48 +01:00
Victor Campos
d249e67a6a
[libc][math] Disable FEnvSafeTest.cpp if AArch64 target has no FP support (#166370)
The `FEnvSafeTest.cpp` test fails on AArch64 soft nofp configurations
because LLVM libc does not provide a floating-point environment in these
configurations.

This patch adds another preprocessor guard on `__ARM_FP` to disable the
test on those.
2025-11-05 11:14:02 +00:00
Timm Baeder
5821b09e5f
[clang][bytecode] Print primitive arrays in Descriptor::dumpFull() (#166393)
And recurse into records properly.
2025-11-05 11:52:59 +01:00
Elvina Yakubova
a65867ac31
[BOLT][AArch64] Fix search to proceed upwards from memcpy call (#166182)
The search should proceed from CallInst to the beginning of BB since X2
can be rewritten and we need to catch the most recent write before the
call.

Patch by Yafet Beyene alulayafet@gmail.com
2025-11-05 10:51:31 +00:00
SKill
86d9e1c035
[clang] Delete duplicate code in sourcemanager (#166236)
Now that the `SourceManager::getExpansionLoc` and
`SourceManager::getSpellingLoc` functions are efficient, delete
unnecessary code duplicate in `SourceManager::getDecomposedExpansionLoc`
and `SourceManager::getDecomposedSpellingLoc` methods.
2025-11-05 18:45:32 +08:00
Simon Pilgrim
28e024fb9d
[X86] narrowBitOpRMW - allow additional uses of the BTC/R/S result (#166376)
If there are additional uses of the bit twiddled value as well as the
rmw store, we can replace them with a (re)loaded copy of the full width
integer value after the store.

There's some memory op chain handling to handle here - the additional
(re)load is chained after the new store and then any dependencies of the
original store are chained after the (re)load.
2025-11-05 10:33:30 +00:00
Jay Foad
fb49adb6ea
[AMDGPU] Another test for missing S_WAIT_XCNT (#166154) 2025-11-05 10:17:52 +00:00
Jan Patrick Lehr
833983918d
Revert "CodeGen: Record MMOs in finalizeBundle" (#166520)
Reverts llvm/llvm-project#166210

Buildbot failures in the libc on GPU bot:
https://lab.llvm.org/buildbot/#/builders/10/builds/16711
2025-11-05 11:11:08 +01:00
Durgadoss R
35ee3c6f72
[MLIR][NVVM] Update mbarrier Ops to use AnyTypeOf[] (2/n) (#165993)
This is a follow up of PR #165558. (1/n)

This patch updates the below mbarrier Ops to use
AnyTypeOf[] construct:
```
* mbarrier.arrive
* mbarrier.arrive.noComplete
* mbarrier.test.wait
* cp.async.mbarrier.arrive
```

* Updated existing tests accordingly.
* Verified locally that there are no new regressions in the `integration` tests.
* TODO: Two more Ops remain and will be migrated in a subsequent PR.

Signed-off-by: Durgadoss R <durgadossr@nvidia.com>
2025-11-05 15:38:24 +05:30
NagaChaitanya Vellanki
cc9ad9afc6
[Clang] Add constexpr support for AVX512 permutex2 intrinsics (#165085)
This patch enables compile-time evaluation of AVX512 permutex2var
intrinsics in constexpr contexts.

Extend shuffle generic to handle both integer immediate and vector mask
operands.

Resolves #161335
2025-11-05 09:58:30 +00:00
Simon Pilgrim
0314b939d6
[Headers][X86] avx ifma - move constexpr to the end of the function attribute lists. NFC. (#166523)
Makes it easier to compare constexpr/non-constexpr attribute defines

Allows clang-format to pack the attributes more efficiently
2025-11-05 09:56:20 +00:00
David Sherwood
7b3fe5fd42
[LV][NFC] Remove undef values in some test cases (#164401)
Split off from PR #163525, this standalone patch replaces simple cases
where undef is used as a value for arithmetic or getelementptr
instructions. This will reduce the likelihood of contributors hitting
the `undef deprecator` warning in github.
2025-11-05 09:18:02 +00:00
Andi Drebes
8eacea9934
[MLIR][ODS] Re-enable direct implementation of type interfaces with method bodies (#166335)
Since commit 842622bf8bea782e9d9865ed78b0d8643f098122 adding support for
overloading interface methods, a `using` directive is emitted for any
interface method that does not require emission of a trait method,
including for methods that define a method body.

However, methods directly specifying a body (e.g., via the `methodBody`
parameter of `InterfaceMethod`) are implemented directly in the
interface class and are therefore not present in the associated trait.
The generated `using` directive then referes to a non-existent method of
the trait, resulting in an error upon compilation of the generated code.

This patch changes `DefGen::emitTraitMethods()`, such that
`genTraitMethodUsingDecl()` is not invoked for interface methods with a
body anymore.
2025-11-05 01:05:06 -08:00
Gábor Spaits
628d53aba5
[InstCombine] Enable FoldOpIntoSelect and foldOpIntoPhi when the Op's other parameter is non-const (#166102)
This patch enables `FoldOpIntoSelect` and `foldOpIntoPhi` for the cases
when Op's second parameter is a non-constant.
It doesn't seem to bring significant improvements, but the compile
time impact is neglegable.
2025-11-05 10:04:32 +01:00
Nikolas Klauser
5b5d0a8319
[libc++][NFC] Make __type_info_implementations a namespace (#166339)
There doesn't seem much of a reason why this should be a struct. Make it
a namespace instead.
2025-11-05 10:00:47 +01:00
mitchell
51d0f6d6e1
[clang-tidy] Rename cert-dcl58-cpp to bugprone-std-namespace-modification (#165659)
Closes [#157290](https://github.com/llvm/llvm-project/issues/157290)
2025-11-05 11:43:27 +03:00
Nikolas Klauser
988c1b1c8d
[libc++] Remove <cstdlib> include from <exception> (#166340) 2025-11-05 09:42:35 +01:00
Karlo Basioli
98f0139f5b
Fix bazel build issue caused by #166259 (#166519) 2025-11-05 09:41:04 +01:00
Timm Baeder
9016c60c68
[clang] Call ActOnCaseExpr even if the 'case' is missing (#166326)
This otherwise happens in ParseCaseExpression.
If we don't call this, we don't perform the usual arithmetic
conversions, etc.
2025-11-05 08:39:34 +01:00
Saleem Abdulrasool
66f52ca9a0
test: correct typo in RUN line (#166511)
Correct a typo in the triple that is used for the test. Because the OS
was not recognised, it would fall to the non-Windows code generation.
2025-11-05 07:22:47 +00:00
Nicolai Hähnle
304d2ff4d9
CodeGen: Record MMOs in finalizeBundle (#166210)
This allows more accurate alias analysis to apply at the bundle level.
This has a bunch of minor effects in post-RA scheduling that look mostly
beneficial to me, all of them in AMDGPU (the Thumb2 change is cosmetic).

The pre-existing (and unchanged) test in
CodeGen/MIR/AMDGPU/custom-pseudo-source-values.ll tests that MIR with a
bundle with MMOs can be parsed successfully.

v2:
- use cloneMergedMemRefs
- add another test to explicitly check the MMO bundling behavior

v3:
- use poison instead of undef to initialize the global variable in the
test
2025-11-05 06:56:19 +00:00
yicuixi
19a9de06cd
[clang] Accept empty enum in MSVC compatible C (#159981)
Fixes https://github.com/llvm/llvm-project/issues/114402.
This patch accept empty enum in C as a microsoft extension and introduce
an new warning `-Wmicrosoft-empty-enum`.

---------

Signed-off-by: yicuixi <qin_17914@126.com>
Co-authored-by: Erich Keane <ekeane@nvidia.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2025-11-05 14:43:40 +08:00