Skip to content

Commit c04c5fd

Browse files
committed
Step 1: Patch legal check for strided accesses
1 parent cd2f7b0 commit c04c5fd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,18 @@ class LoopVectorizationCostModel {
13121312
(SI && TTI.isLegalMaskedScatter(Ty, Align));
13131313
}
13141314

1315+
/// Returns true if the target machine can represent \p V as a strided load
1316+
/// or store operation.
1317+
bool isLegalStridedLoadStore(Value *V, ElementCount VF) {
1318+
if (!isa<LoadInst, StoreInst>(V))
1319+
return false;
1320+
auto *Ty = getLoadStoreType(V);
1321+
Align Align = getLoadStoreAlignment(V);
1322+
if (VF.isVector())
1323+
Ty = VectorType::get(Ty, VF);
1324+
return TTI.isLegalStridedLoadStore(Ty, Align);
1325+
}
1326+
13151327
/// Returns true if the target machine supports all of the reduction
13161328
/// variables found for the given VF.
13171329
bool canVectorizeReductions(ElementCount VF) const {

0 commit comments

Comments
 (0)