Skip to content

Commit 15c8f0b

Browse files
committed
Step 1: Patch legal check for strided accesses
1 parent 8886947 commit 15c8f0b

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
@@ -1308,6 +1308,18 @@ class LoopVectorizationCostModel {
13081308
(SI && TTI.isLegalMaskedScatter(Ty, Align));
13091309
}
13101310

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

0 commit comments

Comments
 (0)