@@ -1550,15 +1550,17 @@ mlir::affine::computeSliceUnion(ArrayRef<Operation *> opsA,
1550
1550
FlatAffineValueConstraints sliceUnionCst;
1551
1551
assert (sliceUnionCst.getNumDimAndSymbolVars () == 0 );
1552
1552
std::vector<std::pair<Operation *, Operation *>> dependentOpPairs;
1553
- for (Operation *i : opsA) {
1554
- MemRefAccess srcAccess (i);
1555
- for (Operation *j : opsB) {
1556
- MemRefAccess dstAccess (j);
1553
+ MemRefAccess srcAccess;
1554
+ MemRefAccess dstAccess;
1555
+ for (Operation *a : opsA) {
1556
+ srcAccess = MemRefAccess (a);
1557
+ for (Operation *b : opsB) {
1558
+ dstAccess = MemRefAccess (b);
1557
1559
if (srcAccess.memref != dstAccess.memref )
1558
1560
continue ;
1559
1561
// Check if 'loopDepth' exceeds nesting depth of src/dst ops.
1560
- if ((!isBackwardSlice && loopDepth > getNestingDepth (i )) ||
1561
- (isBackwardSlice && loopDepth > getNestingDepth (j ))) {
1562
+ if ((!isBackwardSlice && loopDepth > getNestingDepth (a )) ||
1563
+ (isBackwardSlice && loopDepth > getNestingDepth (b ))) {
1562
1564
LLVM_DEBUG (llvm::dbgs () << " Invalid loop depth\n " );
1563
1565
return SliceComputationResult::GenericFailure;
1564
1566
}
@@ -1577,13 +1579,12 @@ mlir::affine::computeSliceUnion(ArrayRef<Operation *> opsA,
1577
1579
}
1578
1580
if (result.value == DependenceResult::NoDependence)
1579
1581
continue ;
1580
- dependentOpPairs.emplace_back (i, j );
1582
+ dependentOpPairs.emplace_back (a, b );
1581
1583
1582
1584
// Compute slice bounds for 'srcAccess' and 'dstAccess'.
1583
1585
ComputationSliceState tmpSliceState;
1584
- mlir::affine::getComputationSliceState (i, j, dependenceConstraints,
1585
- loopDepth, isBackwardSlice,
1586
- &tmpSliceState);
1586
+ getComputationSliceState (a, b, dependenceConstraints, loopDepth,
1587
+ isBackwardSlice, &tmpSliceState);
1587
1588
1588
1589
if (sliceUnionCst.getNumDimAndSymbolVars () == 0 ) {
1589
1590
// Initialize 'sliceUnionCst' with the bounds computed in previous step.
@@ -1948,16 +1949,16 @@ AffineForOp mlir::affine::insertBackwardComputationSlice(
1948
1949
1949
1950
// Constructs MemRefAccess populating it with the memref, its indices and
1950
1951
// opinst from 'loadOrStoreOpInst'.
1951
- MemRefAccess::MemRefAccess (Operation *loadOrStoreOpInst ) {
1952
- if (auto loadOp = dyn_cast<AffineReadOpInterface>(loadOrStoreOpInst )) {
1952
+ MemRefAccess::MemRefAccess (Operation *memOp ) {
1953
+ if (auto loadOp = dyn_cast<AffineReadOpInterface>(memOp )) {
1953
1954
memref = loadOp.getMemRef ();
1954
- opInst = loadOrStoreOpInst ;
1955
+ opInst = memOp ;
1955
1956
llvm::append_range (indices, loadOp.getMapOperands ());
1956
1957
} else {
1957
- assert (isa<AffineWriteOpInterface>(loadOrStoreOpInst ) &&
1958
+ assert (isa<AffineWriteOpInterface>(memOp ) &&
1958
1959
" Affine read/write op expected" );
1959
- auto storeOp = cast<AffineWriteOpInterface>(loadOrStoreOpInst );
1960
- opInst = loadOrStoreOpInst ;
1960
+ auto storeOp = cast<AffineWriteOpInterface>(memOp );
1961
+ opInst = memOp ;
1961
1962
memref = storeOp.getMemRef ();
1962
1963
llvm::append_range (indices, storeOp.getMapOperands ());
1963
1964
}
0 commit comments