File tree 1 file changed +5
-8
lines changed
mlir/lib/Dialect/Vector/IR
1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -172,24 +172,21 @@ bool mlir::vector::isDisjointTransferIndices(
172
172
return false ;
173
173
unsigned rankOffset = transferA.getLeadingShapedRank ();
174
174
for (unsigned i = 0 , e = transferA.indices ().size (); i < e; i++) {
175
- auto indexA = transferA.indices ()[i]. getDefiningOp <arith::ConstantOp>( );
176
- auto indexB = transferB.indices ()[i]. getDefiningOp <arith::ConstantOp>( );
175
+ auto indexA = getConstantIntValue ( transferA.indices ()[i]);
176
+ auto indexB = getConstantIntValue ( transferB.indices ()[i]);
177
177
// If any of the indices are dynamic we cannot prove anything.
178
- if (!indexA || !indexB)
178
+ if (!indexA. has_value () || !indexB. has_value () )
179
179
continue ;
180
180
181
181
if (i < rankOffset) {
182
182
// For leading dimensions, if we can prove that index are different we
183
183
// know we are accessing disjoint slices.
184
- if (llvm::cast<IntegerAttr>(indexA.getValue ()).getInt () !=
185
- llvm::cast<IntegerAttr>(indexB.getValue ()).getInt ())
184
+ if (*indexA != *indexB)
186
185
return true ;
187
186
} else {
188
187
// For this dimension, we slice a part of the memref we need to make sure
189
188
// the intervals accessed don't overlap.
190
- int64_t distance =
191
- std::abs (llvm::cast<IntegerAttr>(indexA.getValue ()).getInt () -
192
- llvm::cast<IntegerAttr>(indexB.getValue ()).getInt ());
189
+ int64_t distance = std::abs (*indexA - *indexB);
193
190
if (distance >= transferA.getVectorType ().getDimSize (i - rankOffset))
194
191
return true ;
195
192
}
You can’t perform that action at this time.
0 commit comments