File tree 3 files changed +16
-3
lines changed
include/mlir/Dialect/Affine/IR
3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,13 @@ class AffineValueMap {
84
84
// / and/or operands have been modified.
85
85
LogicalResult canonicalize ();
86
86
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
+
87
94
private:
88
95
// A mutable affine map.
89
96
MutableAffineMap map;
Original file line number Diff line number Diff line change @@ -2001,9 +2001,7 @@ bool MemRefAccess::operator==(const MemRefAccess &rhs) const {
2001
2001
AffineValueMap diff, thisMap, rhsMap;
2002
2002
getAccessMap (&thisMap);
2003
2003
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;
2007
2005
}
2008
2006
2009
2007
void 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 {
109
109
110
110
AffineMap AffineValueMap::getAffineMap () const { return map.getAffineMap (); }
111
111
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
+
112
120
AffineValueMap::~AffineValueMap () = default ;
You can’t perform that action at this time.
0 commit comments