[all-commits] [llvm/llvm-project] 4a3e00: [IR] Handle trunc for ptrtoaddr(inttoptr) cast pai...

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Oct 13 02:11:04 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4a3e0001e367a930cb7dec2dcd072cc512825aff
      https://github.com/llvm/llvm-project/commit/4a3e0001e367a930cb7dec2dcd072cc512825aff
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2025-10-13 (Mon, 13 Oct 2025)

  Changed paths:
    M llvm/lib/IR/Instructions.cpp
    M llvm/test/Transforms/InstCombine/ptrtoaddr.ll
    M llvm/unittests/IR/InstructionsTest.cpp

  Log Message:
  -----------
  [IR] Handle trunc for ptrtoaddr(inttoptr) cast pair (#162842)

For ptrtoint(inttoptr) and ptrtoaddr(inttoptr), handle the case where
the source and destination size do not match and convert to either zext
or trunc. We can't do this if the middle size is smaller than both
src/dest, because we'd have to perform an additional masking operation
in that case.

Most of these cases are handled by dint of ptrtoint/inttoptr size
canonicalization (so I added some unit tests instead). However, the
ptrtoaddr(inttoptr) case where the pointer size and address size differ
is relevant, as in that case the mismatch in integer sizes is canonical.



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