File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed 
include/mlir/Dialect/Affine/IR Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,13 @@ class AffineValueMap {
8484  // / and/or operands have been modified.
8585  LogicalResult canonicalize ();
8686
87+   // / Checks if the application of this map to its operands is semantically
88+   // / equal to `other`'s.
89+   bool  operator ==(const  AffineValueMap &other) const ;
90+   bool  operator !=(const  AffineValueMap &other) const  {
91+     return  !(*this  == other);
92+   }
93+ 
8794private: 
8895  //  A mutable affine map.
8996  MutableAffineMap map;
Original file line number Diff line number Diff line change @@ -2001,9 +2001,7 @@ bool MemRefAccess::operator==(const MemRefAccess &rhs) const {
20012001  AffineValueMap diff, thisMap, rhsMap;
20022002  getAccessMap (&thisMap);
20032003  rhs.getAccessMap (&rhsMap);
2004-   AffineValueMap::difference (thisMap, rhsMap, &diff);
2005-   return  llvm::all_of (diff.getAffineMap ().getResults (),
2006-                       [](AffineExpr e) { return  e == 0 ; });
2004+   return  thisMap == rhsMap;
20072005}
20082006
20092007void  mlir::affine::getAffineIVs (Operation &op, SmallVectorImpl<Value> &ivs) {
Original file line number Diff line number Diff line change @@ -109,4 +109,12 @@ ArrayRef<Value> AffineValueMap::getOperands() const {
109109
110110AffineMap AffineValueMap::getAffineMap () const  { return  map.getAffineMap (); }
111111
112+ bool  AffineValueMap::operator ==(const  AffineValueMap &other) const  {
113+   AffineValueMap diff;
114+   AffineValueMap::difference (*this , other, &diff);
115+   return  llvm::all_of (diff.getAffineMap ().getResults (), [](AffineExpr e) {
116+     return  e == getAffineConstantExpr (0 , e.getContext ());
117+   });
118+ }
119+ 
112120AffineValueMap::~AffineValueMap () = default ;
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments