@@ -121,25 +121,6 @@ LogicalResult getVectorToLLVMAlignment(const LLVMTypeConverter &typeConverter,
121
121
return success ();
122
122
}
123
123
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
-
143
124
// Check if the last stride is non-unit and has a valid memory space.
144
125
static LogicalResult isMemRefTypeSupported (MemRefType memRefType,
145
126
const LLVMTypeConverter &converter) {
@@ -266,9 +247,8 @@ class VectorLoadStoreConversion : public ConvertOpToLLVMPattern<LoadOrStoreOp> {
266
247
MemRefType memRefTy = loadOrStoreOp.getMemRefType ();
267
248
268
249
// 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,
272
252
memRefTy, align, useVectorAlignment)))
273
253
return rewriter.notifyMatchFailure (loadOrStoreOp,
274
254
" could not resolve alignment" );
0 commit comments