OSDN Git Service

[MLIR] NFC: simplify PresburgerSet::isEqual
authorArjun P <arjunpitchanathan@gmail.com>
Mon, 18 Jan 2021 16:32:06 +0000 (22:02 +0530)
committerArjun P <arjunpitchanathan@gmail.com>
Mon, 18 Jan 2021 17:17:25 +0000 (22:47 +0530)
Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D94918

mlir/lib/Analysis/PresburgerSet.cpp

index 12df06b..051010e 100644 (file)
@@ -290,11 +290,8 @@ PresburgerSet PresburgerSet::subtract(const PresburgerSet &set) const {
 /// Therefore, S is equal to T iff S \ T and T \ S are both empty.
 bool PresburgerSet::isEqual(const PresburgerSet &set) const {
   assertDimensionsCompatible(set, *this);
-  PresburgerSet thisMinusSet = subtract(set);
-  if (!thisMinusSet.isIntegerEmpty())
-    return false;
-  PresburgerSet setMinusThis = set.subtract(*this);
-  return setMinusThis.isIntegerEmpty();
+  return this->subtract(set).isIntegerEmpty() &&
+         set.subtract(*this).isIntegerEmpty();
 }
 
 /// Return true if all the sets in the union are known to be integer empty,