[llvm] [InferAddressSpaces] Handle unconverted ptrmask (PR #140802)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 2 05:48:14 PDT 2025
================
@@ -151,6 +152,34 @@ 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 width of the given mask value so that it can be applied to
+ // the destination addrspace. In case it cannot be applied since the cast
+ // between the two addrspaces is invalid or the mask value is larger than the
+ // resulting addrspace bit-width, return an empty optional.
+ //
+ // Note that this currently expects the addrspaces to be integral. In case one
+ // of them isn't, an empty optional is returned.
+ virtual std::optional<uint64_t>
+ getAddrSpaceCastMaskWidth(unsigned FromAS, unsigned ToAS, Value *MaskOp,
+ Instruction *I) const {
----------------
arsenm wrote:
these can be const reference
https://github.com/llvm/llvm-project/pull/140802
More information about the llvm-commits
mailing list