Skip to content

Merge upstream/llvm into amd-debug - #3873

Merged
mariusz-sikora-at-amd merged 242 commits into
amd-debugfrom
amd/dev/masikora/amd-debug-merge-candidate
Aug 13, 2026
Merged

Merge upstream/llvm into amd-debug#3873
mariusz-sikora-at-amd merged 242 commits into
amd-debugfrom
amd/dev/masikora/amd-debug-merge-candidate

Conversation

@mariusz-sikora-at-amd

Copy link
Copy Markdown

Multiple merge-commits, synced with top of upstream llvm

[1]

commit d87d5052b80b68bd70b7470d24bec65da41ff74c (HEAD -> amd/dev/masikora/amd-debug-merge-candidate)
Merge: a0b792d2cf53 8365c9085c63
Author: Mariusz Sikora <mariusz.sikora@amd.com>
Date:   Wed Aug 12 10:03:26 2026 -0400

    Merge llvm/main into amd-debug

diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
remerge CONFLICT (content): Merge conflict in llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
index bad509ecb39c..4e1b98cf60cf 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
@@ -579,15 +579,9 @@ bool DwarfExpression::addExpression(
   // and not any other parts of the following DWARF expression.
   assert(!IsEmittingEntryValue && "Can't emit entry value around expression");

-<<<<<<< a0b792d2cf53 (Merge llvm/main into amd-debug)
   IsPoisonedExpr = false;

-  std::optional<DIExpression::ExprOperand> PrevConvertOp;
-||||||| cff4ca2e51f8
-  std::optional<DIExpression::ExprOperand> PrevConvertOp;
-=======
   std::optional<DIExpression::ConvertOp> PrevConvertOp;
->>>>>>> 8365c9085c63 ([RISCV][P-ext] Support Packed Multiply High (#211223))

   while (ExprCursor) {
     auto Op = ExprCursor.take();
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
remerge CONFLICT (content): Merge conflict in llvm/lib/IR/DebugInfoMetadata.cpp
index 2ec4edbfed26..76e131dc836a 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -1800,7 +1800,43 @@ bool DIExpression::ExprOperand::isNonEmitting() const {
   return getOp() == dwarf::DW_OP_LLVM_tag_offset;
 }

-<<<<<<< a0b792d2cf53 (Merge llvm/main into amd-debug)
+bool DIExpression::ArgOp::classof(const ExprOperand *Op) {
+  return Op->is(dwarf::DW_OP_LLVM_arg);
+}
+
+bool DIExpression::FragmentOp::classof(const ExprOperand *Op) {
+  return Op->is(dwarf::DW_OP_LLVM_fragment);
+}
+
+bool DIExpression::ExtractBitsOp::classof(const ExprOperand *Op) {
+  return Op->is(dwarf::DW_OP_LLVM_extract_bits_sext) ||
+         Op->is(dwarf::DW_OP_LLVM_extract_bits_zext);
+}
+
+bool DIExpression::ExtractBitsOp::isSigned() const {
+  return is(dwarf::DW_OP_LLVM_extract_bits_sext);
+}
+
+bool DIExpression::ConvertOp::classof(const ExprOperand *Op) {
+  return Op->is(dwarf::DW_OP_LLVM_convert);
+}
+
+bool DIExpression::EntryValueOp::classof(const ExprOperand *Op) {
+  return Op->is(dwarf::DW_OP_LLVM_entry_value);
+}
+
+bool DIExpression::TagOffsetOp::classof(const ExprOperand *Op) {
+  return Op->is(dwarf::DW_OP_LLVM_tag_offset);
+}
+
+bool DIExpression::ConstuOp::classof(const ExprOperand *Op) {
+  return Op->is(dwarf::DW_OP_constu);
+}
+
+bool DIExpression::PlusUconstOp::classof(const ExprOperand *Op) {
+  return Op->is(dwarf::DW_OP_plus_uconst);
+}
+
 namespace {
 /// Extends validation to include Arguments and DataLayout when available,
 /// falling back to assuming the expression is valid when these are not
@@ -1994,48 +2030,6 @@ bool DIExpression::isValid(
       *ErrS << Verifier.getErrorMsg() << '\n';
     return Result;
   }
-||||||| cff4ca2e51f8
-bool DIExpression::isValid() const {
-=======
-bool DIExpression::ArgOp::classof(const ExprOperand *Op) {
-  return Op->is(dwarf::DW_OP_LLVM_arg);
-}
-
-bool DIExpression::FragmentOp::classof(const ExprOperand *Op) {
-  return Op->is(dwarf::DW_OP_LLVM_fragment);
-}
-
-bool DIExpression::ExtractBitsOp::classof(const ExprOperand *Op) {
-  return Op->is(dwarf::DW_OP_LLVM_extract_bits_sext) ||
-         Op->is(dwarf::DW_OP_LLVM_extract_bits_zext);
-}
-
-bool DIExpression::ExtractBitsOp::isSigned() const {
-  return is(dwarf::DW_OP_LLVM_extract_bits_sext);
-}
-
-bool DIExpression::ConvertOp::classof(const ExprOperand *Op) {
-  return Op->is(dwarf::DW_OP_LLVM_convert);
-}
-
-bool DIExpression::EntryValueOp::classof(const ExprOperand *Op) {
-  return Op->is(dwarf::DW_OP_LLVM_entry_value);
-}
-
-bool DIExpression::TagOffsetOp::classof(const ExprOperand *Op) {
-  return Op->is(dwarf::DW_OP_LLVM_tag_offset);
-}
-
-bool DIExpression::ConstuOp::classof(const ExprOperand *Op) {
-  return Op->is(dwarf::DW_OP_constu);
-}
-
-bool DIExpression::PlusUconstOp::classof(const ExprOperand *Op) {
-  return Op->is(dwarf::DW_OP_plus_uconst);
-}
-
-bool DIExpression::isValid() const {
->>>>>>> 8365c9085c63 ([RISCV][P-ext] Support Packed Multiply High (#211223))
   for (auto I = expr_op_begin(), E = expr_op_end(); I != E; ++I) {
     // Check that there's space for the operand.
     if (I->get() + I->getSize() > E->get())
@@ -2457,18 +2451,10 @@ bool DIExpression::extractLeadingOffset(
 bool DIExpression::hasAllLocationOps(unsigned N) const {
   SmallDenseSet<uint64_t, 4> SeenOps;
   for (auto ExprOp : expr_ops())
-<<<<<<< a0b792d2cf53 (Merge llvm/main into amd-debug)
-    if (ExprOp.getOp() == dwarf::DW_OP_LLVM_arg)
-      SeenOps.insert(ExprOp.getArg(0));
-    else if (ExprOp.getOp() == dwarf::DW_OP_LLVM_poisoned)
-      return true;
-||||||| cff4ca2e51f8
-    if (ExprOp.getOp() == dwarf::DW_OP_LLVM_arg)
-      SeenOps.insert(ExprOp.getArg(0));
-=======
     if (auto Arg = dyn_cast<ArgOp>(ExprOp))
       SeenOps.insert(Arg.getIndex());
->>>>>>> 8365c9085c63 ([RISCV][P-ext] Support Packed Multiply High (#211223))
+    else if (ExprOp.getOp() == dwarf::DW_OP_LLVM_poisoned)
+      return true;
   for (uint64_t Idx = 0; Idx < N; ++Idx)
     if (!SeenOps.contains(Idx))
       return false;
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index fe2cb561d7bb..2f1b068d897c 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/unittests/IR/MetadataTest.cpp
@@ -3821,7 +3821,8 @@ TEST_F(DIExpressionTest, GetActiveBits) {
     auto *Type = DIBasicType::get(Context, dwarf::DW_TAG_base_type, Name, 64, 0,
                                   Encoding, DINode::FlagZero);
     return DILocalVariable::get(Context, getSubprogram(), Name, getFile(), 0,
-                                Type, 0, DINode::FlagZero, 0, nullptr);
+                                Type, 0, DINode::FlagZero,
+                                dwarf::DW_MSPACE_LLVM_none, 0, nullptr);
   };
   auto *SignedVar = MakeVariable("signed", dwarf::DW_ATE_signed);
   auto *UnsignedVar = MakeVariable("unsigned", dwarf::DW_ATE_unsigned);

[2]

commit 0da841ebaaef1cd11e76db5da2897d7366bb03ea
Merge: 0810fecb2297 23a601dc9690
Author: Mariusz Sikora <mariusz.sikora@amd.com>
Date:   Wed Aug 12 09:29:50 2026 -0400

    Merge llvm/main into amd-debug

diff --git a/llvm/include/llvm/IR/DIBuilder.h b/llvm/include/llvm/IR/DIBuilder.h
remerge CONFLICT (content): Merge conflict in llvm/include/llvm/IR/DIBuilder.h
index 0a9ab5aad4db..ee860497fb81 100644
--- a/llvm/include/llvm/IR/DIBuilder.h
+++ b/llvm/include/llvm/IR/DIBuilder.h
@@ -90,28 +90,12 @@ namespace llvm {
     void insertDbgVariableRecord(DbgVariableRecord *DVR,
                                  InsertPosition InsertPt);

-<<<<<<< 0810fecb2297 (Merge llvm/main into amd-debug)
-    /// Internal helper with common code used by insertDbg{Value,Addr}Intrinsic.
-    Instruction *insertDbgIntrinsic(llvm::Function *Intrinsic, llvm::Value *Val,
-                                    DILocalVariable *VarInfo,
-                                    DIExpression *Expr, const DILocation *DL,
-                                    InsertPosition InsertPt);
-
     /// Internal helper for insertDbgAddrIntrinsic.
     Instruction *
     insertDbgAddrIntrinsic(llvm::Value *Val, DILocalVariable *VarInfo,
                            DIExpression *Expr, const DILocation *DL,
                            BasicBlock *InsertBB, Instruction *InsertBefore);

-||||||| 37aca9d38434
-    /// Internal helper with common code used by insertDbg{Value,Addr}Intrinsic.
-    Instruction *insertDbgIntrinsic(llvm::Function *Intrinsic, llvm::Value *Val,
-                                    DILocalVariable *VarInfo,
-                                    DIExpression *Expr, const DILocation *DL,
-                                    InsertPosition InsertPt);
-
-=======
->>>>>>> 23a601dc9690 ([clang][KCFI] Skip the KCFIPass on Hexagon (#211716))
   public:
     /// Construct a builder for a module.
     ///

aaupov and others added 30 commits August 11, 2026 07:14
The heatmap produces a CDF (code coverage @ given sample pct), but only
writes it out as a table. Add two things:
1. Recompute CDF with scaled bucket sizes,
2. Log CDF at given sample pct (`-heatmap-cdf-pct` default p99) + total.

This effectively reports the code working set size (p99 and total),
expressed in units that map to uarch sizes: cache line (64B), base page
(4/16/64K), region table (2M), huge page (2M for PMD w/4K base), etc.

Sizes of interest can be specified using `-block-size=size1,size2,...`

Test Plan:
updated heatmap.test
…lvm#211066)

Adds a WttReport reporter and a --wtt-output <file> option that writes a
WTT (Windows Test Technology) .wtl log. This lets lit report test
specific pass/fail results in a format consumable by Windows lab
infrastructure.

The reporter follows the existing pattern in reports.py (ResultDBReport,
XunitReport, TimeTraceReport) and is wired through cl_arguments.py like
the other output options. PASS/XFAIL map to Pass and everything else to
Fail. UNSUPPORTED tests are reported as Pass with a summary of skipped
tests.

Note: AI was used to help create the file.write commands and for
creating the testing content based on issues humans and AI resolved
during development.

Associated RFC:
https://discourse.llvm.org/t/rfc-add-a-wtt-output-format-for-reporting-lit-results-to-windows-test-infrastructure/91215
…llvm#203255)

A mask allowing LDSDMA (0x800) still kept LDSDMA ops pinned, because
canAddMI matched them as VMEM and invertSchedBarrierMask left the DS bit
set
…out (NFC) (llvm#215358)

The abbreviation CS (Context-Sensitive) is overloaded across LLVM
AutoFDO to describe two different concepts:

1. CSSPGO (FunctionSamples::ProfileIsCS == true): Profiles with
   SecCSNameTable where top-level entries are keyed by full callstack
   vectors (e.g., "A", "A->B", "A->B->C"). Multiple top-level keys can
   end in the same leaf GUID, making a 1-to-1 GUID offset array
   impossible.

2. Nested Profiles (IsCS / CSKeys when ProfileIsCS == false): Regular
   AutoFDO profiles where top-level entries are strictly individual
   function GUIDs ("A"), but their sample trees contain nested inline
   callsite samples. The Eytzinger layout is 100% compatible with this
   mode.

Using CS for both features is very confusing because IsCS and CSKeys
may appear to be related to CSSPGO.

This patch renames Eytzinger layout identifiers to contrast "Nested"
against "Flat", leaving FunctionSamples::ProfileIsCS intact:

- EytzingerSpan::CS -> EytzingerSpan::Nested
- CSKeys -> NestedKeys
- IsCS -> IsNested
- isContextSensitiveTopLevel() -> hasCallsiteSamples()

Assisted-by: Antigravity
…4539)

Extends the 'structured.tile_using_for' op to accept packed handle
containing variable number of tile sizes, and dynamic and packed loop
interchange values.

Packed handles allows for runtime tiling decisions which improves
transform schedule flexibility and reusability.
The extension follows the existing approach used by other tiling ops.

Assisted-by: Claude
…lvm#215465)

FunctionPointers are always regular Pointers these days.
The function `hasReturnTypeDeclaredInside` and a related visitor class
was used to detect recursive import of function declarations. There is
now a new way to detect the recursive import that works in all cases
(unlike the previous method). A test is added to show a case when
the old solution does not work.
Trip-count expressions are never dead.
…lvm#215459)

`x86` AMX lowering looks to patten match with `transfer_write` or
`store` and hence it doesn't re-write for epilogue ops.
This patch fixes/extend the lower pattern of AMX to not care about
epilogue ops.

Issue: libxsmm/tpp-mlir#1171
The complex folder `log(exp(z)) -> z` leads to a miscompile if |Im(z)|
\> pi since `clog` is expected to return the principal value of the
complex log, whose imaginary part is in `(pi, pi]`.

Since we cannot assume properties on `z`, this PR removes the incorrect
folder and updates the associated test.
…lvm#213813)

Lower ISD::CONVERT_TO_ARBITRARY_FP to the packed hardware conversions on
subtargets that have the OCP fp8 formats.

An f32 source becomes V_CVT_PK_FP8_F32 or V_CVT_PK_BF8_F32. An f16
source becomes V_CVT_PK_FP8_F16 or V_CVT_PK_BF8_F16, which only gfx1250
and later have. A scalar conversion converts one lane and leaves the
other unused, a v2 conversion fills both lanes of the packed result.

Assisted-by: Claude-Opus-5
…vm#214703)

visitAccessGroupMetadata misses one case: a node that is empty but not
'distinct'. It is not a valid access group, and the list loop runs zero
times, so nothing is reported:

  store double %v, ptr %q, !llvm.access.group !0
  !0 = !{}

That IR reaches addToAccessGroupList(), which reads a node with no
operands as an access group and trips its isValidAsAccessGroup() assert.

Check the operand count first, so an empty node must be 'distinct'. Two
tests used !{} as an access group and now use distinct !{}.

Unlocks llvm#214509
llvm#215180)

On a flat-scratch target, a frame index used by a VALU instruction
reaches the generic SGPR-scavenging path in
`SIRegisterInfo::eliminateFrameIndex`. When the function has a frame
register but no SGPR is free for the scavenger, control enters the
branch that assumes no frame register exists (the flat-scratch SVS /
fatal-error fallback), whose guard `assert(!FrameReg && "there is a
frame register!")` then fires.

This PR got a test that catches the above mentioned crash!

---------

Co-authored-by: Christudasan Devadasan <christudasan.devadasan@amd.com>
This implements the CostModelling in the RISCV-TTI as discussed in:
llvm#184578

It takes the legalization and non-boolean element-type lowering into
account, instead of falling back to the generic BasicTTIImpl path. This
now gets rid of the assertion-crash mentioned on the original PR.
…2304)

As a result of the almost complete transition from debug intrinsics to
debug records, a few functions are now unused in the public API. This
patch removes those.
…m#208552)" and follow-ups commits (llvm#215320)

The initial fix for llvm#164273 had several follow up commits to fix the
initial implementation. This fix induces a lot of regressions and a
refactoring of the area is required in order to fix the issue in a later
release.

This reverts the following commits (from oldest to latest):
72af746
226acaf
d592aa5
34436db
de4b1f5
…m#213344)

This adds a new `ISD::VECTOR_MATCH` opcode that corresponds to the
`experimental.vector.match` intrinsic and implements basic type
legalization.

Right now, this does not support many more cases than the existing
lowering. A follow up patch will handle supporting needle sizes <= the
maximum size without falling back to expansion on AArch64.

Assisted-by: Codex
…ads (llvm#214267)

Extending loads, i8 to i16, are legal on targets with true16.
Note: there is potentially a missing rule for uniform P4 when target
usesTrue16 and hasSMRDSmall but MMO does not satisfy isUL. Wasn't able
to construct an LLVM-IR test for this case, leaving it unsupported.
…215292)

`CASPluginTest` is a unit-test plugin, but it ends up in the installed
`LLVMExports.cmake` and in `LLVM_AVAILABLE_LIBS`.
Installs that don't ship `libCASPluginTest` then fail every
`find_package(LLVM)` with a `FATAL_ERROR`, so nothing out-of-tree can
configure against them.

`BUILDTREE_ONLY` limits the plugin to the build-tree export set. The CAS
unit tests load it by a path relative to the test executable, so they
keep working.

This is a follow-up to llvm#213331.
Regression found in [Out-of-Tree CI
builds](https://github.com/KhronosGroup/SPIRV-LLVM-Translator/actions/runs/31229501194/job/93030341651)
of KhronosGroup/SPIRV-LLVM-Translator:
```
CMake Error at /usr/lib/llvm-24/lib/cmake/llvm/LLVMExports.cmake:1944 (message):
  The imported target "CASPluginTest" references the file

     "/usr/lib/llvm-24/lib/libCASPluginTest.so.24.0"

  but this file does not exist. 
```

AI-assisted: Claude Opus 5 (commercial SaaS)
…#214509)

mergeStoreIntoSuccessor builds a fresh StoreInst and copies only
AAMDNodes, so !llvm.access.group is dropped even when both original
stores carry the same group.

llvm.loop.parallel_accesses is all-or-nothing: isAnnotatedParallel()
requires every memory operation in the loop to be a member, so one
untagged store de-parallelises the whole loop and LoopVectorize can
refuse a loop that is parallel by construction.
…lvm#215032)

Avoid hitting the fatal error in makeLibCall by emitting a diagnostic
if the library call is unsupported.

Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
Most concerning is the different (poison) result on SSE2 targets, but
the failure for SimplifyDemandedBits to correctly do its thing for AVX+
is terrible as well.
Add a helper function to return the effective long double type
for a module, accounting for the "long-double-type" module flag,
and defaulting to the triple's default.

Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
…5115)

Inspection of the glibc sources suggests this is generically
available, with the target variance being for long double support.
The set of library functions is a large historical mess I'm attempting
to untangle. The traditional system had a large set of defaulted calls,
but sincos was a case which was explicitly enabled, and I'm assuming
riscv just never got around to adding it. It will be easier to
reorganize the library functions if synthetic architectural glibc
variance is eliminated.

Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
On llvm#215074, they are building
lldb with LLVM_REVERSE_ITERATION enabled.

This caused lldb/test/Shell/Commands/command-version.test to fail
because the keys came out in a different order.

I could just fix the test by using CHECK-DAG instead, but I thought it
would be nice to print them in a fixed order instead.
Then you can compare between copies of lldb without having to sort them
first.

I've implemented that in the command as we don't seem to give any
ordering guarantee for StructuredData::Dictionary and likely don't want
to at this point.

Example output:
```
(lldb) version -v
lldb version 24.0.0git (https://github.com/llvm/llvm-project.git revision 3e9127b
3d5f76861)
  clang revision 3e9127b
  llvm revision 3e9127b
  curl: no
  curses: yes
  editline: yes
  editline_wchar: yes
  lua: no
  lzma: yes
  python: yes
  targets: [AArch64, <...>]
  xml: yes
  zlib: yes
```
`CreateToolhelp32Snapshot` reads a list of processes which is edited as
it's iterating it. This can cause it to fail with `ERROR_BAD_LENGTH`.
The documented fix is to retry until it succeeds:

> If the function fails with ERROR_BAD_LENGTH, retry the function until
it succeeds.


https://learn.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot

This should help fix flakyness with the `TestDAP_attach` test on
Windows.
…ction of a mask (llvm#215187)

foldPartialReduceAdd synthesises the reduction's multiplier at the
operand's type. At i1 a splat of 1 is all ones, which sign extends to
-1, so the signed forms compute (-1) x (-1) = +1 per lane and sum to +n
where sum(sext(mask)) must be -n.

```llvm
%cmp  = icmp eq <16 x i8> %a, %b
%sext = sext <16 x i1> %cmp to <16 x i32>
%r    = call <4 x i32> @llvm.vector.partial.reduce.add(<4 x i32> %acc, <16 x i32> %sext)
```

-mattr=+neon sums to -n:

```
cmeq    v1.16b, v1.16b, v2.16b
sshll   v2.8h, v1.8b, #0
sshll2  v1.8h, v1.16b, #0
saddw   v0.4s, v0.4s, v2.4h
saddw2  v0.4s, v0.4s, v2.8h
saddw   v0.4s, v0.4s, v1.4h
saddw2  v0.4s, v0.4s, v1.8h
```

-mattr=+neon,+dotprod sums to +n:

```
movi    v3.2d, #0xffffffffffffffff
cmeq    v1.16b, v1.16b, v2.16b
sdot    v0.4s, v1.16b, v3.16b
```

This patch extends i1 masks to the promoted type before the multiplier
is built. That gives `movi v3.16b, #1` and the dot product path agrees
with the expansion.

Part of llvm#204897.
zeyi2 and others added 15 commits August 12, 2026 18:49
…readability-identifier-naming` (llvm#215734)

Treat `DefaultHungarianPrefix` as a valid
`readability-identifier-naming` option and check that a class has a
definition before calling `isAbstract()` to compute its Hungarian
prefix.

Closes llvm#215732
…lvm#215753)

Ivars can have negative offsets, for example if an ivar from a derived
class is placed inside the super classes padding.
Currently, the offset is computed as an `uint64_t`, which results in an
integer wraparound for negative offsets.
The wrapped offset is then written to a global value to be parsed by
libobjc2. When libobjc2 reads the value as a truncated signed `int`, it
is again implicitly converted correct negative number. However, with
assertions enabled we hit an assertion failure in LLVM when creating the
global value. See https://godbolt.org/z/Yb7cvWTqP.
GitHub has two apples, 🍎 which is red and 🍏 which is
green. Red might be mistaken for a failure at a glance if the report has
no listed failures, so I chose green.

Also added a fallback path for unhandled systems.
Instead of a typedef. Save offsets and infos separately to speed up the
binary search a bit.
…lvm#192471)

`InitListChecker::CheckScalarType()` crashed with multiple nested braces
in scalar initializers (e.g., `int v = {{}, {}, {}};`) due to
out-of-bounds access when retrieving diagnostic location from
uninitialized StructuredList.

Add bounds checking before `getInit(0)` access and add regression test

Fix llvm#137845. Fix llvm#69213. Fix llvm#198767. Fix llvm#207566. Fix llvm#106180.
As a follow up to commit d4c991d
([clang-tidy][NFC] Apply const-correctness for auto 1/N (llvm#213839)) we
make sure to use a const reference when iterating of FixLocations.

As indicated by -Wrange-loop-construct this prevents a copy from type
'std::pair<clang::SourceLocation, bool> const'.
…hmarks (llvm#214302)

The set_intersection benchmark was taking around 15% of the time of the
whole test suite by itself. It generated 1296 test cases including many
that were irrelevant. It also nested two mutually exclusive
GoogleBenchmark iteration APIs (a for-loop on state and
KeepRunningBatch), leading to invalid results anyway.

This patch rewrites the benchmark with manually curated cases instead.

Fixes llvm#120763

Assisted by Claude
…r tests (llvm#214700)

Extended LLTs are enabled for AMDGPU, so `LLT::integer` prints iN and
the kind-less sN in these test bodies no longer reflects what the
legalizer works with. Several of these tests already showed a mix of
both kinds in their assertions, because the value types came from the
test body while the types the legalizer creates internally are typed.

Switch the scalar value types in the bodies to iN and regenerate the
assertions. The generated code is almost unchanged; the difference is
that constants which previously differed only in kind now CSE, so a few
redundant G_CONSTANTs disappear.

Vector types are left alone. The AMDGPU legality rules use
`LLT::fixed_vector(N, Size)`, whose element is a kind-less ANY_SCALAR
that compares equal to any same-size scalar, so both <2 x i16> and <2 x
f16> already match them. Migrating vecotrs is a separate change that has
to update the rules, and is out of scope here.
…r/to_buffer (llvm#215357)

The bufferization dialect attaches no `ValueBoundsOpInterface` models,
so a bound query that reaches a tensor materialized from a buffer stops
at the `bufferization.to_tensor`, even though the memref side is
analyzable: upstream models `memref.alloc`, `memref.cast`, `memref.dim`,
`memref.get_global` and `memref.subview`. The mirror case has the same
problem: a query that reaches a buffer materialized from a tensor stops
at the `bufferization.to_buffer`.

This matters during bufferization. An operand that was a tensor is by
then a `to_tensor` of the buffer of the producer, so every bound query
through it fails.

Attach a model to both ops. For `to_tensor`, the tensor and its source
buffer describe the same memory, so they have the same size in every
dimension. For `to_buffer`, the op carries `SameOperandsAndResultShape`,
so the buffer and its source tensor have the same size in every
dimension. Both ops also accept tensor-like and buffer-like types that
are not shaped, for which no bound can be computed.

Code generated with Claude code.

Signed-off-by: Víctor Pérez Carrasco <victor.pc.upm@gmail.com>
Require PODSmallVector to have a non-zero inline capacity.
PODSmallVector<T, 0> can reach reserve(0) when growing from
an empty vector, leaving the capacity at zero. Add a static_assert
requiring N > 0 to prevent this unsupported configuration.
@rocm-cciapp

rocm-cciapp Bot commented Aug 12, 2026

Copy link
Copy Markdown

@mariusz-sikora-at-amd

Copy link
Copy Markdown
Author

ping

@mariusz-sikora-at-amd
mariusz-sikora-at-amd merged commit cc8cd4f into amd-debug Aug 13, 2026
29 of 31 checks passed
@mariusz-sikora-at-amd
mariusz-sikora-at-amd deleted the amd/dev/masikora/amd-debug-merge-candidate branch August 13, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.