[llvm] [TTI] Provide conservative costs for @llvm.speculative.load. (PR #180036)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 25 03:07:22 PDT 2026
================
@@ -5920,6 +5920,26 @@ bool AArch64TTIImpl::isLegalMaskedExpandLoad(Type *DataTy,
(ST->isSVEorStreamingSVEAvailable() && ST->hasSME2p2());
}
+bool AArch64TTIImpl::isLegalSpeculativeLoad(Type *DataType,
+ unsigned AddressSpace) const {
+ // Matches AArch64TargetLowering::emitCanLoadSpeculatively: only address
+ // space 0 and sizes up to the 16-byte MTE tag granule are supported.
+ if (AddressSpace != 0)
+ return false;
+ TypeSize Size = DL.getTypeStoreSize(DataType);
+ uint64_t MinSize = Size.getKnownMinValue();
+ // Scalable types are at least the minimum vscale times their known minimum
+ // size.
+ if (Size.isScalable()) {
+ if (!ST->isSVEorStreamingSVEAvailable())
+ return false;
+ MinSize *=
+ std::max(ST->getMinSVEVectorSizeInBits(), AArch64::SVEBitsPerBlock) /
+ AArch64::SVEBitsPerBlock;
+ }
----------------
fhahn wrote:
Sounds good, I updated the code to return false for scalable types + a TODO, thanks
https://github.com/llvm/llvm-project/pull/180036
More information about the llvm-commits
mailing list