Skip to content

Commit 2c8181e

Browse files
committed
Revert "Outline getting alignment from load or store op"
This reverts commit 3a7eeae.
1 parent 125a84e commit 2c8181e

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -121,25 +121,6 @@ LogicalResult getVectorToLLVMAlignment(const LLVMTypeConverter &typeConverter,
121121
return success();
122122
}
123123

124-
// Helper to resolve the alignment for vector load/store, gather and scatter
125-
// ops. First, this method will try to obtain the preferred alignment from the
126-
// load or store operation itself. If the store or load operation does not
127-
// contain any preferred alignment, then it will get alignment attribute through
128-
// the type or the backend.
129-
template <class LoadOrStoreOp>
130-
LogicalResult getVectorToLLVMAlignment(LoadOrStoreOp loadOrStoreOp,
131-
const LLVMTypeConverter &typeConverter,
132-
VectorType vectorType,
133-
MemRefType memrefType, unsigned &align,
134-
bool useVectorAlignment) {
135-
if (auto alignment = loadOrStoreOp.getAlignment()) {
136-
align = alignment.value_or(0);
137-
return success();
138-
}
139-
return getVectorToLLVMAlignment(typeConverter, vectorType, memrefType,
140-
align, useVectorAlignment);
141-
}
142-
143124
// Check if the last stride is non-unit and has a valid memory space.
144125
static LogicalResult isMemRefTypeSupported(MemRefType memRefType,
145126
const LLVMTypeConverter &converter) {
@@ -266,9 +247,8 @@ class VectorLoadStoreConversion : public ConvertOpToLLVMPattern<LoadOrStoreOp> {
266247
MemRefType memRefTy = loadOrStoreOp.getMemRefType();
267248

268249
// Resolve alignment.
269-
unsigned align;
270-
if (failed(getVectorToLLVMAlignment(loadOrStoreOp,
271-
*this->getTypeConverter(), vectorTy,
250+
unsigned align = loadOrStoreOp.getAlignment().value_or(0);
251+
if (!align && failed(getVectorToLLVMAlignment(*this->getTypeConverter(), vectorTy,
272252
memRefTy, align, useVectorAlignment)))
273253
return rewriter.notifyMatchFailure(loadOrStoreOp,
274254
"could not resolve alignment");

0 commit comments

Comments
 (0)