[llvm] [TTI] Provide conservative costs for @llvm.speculative.load. (PR #180036)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 01:49:38 PDT 2026
================
@@ -619,6 +619,25 @@ AArch64TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
return InstructionCost::getInvalid();
switch (ICA.getID()) {
+ case Intrinsic::speculative_load: {
+ // Speculative loads are only valid for types <= 16 bytes due to MTE
+ // (Memory Tagging Extension) using 16-byte tag granules. Loads larger
+ // than 16 bytes could cross a tag granule boundary.
+ auto LT = getTypeLegalizationCost(RetTy);
+ if (!LT.first.isValid())
+ return InstructionCost::getInvalid();
+ // For scalable vectors, check that we use a single register (which means
+ // <= 16 bytes at minimum vscale). For fixed types, compute the actual size.
+ if (isa<ScalableVectorType>(RetTy)) {
+ if (LT.first.getValue() != 1)
----------------
david-arm wrote:
This doesn't make sense to me. If we're concerned about MTE it is *never* safe to use scalable vector types unless we used the maximum value of vscale to determine that sizeof<max_vscale x 4 x i32> <= 16, etc.
https://github.com/llvm/llvm-project/pull/180036
More information about the llvm-commits
mailing list