[all-commits] [llvm/llvm-project] 8fe013: [Loads] Fix incorrect replacement of pointers with...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Sep 18 07:21:45 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8fe013c728a2d29722925e9bebbd454a5e3ad365
      https://github.com/llvm/llvm-project/commit/8fe013c728a2d29722925e9bebbd454a5e3ad365
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2026-09-18 (Fri, 18 Sep 2026)

  Changed paths:
    M llvm/include/llvm/Analysis/ValueTracking.h
    M llvm/lib/Analysis/Loads.cpp
    M llvm/lib/Analysis/ValueTracking.cpp
    M llvm/test/Transforms/GVN/assume-equal.ll

  Log Message:
  -----------
  [Loads] Fix incorrect replacement of pointers with different provenance (#224281)

isPointerAlwaysReplaceable() uses getUnderlyingObject() to check whether
the two pointers have the same provenance, because in that case the
replacement is always legal. However, getUnderlyingObject() does not
actually guarantee that the provenance is the same: In particular, it
can look through some intrinsics like strip.invariant.group and
launder.invariant.group, which do change the provenance of the pointer.
And replacing the result of those intrinsics with their argument is
indeed incorrect.

Fix this by adding a MustPreserveProvenance argument to the relevant
APIs, and enable it in isPointerAlwaysReplaceable().

Noticed while working on
https://github.com/llvm/llvm-project/pull/224222.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list