[llvm] Add ConstantRangeList::subtract(ConstantRange) (PR #97093)

Haopeng Liu via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 13:03:34 PDT 2024


================
@@ -81,6 +81,65 @@ void ConstantRangeList::insert(const ConstantRange &NewRange) {
   }
 }
 
+void ConstantRangeList::subtract(const ConstantRange &SubRange) {
+  if (SubRange.isEmptySet())
+    return;
+  assert(!SubRange.isFullSet() && "Do not support full set");
+  assert(SubRange.getLower().slt(SubRange.getUpper()));
+  assert(getBitWidth() == SubRange.getBitWidth());
+  // Handle common cases.
+  if (empty() || Ranges.back().getUpper().sle(SubRange.getLower())) {
+    return;
+  }
----------------
haopliu wrote:

Done.

https://github.com/llvm/llvm-project/pull/97093


More information about the llvm-commits mailing list