Skip to content

merge main into amd-staging#2740

Open
ronlieb wants to merge 15 commits into
amd-stagingfrom
amd/merge/upstream_merge_20260530235210
Open

merge main into amd-staging#2740
ronlieb wants to merge 15 commits into
amd-stagingfrom
amd/merge/upstream_merge_20260530235210

Conversation

@ronlieb
Copy link
Copy Markdown
Collaborator

@ronlieb ronlieb commented May 31, 2026

No description provided.

aengelke and others added 15 commits May 30, 2026 19:31
BasicBlock currently uses this for HasAddressTaken. ConstantExpr uses
this for flags and it should not be possible to modify constant
expressions after they have been created.

Therefore, update the documentation accordingly and remove the unsafe
clearSubclassOptionalData.

Remove hasSameSubclassOptionalData, as it is unused.
…elves (llvm#200536)

Using createCallMatchingInvoke ensures we copy metadata from the invoke
onto the call.

This bug was found by a large run of Opus 4.7 looking for bugs in LLVM.
…m#200595)

DenseMap uses quadratic probing with lazy deletion: an erased entry
becomes a tombstone, a third bucket state alongside empty and live that
every find/insert must inspect.

Switch to linear probing with backward-shift deletion (Knuth TAOCP 6.4
Algorithm R), similar to the SmallPtrSet change llvm#197637. This removes
the tombstone state entirely.

In exchange, erase now relocates the following live entries to close the
hole, so it invalidates iterators and references other than the erased
one. For callers that cache pointers into the bucket array,
erase(Key, OnMoved) and erase(iterator, OnMoved) fire a callback once
per
shifted bucket, so fix-ups cost O(cluster) rather than O(NumEntries).
ValueHandleBase::RemoveFromUseList uses this to refresh each moved
handle's PrevPtr.

Linear probing is more vulnerable to primary clustering than quadratic
probing, so this relies on the stronger DenseMapInfo<T*>::getHashValue
mixer from llvm#197390.

Operation distribution when compiling CGExpr.cpp/ScalarEvolution.cpp:
62.8% lookups, 34.3% inserts, 2.9% erases. The heaviest DenseMap
specializations have pointer keys and 16-byte key/value pairs.
Alternatives such as Robin Hood hashing, Verstable, and Boost's
unordered_flat_map were evaluated; they are slower and have a larger
code footprint. I believe the current in-band sentinel value approach,
despite the pain (llvm#146595), is the best, or at least very difficult to
beat.

---

This is a pure reland of llvm#199615 (reverted in llvm#200421) after fixing
the PoisoningVH bug by llvm#200540.
Non-core cleanups aided by Claude Opus 4.7.
…patterns (REAPPLIED) (llvm#200604)

Add matchShuffleAsVSHLD helper to recognise shuffle masks that can fold
to funnel shifts

Reapplied with fix for shift amount not being appropriately scaled -
test case added at llvm#200569

Fixes llvm#145276
Ptr may be nullptr, use dyn_cast_or_null to fix crash.

Fixes llvm#200330.
In preparation to get getOpcodeOrIntrinsicID used by CSE to handle calls
and to constant-fold intrinsic calls, factor out vputils::getIntrinsicID
from VPlanPatternMatch to re-use.
Extend TargetFolder and InstSimplifyFolder to fold unary intrinsics.
CreateUnaryIntrinsic now returns a Value, similar to
CreateBinaryIntrinsic, and this has necessitated more changes.
Closes llvm#105419
Closes llvm#105348
Closes llvm#105349
Closes llvm#171314

Assisted-by: Chatgpt. 
I use AI to help me write some tests, however. I have reviewed the code
I submit in the tests.

---------

Co-authored-by: A. Jiang <de34@live.cn>
Co-authored-by: Hristo Hristov <hghristov.rmm@gmail.com>
Co-authored-by: Hristo Hristov <zingam@outlook.com>
…00615)

Groundwork for llvm#200478

Add /*name=*/ comments to ambiguous literal call-site arguments in
compiler-rt/lib/asan/asan_allocator.cpp so the parameter name is visible
at the call site for the Allocate / instance.Allocate uses. Covers the
can_fill flag and the bare alignment literals (8, 16, 0) used by:

  asan_malloc / asan_vec_malloc / asan_realloc / asan_valloc /
  asan_pvalloc / asan_memalign / asan_aligned_alloc /
  asan_posix_memalign / asan_new / asan_new_aligned

and the internal Reallocate / Calloc paths.

NFC.

Assisted by: Claude Opus 4.7
Depends on llvm#200615
Groundwork for llvm#196413.

Mechanical cleanup of allocator related files in preparation of
functional changes. clang-format (v21.1.2) applied whole-file to:

  compiler-rt/lib/asan/asan_allocator.cpp
  compiler-rt/lib/asan/asan_allocator.h
  compiler-rt/lib/asan/asan_malloc_linux.cpp
  compiler-rt/lib/asan/asan_malloc_mac.cpp
  compiler-rt/lib/asan/asan_new_delete.cpp
  compiler-rt/lib/asan/tests/asan_noinst_test.cpp

Both compiler-rt/lib/asan/.clang-format and
compiler-rt/lib/sanitizer_common/.clang-format use
"BasedOnStyle: Google", so pointer alignment becomes "Type* name"
throughout.

NFC.

Assisted by: Claude Opus 4.7
…#200551)

SimplifyCFG mergeConditionalStoreToAddress currently transforms

    if (cond)
      store ptr, x !invariant.group;
    else
      store ptr, y;

into

    store ptr, select(cond, x, y) !invariant.group;  // BUG

It's clearly not valid to preserve !invariant.group here.

Fix this inside combineMetadataForCSE.  It can only preserve
!invariant.group if

 1. !DoesKMove, meaning that original instruction ("K") is replaced by
    the combined instruction in place, without moving it,
 2. Both stores have !invariant.group.

This matches the logic for preserving !invariant.load.

This bug was found by a large run of Opus 4.7 looking for bugs in LLVM.
…m#200627)

This is unnecessary inside of applyProfMetadataIfEnabled because it is
already handled before the callback lambda gets called within the
function. There was also a redundant case to remove.
@ronlieb ronlieb requested review from a team, dpalermo and skganesan008 May 31, 2026 05:08
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.