[llvm] [InferAddressSpaces] Handle unconverted ptrmask (PR #140802)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 4 18:28:28 PDT 2025
================
@@ -153,23 +153,63 @@ class TargetTransformInfoImplBase {
virtual bool isNoopAddrSpaceCast(unsigned, unsigned) const { return false; }
- // Assuming that the cast between the two given addrspaces is not a noop,
- // calculate the known bits of the resulting ptr in the destination addrspace.
- // The default implementation returns 0 known bits in case either one of the
- // addrspaces is not integral or the bit size of the source addrspace is
- // smaller than the bit size of the destination addrspace.
- virtual KnownBits computeKnownBitsAddrSpaceCast(unsigned FromAS,
- unsigned ToAS) const {
- if (DL.isNonIntegralAddressSpace(FromAS) ||
- DL.isNonIntegralAddressSpace(ToAS))
- return 0;
- unsigned FromASBitSize = DL.getPointerSizeInBits(FromAS);
+ // Given an address space cast of the given pointer value, calculate the known
+ // bits of the source pointer in the source addrspace and the destination
+ // pointer in the destination addrspace.
+ // The default implementation returns an empty optional in case one of the
+ // addrspaces is not integral.
+ virtual std::optional<std::pair<KnownBits, KnownBits>>
----------------
arsenm wrote:
This doesn't need to return an optional; the default can simply return a completely unknown value
https://github.com/llvm/llvm-project/pull/140802
More information about the llvm-commits
mailing list