[all-commits] [llvm/llvm-project] f801b6: [InstCombine] Add support for ptrtoaddr in pointer...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Thu Oct 23 02:57:45 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f801b6f67ea896d6e4d2de38bce9a79689ceb254
https://github.com/llvm/llvm-project/commit/f801b6f67ea896d6e4d2de38bce9a79689ceb254
Author: Nikita Popov <npopov at redhat.com>
Date: 2025-10-23 (Thu, 23 Oct 2025)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
M llvm/test/Transforms/InstCombine/ptrtoaddr.ll
M llvm/test/Transforms/InstCombine/sub-gep.ll
Log Message:
-----------
[InstCombine] Add support for ptrtoaddr in pointer difference folds (#164428)
This adds support for folding `ptrtoaddr(p2) - ptrtoaddr(p)` pointer
subtractions. We can treat ptrtoaddr the same as ptrtoint as the
transform is truncation safe anyway (and in fact supports explicit
truncation as well).
The only interesting case is the subtraction of zext of ptrtoaddr. For
this transform it's important that the address bits are not truncated --
and if any pointer bits are truncated, that the truncation is consistent
for both operands. I've explicitly spelled out the three different cases
for this, which also fixes a miscompile in the existing ptrtoint fold.
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