[llvm] [InferAS] Infer the address space of inttoptr (PR #173244)
Luo Yuanke via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 22 03:00:01 PST 2026
================
@@ -193,6 +193,11 @@ class TargetTransformInfoImplBase {
return FromPtrBits.anyextOrTrunc(ToASBitSize);
}
+ virtual APInt getAddrSpaceCastPreservedPtrMask(unsigned SrcAS,
+ unsigned DstAS) const {
+ return APInt::getZero(DL.getPointerSizeInBits());
----------------
LuoYuanke wrote:
I hesitated for the interface for some times. My original thought is to unify the bit width to default address space, so that it is easy to compute mask with other APInt value without worry about the different bit width.
How about return std::optional<APInt> for this interface? By default, it return nullptr. Target can return any bit width of the mask and the upper layer code should aware the bit width (truncate or extend the value) before compute mask with other APInt value.
https://github.com/llvm/llvm-project/pull/173244
More information about the llvm-commits
mailing list