554609 Commits

Author SHA1 Message Date
Ryan Cowan
eb803df502
[AArch64][GlobalISel] Add G_FMODF instruction (#160061)
This commit adds the intrinsic `G_FMODF` to GMIR & enables its
translation, legalization and instruction selection in AArch64.
2025-10-02 10:30:31 +01:00
LLVM GN Syncbot
04c01ff144 [gn build] Port 55803b8af1e4 2025-10-02 09:20:19 +00:00
Nikolas Klauser
55803b8af1
Reapply "[libc++] Avoid constructing additional objects when using map::at" (#160738) (#161485)
This reverts commit b86aaacf28b358b187071bc87075f1faa2d65c4e.

The issue in LLVM has been fixed now.
2025-10-02 11:15:33 +02:00
Kerry McLaughlin
20e0e80a54
[AArch64] Combine PTEST_FIRST(PTRUE, CONCAT(A, B)) -> PTEST_FIRST(PTRUE, A) (#161384)
When the input to ptest_first is a vector concat and the mask is all active,
performPTestFirstCombine returns a ptest_first using the first operand
of the concat, looking through any reinterpret casts.

This allows optimizePTestInstr to later remove the ptest when the first
operand is a flag setting instruction such as whilelo.
2025-10-02 10:13:06 +01:00
Michael Klemm
8aa64edb34
[Flang] Add -ffast-real-mod and direct code for MOD on REAL types (#160660)
This patch adds direct code-gen support for a faster MOD intrinsic for
REAL types. Flang has maintained and keeps maintaining a high-precision
implementation of the MOD intrinsic as part of the Fortran runtime. With
the -ffast-real-mod flag, users can opt to avoid calling into the
Fortran runtime, but instead trigger code-gen that produces faster code
by avoiding the runtime call, at the expense of potentially risking bit
cancelation by having the compiler use the MOD formula a specified by
ISO Fortran.
2025-10-02 10:50:05 +02:00
Benjamin Maxwell
031fb7414f
[AArch64][SME] Preserve Chain when selecting multi-vector LUT4Is (#161494)
Previously, the `Chain` was dropped meaning LUTI4 nodes that only
differed in the chain operand would be incorrectly CSE'd.

Fixes: #161420
2025-10-02 09:27:48 +01:00
Ramkumar Ramachandra
6e52e538cd
[LAA] Test different-type-sizes in safe-dep-dist (#161244)
The isSafeDependenceDistance routine is guarded by a HasSameSize check
which can be removed, as the test demonstrates.
2025-10-02 09:17:36 +01:00
Fabian Ritter
bf847a8b9d
[AMDGPU][SDAG] Enable ISD::PTRADD for 64-bit AS by default (#146076)
Also removes the command line option to control this feature.

There seem to be mainly two kinds of test changes:
- Some operands of addition instructions are swapped; that is to be expected
  since PTRADD is not commutative.
- Improvements in code generation, probably because the legacy lowering enabled
  some transformations that were sometimes harmful.

For SWDEV-516125.
2025-10-02 10:06:25 +02:00
Nikolas Klauser
66558d70dc
[libc++] Fix <__algorithm/find.h> when using -flax-vector-conversions=none (#161362) 2025-10-02 10:05:26 +02:00
Alejandro Álvarez Ayllón
5f5a84e850
[clang][analyzer] Clear ObjCMethodCall's cache between runs (#161327)
`lookupRuntimeDefinition` assumed that a process would handle only one
TU. This is not true for unit tests, for instance. Multiple snippets of
code get parsed, and their AST are unloaded each time.

Since the cache relies on pointers as keys, if the same address happens
to be reused between runs, the cache would return a stale pointer,
potentially causing a segmentation fault. This is not that unlikely if
the snippets are similar, which would trigger similar allocation
patterns.

CPP-4889
2025-10-02 09:59:00 +02:00
Nikolas Klauser
0b0dcf856a
[libc++] Upgrade Xcode to 26.0 (#160097) 2025-10-02 09:32:30 +02:00
jeanPerier
662f56f428
[flang] handle scalars in getDescriptorWithNewBaseAddress (#161515)
Follow up on #161347 to allow scalar fir.box/class reconstruction (at
least required for polymorphic types).
The assert in genDimInfoFromBox was rejecting scalars while there is no
functional reason for that (only assumed-rank are an issue there).
2025-10-02 09:27:27 +02:00
Simon Pilgrim
e5b8c24cc0
[DAG] Add ComputeNumSignBits(FREEZE(X)) handling (#161507)
If X is known never under/poison then skip the freeze and return ComputeNumSignBits(X)
2025-10-02 07:27:17 +00:00
Nikita Popov
a4767e63ee
[MemorySanitizer] Use getelementptr instead of ptrtoint+add+inttoptr (#161392)
MemorySanitizer currently does a lot of pointer arithmetic using
ptrtoint+add+inttoptr instead of using getelementptr. As far as I can
tell, there is no need to use this pattern -- msan is not trying to
synthesize pointers with different provenance here. The pointers in
question stay within one object (like the TLS parameter area).

I suspect that this is just a leftover from pre-opaque-pointer types
where this was a natural way to perform offset arithmetic. Nowadays we
should just emit a getelementptr i8, aka ptradd.
2025-10-02 09:16:08 +02:00
Stanislav Mekhanoshin
912a92a809
[AMDGPU] Update VOP3 gfx1250 tests to t16 syntax. NFC (#161611) 2025-10-01 23:15:11 -07:00
Stanislav Mekhanoshin
bd0f9db06a
[AMDGPU] Update gfx1250 vop3_from_vop1 tests to t16 syntax. NFC (#161609) 2025-10-01 23:14:52 -07:00
Stanislav Mekhanoshin
eedfbbe986
[AMDGPU] Update gfx1250 VOP1 tests to t16 syntax. NFC (#161603) 2025-10-01 23:14:26 -07:00
Kazu Hirata
17f6888d17 [IR] clang-format ValueMap.h
I'm planning to modify this file.
2025-10-01 22:38:20 -07:00
Yixuan Cao
bcc85f7670
[compiler-rt][asan][tests] Stabilize wchar tests on Darwin/Android (#161624)
### Summary
Stabilize ASan wchar tests across Darwin and Android. NFC: test-only.
Follow-up to PR #160493 (adds wchar interceptors/tests).

### Motivation
- Darwin: The top frame often resolves to `libclang_rt.asan_*` rather
than a source file, so strict checks that include file/line can fail.
See Chromium issue
[448631142](https://g-issues.chromium.org/issues/448631142).
- Android: The “ERROR:” header can go to logcat instead of stderr, so
FileCheck may not see it; stdout/stderr reordering also makes pre-crash
markers racy. See Android Buildbot
[186/12821](https://lab.llvm.org/buildbot/#/builders/186/builds/12821).

### Changes
- Android:
- Force reports to stderr via `%env_asan_opts=log_to_stderr=1`, avoiding
the “ERROR:” header going to logcat.
- Print the pre-crash “Good so far.” to stderr and `fflush(stderr)` to
avoid stdout/stderr reordering.
- Darwin:
- Relax the stack-frame check to only require the function name
(`wcscpy/wcsncpy/wcscat/wcsncat`) to tolerate `libclang_rt.asan_*`
frames.
- Common:
  - Reuse FileCheck var `[[ADDR]]` instead of redefining.
- Make wide string literals `const wchar_t*` to silence
`-Wwritable-strings`.

### Risk
- NFC: test-only; no change to runtime behavior.

### References
- Follow-up to PR #160493.
- Chromium: [448631142](https://g-issues.chromium.org/issues/448631142)
(Darwin failures).
- Android Buildbot:
[186/12821](https://lab.llvm.org/buildbot/#/builders/186/builds/12821).

Signed-off-by: Yixuan Cao <caoyixuan2019@email.szu.edu.cn>
2025-10-01 22:30:09 -07:00
Maksim Panchenko
d39095b193
[BOLT] Remove unused parameter. NFC (#161617)
`Skip` parameter not used/set inside `analyzeRelocation()`.
2025-10-01 22:21:12 -07:00
Matt Arsenault
9323fbbc4e
RegisterCoalescer: Avoid return after else (#161622) 2025-10-02 05:20:57 +00:00
Maksim Levental
fea2cca4d6
[MLIR][Python] expose Operation::setLoc (#161594) 2025-10-01 21:57:10 -07:00
Hongyu Chen
a88c83950b
[LLVM] Volunteer myself and Usman Nadeem as DFAJumpThreading maintainers (#161491)
Both Usman Nadeem and I have constantly contributed to the
DFAJumpThreading pass so far. To push DFAJumpThreading forwards and make
it enabled by default, I volunteer myself and Usman Nadeem as
DFAJumpThreading maintainers.
2025-10-02 12:53:38 +08:00
Matt Arsenault
c6e280e7ed
PeepholeOpt: Fix losing subregister indexes on full copies (#161310)
Previously if we had a subregister extract reading from a
full copy, the no-subregister incoming copy would overwrite
the DefSubReg index of the folding context.

There's one ugly rvv regression, but it's a downstream
issue of this; an unnecessary same class reg-to-reg full copy
was avoided.
2025-10-02 13:36:47 +09:00
Kazu Hirata
ac0e99e191 [Analysis] Fix a warning
This patch fixes:

  llvm/lib/Analysis/IR2Vec.cpp:289:14: error: unused variable
  'allSameDim' [-Werror,-Wunused-variable]
2025-10-01 20:06:15 -07:00
Craig Topper
129d5ce14c
[RISCV][GISel] Use LBU for anyext i8 atomic_load. (#161588)
This matches what we do for regular i8 extload due to the lack of c.lb
in Zbc.

This only affects global isel because SelectionDAG won't create an
anyext i8 atomic_load today.
2025-10-01 19:55:46 -07:00
Xiang Li
2d06374949
[mlir][arith] Add mulf(x, 0) -> 0 to mulf folder (#161395)
Fold  `mulf(x, 0) -> 0` when (nnan | nsz)
2025-10-01 22:47:53 -04:00
Samarth Narang
a2330a398d
[Clang][Sema] Switch diagnostics from toString to operator<< for APSInt/APInt (#161474) 2025-10-02 07:59:52 +05:30
Maksim Panchenko
9f4b6375b4
[BOLT][AArch64] Skip R_AARCH64_TLSDESC_CALL relocation (#161610)
R_AARCH64_TLSDESC_CALL is a relocation emitted as a hint for a linker to
replace `blr r` instruction with nop. BOLT does not currently require
any special handling for it.

Note that previously existing extraction of the relocated value was
incorrect.
2025-10-01 19:28:18 -07:00
Jim Lin
8b9e208448
[RISCV] Add helper function getVecPolicyOpNum in RISCVInsertVSETVLI.cpp. NFC. (#161476) 2025-10-02 10:01:28 +08:00
Mircea Trofin
e37a9732e1
[JTS][NFC] Optimize guid fetching (#161612)
It's unnecessary to build the whole symtable, and on top of everything,
un-optimal to do so for every function. All we really need is the
instrumented PGO name - considering also LTO-ness - and then we can
compute the function name.
2025-10-01 18:57:33 -07:00
hjagasiaAMD
3f3a20f654
[PATCH] offload-tunnel-cmake with proper escape (#161552)
Co-authored-by: ronlieb <ron.lieberman@amd.com>
2025-10-01 20:57:59 -04:00
Gang Chen
640644d68a
[AMDGPU] Move LowerBufferFatPointers after LoadStoreVectorizer and remove the fixme (#161531)
Move LowerBufferFatPointers pass after CodegenPrepare and
LoadStoreVectorizer pass, and remove the fixme about that.
2025-10-01 17:52:15 -07:00
David Salinas
bdea159093
Revert "Revert "Fix memory leak in Offloading API" (#161465)" (#161573)
This reverts commit d392563433316e310edacf35a40fb2f9aa477acc.
2025-10-01 20:47:47 -04:00
Alexey Samsonov
5f0f4972c4
[libc] Unify and extend no_sanitize attributes for strlen. (#161316)
Fast strlen implementations (naive wide-reads, SIMD-based, and
x86_64/aarch64-optimized versions) all may perform
technically-out-of-bound reads, which leads to reports under ASan,
HWASan (on ARM machines), and also TSan (which also has the capability
to detect heap out-of-bound reads). So, we need to explicitly disable
instrumentation in all three cases.

Tragically, Clang didn't support `[[gnu::no_sanitize]]` syntax until
recently, and since we're supporting both GCC and Clang, we have to
revert to `__attribute__` syntax.
2025-10-01 17:26:22 -07:00
S. VenkataKeerthy
ed1d9548b5
[IR2Vec] Refactor vocabulary to use section-based storage (#158376)
Refactored IR2Vec vocabulary and introduced IR (semantics) agnostic `VocabStorage`
- `Vocabulary` *has-a* `VocabStorage`
- `Vocabulary` deals with LLVM IR specific entities. This would help in efficient reuse of parts of the logic for MIR.
- Storage uses a section-based approach instead of a flat vector, improving organization and access patterns.
2025-10-01 17:13:13 -07:00
Wu Yingcong
4aaf6d1b8c
[libunwind][test] Add check for objcopy to improve test compatibility (#161112)
Previously, we only used `objcopy`, which is not available for some
build configurations. With this patch, we not only try to use `objcopy`,
but also try to use `llvm-objcopy` if available.

This is a follow-up of https://github.com/llvm/llvm-project/pull/156383.
2025-10-02 07:42:43 +08:00
Andre Kuhlenschmidt
4fccaaef70
[flang][runtime] fix intrinsics case of extends_type_of (#161466)
Fixes https://github.com/llvm/llvm-project/issues/155459 by making sure
the cases are considered in the right order. Previously intrinsics types
where overriding the pointer cases which have higher precedence in the
specification.

Also passes the following
[tests](https://github.com/llvm/llvm-test-suite/pull/287).
2025-10-01 16:40:00 -07:00
S. VenkataKeerthy
52b1850759
[IR2Vec] Add support for Cmp predicates in vocabulary and embeddings (#156952)
Comparison predicates (equal, not equal, greater than, etc.) provide important semantic information about program behavior. Previously, IR2Vec only captured that a comparison was happening but not what kind of comparison it was. This PR extends the IR2Vec vocabulary to include comparison predicates (ICmp and FCmp) as part of the embedding space.

Following are the changes:
1. Expand the vocabulary slot layout to include predicate entries after opcodes, types, and operands
2. Add methods to handle predicate embedding lookups and conversions
3. Update the embedder implementations to include predicate information when processing CmpInst instructions
4. Update test files to include the new predicate entries in the vocabulary

(Tracking issues: #141817, #141833)
2025-10-01 16:39:22 -07:00
Bruno Cardoso Lopes
aeffd3645a
[Docs] Add CIR related meetings to GettingInvolved page (#157181)
Co-authored-by: Andy Kaylor <akaylor@nvidia.com>
2025-10-01 16:10:53 -07:00
Craig Topper
9ba1121e3c
[RISCV] Remove break after return in RISCVVEmitter.cpp. NFC (#161599) 2025-10-01 16:07:26 -07:00
Georgiy Samoylov
b181c22c54
[lldb][RISCV] Fixed TestSymbolFileJSON for RISC-V (#161497)
This test failed during testing on the RISC-V target because we couldn't
strip the main label from the binary. main is dynamically linked when
the -fPIC flag is enabled. The RISC-V ABI requires that executables
support loading at arbitrary addresses to enable shared libraries and
secure loading (ASLR). In PIC mode, function addresses cannot be
hardcoded in the code. Instead, code is generated to load addresses from
the GOT/PLT tables, which are initialized by the dynamic loader. The
reference to main thus ends up in .dynsym and is dynamically bound. We
cannot strip main or any other dynamically linked functions because
these functions are referenced indirectly via dynamic linking tables
(.plt and .got). Removing these symbols would break the dynamic linking
mechanism needed to resolve function addresses at runtime, causing the
executable to fail to correctly call them.
2025-10-01 15:40:42 -07:00
Nicolai Hähnle
11a4b2d950
Cleanup the LLVM exported symbols namespace (#161240)
There's a pattern throughout LLVM of cl::opts being exported. That in
itself is probably a bit unfortunate, but what's especially bad about it
is that a lot of those symbols are in the global namespace. Move them
into the llvm namespace.

While doing this, I noticed some other variables in the global namespace
and moved them as well.
2025-10-01 15:32:07 -07:00
Jun Wang
bdd98a0147
[AMDGPU] Add documentation files for GFX12. (#157151)
This patch adds documentation files for GFX12.
2025-10-01 15:31:50 -07:00
Amir Ayupov
780f69cd92
[Clang][CMake] Add CSSPGO support to LLVM_BUILD_INSTRUMENTED (#79942)
Build on Clang-BOLT infrastructure to collect sample profile for CSSPGO.
Add CSSPGO.cmake and BOLT-CSSPGO.cmake to automate CSSPGO/+BOLT 
Clang builds.

Note that `CLANG_PGO_TRAINING_DATA_SOURCE_DIR` is required as built-in 
training set is inadequate for collecting sampled profile.

Hardware compatibility: CSSPGO requires synchronized (0-skid) call
and branch stacks, which is only available with Intel PEBS (Sandy
Bridge+),
AMD Zen3 with BRS, Zen4 with LBRv2+LBR_PMC_FREEZE, and Zen5 with LBRv2.
This patch adds support for Intel `br_inst_retired.near_taken:uppp`
event.

Test Plan:
Added BOLT-CSSPGO.cmake with same use as BOLT-PGO.cmake, 
e.g. for bootstrapped ThinLTO+CSSPGO+BOLT, with CSSPGO profile collected
from LLVM build, and BOLT profile collected from Hello World
(instrumentation):
```
cmake -B clang-csspgo-bolt -S /path/to/llvm-project/llvm \
-DLLVM_ENABLE_LLD=ON -DBOOTSTRAP_LLVM_ENABLE_LLD=ON \
-DBOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD=ON \
-DPGO_INSTRUMENT_LTO=Thin \
-DBOOTSTRAP_CLANG_PGO_TRAINING_DATA_SOURCE_DIR=/path/to/llvm-project/llvm \
-GNinja  -C /path/to/llvm-project/clang/cmake/caches/BOLT-CSSPGO.cmake
ninja stage2-clang-bolt
...
warning: Sample PGO is estimated to optimize better with 19.5x more samples. Please consider increasing sampling rate or profiling for longer duration to get more samples.
...
[2800/2801] Optimizing Clang with BOLT
BOLT-INFO: 8189 out of 106942 functions in the binary (7.7%) have non-empty execution profile
            13776393 : taken branches (-42.1%)
```

Performance testing with Clang:
- Setup: Clang-BOLT testing harness
9f2b46f67a
  - CSSPGO training: building LLVM, 
  - InstrPGO training: building Hello World,
  - BOLT training: building Hello World, instrumentation,
  - benchmark: building small LLVM tool (not),
- 2S Intel SKX Xeon 6138 with 40C/80T and 256GB RAM, using 20C/40T for
build,
- Results, wall time, lower is better
  - Baseline (bootstrapped build): 10.36s,
  - InstrPGO + ThinLTO: 9.34s,
  - CSSPGO + ThinLTO: 8.85s.
- BOLT results, for reference:
  - Baseline: 9.09s,
  - InstrPGO + ThinLTO: 9.09s,
  - CSSPGO + ThinLTO: 8.58s.

---------

Co-authored-by: Matthias Braun <matze@braunis.de>
2025-10-01 15:25:34 -07:00
Andy Kaylor
1e4d4bb584
[Clang][NFC] Refactor operator delete argument handling (#160554)
This change moves the getUsualDeleteParams function into the
FunctionDecl class so that it can be shared between LLVM IR and CIR
codegen.
2025-10-01 15:14:38 -07:00
Alexey Bader
e2f8bfc550
[clang-sycl-linker][NFC] Remove dead includes (#161564)
These includes are not used by ClangSYCLLinker.cpp directly.
Explicitly include FormatVariadic.h for formatv declaration, which was implicitly included by removed headers.
2025-10-01 15:07:12 -07:00
Ryosuke Niwa
103d2cae80
[alpha.webkit.RetainPtrCtorAdoptChecker] Allow leakRef in copy methods (#160986)
Allow leakRef() in the return statement of an Objective-C copy method
and other methods which return +1.
2025-10-01 15:01:44 -07:00
Jan Svoboda
f122484b99
[llvm][support] Move make_absolute from sys::fs to sys::path (#161459)
The `llvm::sys::fs::make_absolute(const Twine &, SmallVectorImpl<char>
&)` functions doesn't perform any FS access - it only modifies the
second parameter via path/string operations. This function should live
in the `llvm::sys::path` namespace for consistency and for making it
easier to spot function calls that perform IO.
2025-10-01 14:35:17 -07:00
Jan Svoboda
39410dff52
[clang] Invert condition refactored in #160935 (#161583)
The PR #160935 incorrectly replaced `llvm::sys::fs::getUniqueID()` with
`llvm::vfs::FileSystem::exists()` in a condition. That's incorrect,
since the first function returns `std::error_code` that evaluates to
`true` when there is an error (file doesn't exist), while the new code
does the opposite. This PR fixes that issue by inverting the
conditional.

Co-authored-by: ronlieb <ron.lieberman@amd.com>
2025-10-01 14:34:02 -07:00