[all-commits] [llvm/llvm-project] 2e989b: [InferAS] Infer the address space of inttoptr (#17...
Luo Yuanke via All-commits
all-commits at lists.llvm.org
Thu Feb 19 17:49:22 PST 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2e989bd59596a7e3ea4bdd600ad8af373d99e68d
https://github.com/llvm/llvm-project/commit/2e989bd59596a7e3ea4bdd600ad8af373d99e68d
Author: Luo Yuanke <lyk_03 at hotmail.com>
Date: 2026-02-20 (Fri, 20 Feb 2026)
Changed paths:
M llvm/include/llvm/Analysis/TargetTransformInfo.h
M llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
M llvm/lib/Analysis/TargetTransformInfo.cpp
M llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.h
M llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
M llvm/test/CodeGen/NVPTX/disjoint-or-addr.ll
A llvm/test/Transforms/InferAddressSpaces/NVPTX/int2ptr.ll
Log Message:
-----------
[InferAS] Infer the address space of inttoptr (#173244)
Currently the InferAddressSpaces would check if the bit value doesn't
change for <ptrtoint, inttoptr> address space cast. However the
condition is too strict. Sometime only the low bit address changes for
swizzling, and the address space is not changed. Take below code as
an example, we can transform `%gp2 = inttoptr i64 %b to ptr` to
`%gp2 = inttoptr i64 %b to ptr addrspace(2)` and specify addrspace(2)
for the following store instruction.
```
%gp = addrspacecast ptr addrspace(2) %sp to ptr
%a = ptrtoint ptr %gp to i64
%b = xor i64 7, %a
%gp2 = inttoptr i64 %b to ptr
store i16 0, ptr %gp2, align 2
```
This patch tries to infer the unchanged leading bit for the address
and let the target determine if it is safe to perform address space
cast for inttoptr instruction.
---------
Co-authored-by: Yuanke Luo <ykluo at birentech.com>
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