[llvm] [LV] Bring isLegalGatherOrScatter in line with existing method (NFC) (PR #221698)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 04:41:44 PDT 2026
================
@@ -147,19 +147,13 @@ bool VFSelectionContext::isLegalMaskedLoadOrStore(bool IsLoad, Type *ScalarTy,
: TTI.isLegalMaskedStore(ScalarTy, Alignment, AddressSpace));
}
-bool VFSelectionContext::isLegalGatherOrScatter(Value *V,
+bool VFSelectionContext::isLegalGatherOrScatter(bool IsLoad, Type *ScalarTy,
+ Align Alignment,
ElementCount VF) const {
- bool LI = isa<LoadInst>(V);
- bool SI = isa<StoreInst>(V);
- if (!LI && !SI)
- return false;
- auto *Ty = getLoadStoreType(V);
- Align Align = getLoadStoreAlignment(V);
- if (VF.isVector())
- Ty = VectorType::get(Ty, VF);
+ Type *VectorTy = toVectorTy(ScalarTy, VF);
return ForceTargetSupportsGatherScatterOps ||
- (LI && TTI.isLegalMaskedGather(Ty, Align)) ||
- (SI && TTI.isLegalMaskedScatter(Ty, Align));
+ (IsLoad ? TTI.isLegalMaskedGather(VectorTy, Alignment)
----------------
david-arm wrote:
Perhaps because most targets have all vector variants of masked loads, whereas gathers are more complicated because they also take a vector of pointers. Some targets may not support <8 x i16> variants of gathers because that would require a <8 x ptr> type to also be legal.
https://github.com/llvm/llvm-project/pull/221698
More information about the llvm-commits
mailing list