[llvm] [InferAddressSpaces] Handle unconverted ptrmask (PR #140802)

Robert Imschweiler via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 8 05:22:23 PDT 2025


================
@@ -495,6 +495,13 @@ class TargetTransformInfo {
 
   LLVM_ABI bool isNoopAddrSpaceCast(unsigned FromAS, unsigned ToAS) const;
 
+  LLVM_ABI std::pair<KnownBits, KnownBits>
+  computeKnownBitsAddrSpaceCast(unsigned FromAS, unsigned ToAS,
+                                const Value &PtrOp) const;
+
+  LLVM_ABI KnownBits computeKnownBitsAddrSpaceCast(
----------------
ro-i wrote:

The best option would be to add a case for `Instruction::AddrSpaceCast` to `computeKnownBitsFromOperator` in `ValueTracking.cpp`. But since we cannot access TTI functions from there, ig that's not an option.
This means, however, that `computeKnownBitsAddrSpaceCast` should stay recursive. Otherwise, addrspacecasts as source values will never be handled correctly and I don't think the user of `computeKnownBitsAddrSpaceCast` should be required to build a loop around it?

https://github.com/llvm/llvm-project/pull/140802


More information about the llvm-commits mailing list