[all-commits] [llvm/llvm-project] 0f8c07: [llvm] Match llvm.type.checked.load.relative seman...

PiJoules via All-commits all-commits at lists.llvm.org
Thu Mar 13 14:51:02 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0f8c075f7c2c29384d37974b3ad32786559482c6
      https://github.com/llvm/llvm-project/commit/0f8c075f7c2c29384d37974b3ad32786559482c6
  Author: PiJoules <6019989+PiJoules at users.noreply.github.com>
  Date:   2025-03-13 (Thu, 13 Mar 2025)

  Changed paths:
    M llvm/docs/LangRef.rst
    M llvm/docs/ReleaseNotes.md
    M llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
    M llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl-check-relative.ll
    M llvm/test/Transforms/WholeProgramDevirt/expand-check-relative.ll

  Log Message:
  -----------
  [llvm] Match llvm.type.checked.load.relative semantics to llvm.load.r… (#129583)

…elative

The semantics of `llvm.type.checked.load.relative` seem to be a little
different from that of `llvm.load.relative`. It looks like the semantics
for `llvm.type.checked.load.relative` is `ptr + offset + *(ptr +
offset)` whereas the semantics for `llvm.load.relative` is `ptr + *(ptr
+ offset)`. That is, the offset for the former is added to the offset
address whereas the later has the offset added to the original pointer.

It really feels like the checked intrinsic was meant to match the
semantics of the non-checked intrinsic, but I think for all cases the
checked intrinsic is used (swift being the only use I know of), the
calculation just happens to be the same because swift always uses an
offset of zero. Likewise, all llvm tests for this intrinsic happen to
use an offset of zero.

Relative vtables in clang happens to be the first time where we're using
this intrinsic and using it with non-zero values. This updates the
semantics of the checked intrinsic to match the non-checked one.
Effectively this shouldn't change any codegen by any users of this since
all current users seem to use a zero offset.

This PR also updates some tests with non-zero offsets.



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