File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -294,12 +294,10 @@ bool mlir::affine::isValidDim(Value value) {
294294    return  isValidDim (value, getAffineScope (defOp));
295295
296296  //  This value has to be a block argument for an op that has the
297-   //  `AffineScope` trait or an induction var of an affine.for or
298-   //  affine.parallel.
299-   if  (isAffineInductionVar (value))
300-     return  true ;
297+   //  `AffineScope` trait or for an affine.for or affine.parallel.
301298  auto  *parentOp = llvm::cast<BlockArgument>(value).getOwner ()->getParentOp ();
302-   return  parentOp && parentOp->hasTrait <OpTrait::AffineScope>();
299+   return  parentOp && (parentOp->hasTrait <OpTrait::AffineScope>() ||
300+                       isa<AffineForOp, AffineParallelOp>(parentOp));
303301}
304302
305303//  Value can be used as a dimension id iff it meets one of the following
@@ -320,9 +318,10 @@ bool mlir::affine::isValidDim(Value value, Region *region) {
320318
321319  auto  *op = value.getDefiningOp ();
322320  if  (!op) {
323-     //  This value has to be an induction var  for an affine.for or an
321+     //  This value has to be a block argument  for an affine.for or an
324322    //  affine.parallel.
325-     return  isAffineInductionVar (value);
323+     auto  *parentOp = llvm::cast<BlockArgument>(value).getOwner ()->getParentOp ();
324+     return  isa<AffineForOp, AffineParallelOp>(parentOp);
326325  }
327326
328327  //  Affine apply operation is ok if all of its operands are ok.
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ func.func @symbols(%N : index) {
112112// CHECK:                  %[[lhs5:.*]] = arith.addf %[[lhs]], %[[lhs4]] 
113113// CHECK:                  %[[lhs6:.*]] = arith.addi %[[a4]], %[[cst1]] 
114114// CHECK:                  affine.store %[[lhs5]], %{{.*}}[%[[a1]], symbol(%arg0) + 1] : 
115- // CHECK:                  memref .store %[[lhs5]], %{{.*}}[%[[a1]], %[[lhs6]] ] : 
115+ // CHECK:                  affine .store %[[lhs5]], %{{.*}}[%[[a1]], %arg4 + 1 ] : 
116116// CHECK:                  %[[lhs7:.*]] = "ab.v" 
117117// CHECK:                  memref.store %[[lhs5]], %{{.*}}[%[[a1]], %[[lhs7]]] : 
118118// CHECK:                  affine.yield %[[lhs6]] 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments