[llvm] Add the 'initializes' attribute langref and support (PR #84803)

Haopeng Liu via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 10:43:13 PDT 2024


================
@@ -0,0 +1,97 @@
+//===- ConstantRangeList.cpp - ConstantRangeList implementation -----------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/IR/ConstantRangeList.h"
+#include <cstddef>
+
+using namespace llvm;
+
+bool ConstantRangeList::isOrderedRanges(ArrayRef<ConstantRange> RangesRef) {
+  if (RangesRef.empty())
+    return true;
+  auto Range = RangesRef[0];
+  if (Range.getLower().sge(Range.getUpper()))
+    return false;
+  for (unsigned i = 1; i < RangesRef.size(); i++) {
+    auto CurRange = RangesRef[i];
+    auto PreRange = RangesRef[i - 1];
+    if (CurRange.getLower().sge(CurRange.getUpper()) ||
+        CurRange.getLower().sle(PreRange.getLower()) ||
+        CurRange.getLower().sle(PreRange.getUpper()))
----------------
haopliu wrote:

Removed. `CurRange.getLower().sle(PreRange.getLower())` is transitively checked :)

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


More information about the llvm-commits mailing list