[PATCH] D13677: [IR] Fix bug in `ConstantRange::intersectWith`

Nick Lewycky via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 17:06:35 PDT 2015


nlewycky added inline comments.

================
Comment at: lib/IR/ConstantRange.cpp:318-319
@@ +317,4 @@
+
+  explicit UnwrappedLimit(const APInt &LowBits, bool HighBit = false) :
+    LowBits(LowBits), HighBit(HighBit) {}
+
----------------
clang-format?

================
Comment at: lib/IR/ConstantRange.cpp:338-339
@@ +337,4 @@
+
+static std::pair<UnwrappedLimit, UnwrappedLimit>
+GetUnwrappedLimits(const ConstantRange &CR, bool HighBitPref) {
+  if (!CR.isWrappedSet())
----------------
Please comment what this produces. A reader may wonder why HighBitPref is ignored on the wrapped set case; why doesn't it control whether the 'gap' is in the high or low half?

================
Comment at: unittests/IR/ConstantRangeTest.cpp:285
@@ +284,3 @@
+  RHS = ConstantRange(APInt(4, -8), APInt(4, 7));
+
+  EXPECT_EQ(LHS.intersectWith(RHS), ConstantRange(APInt(4, -8), APInt(4, -1)));
----------------
Remove this newline?


http://reviews.llvm.org/D13677





More information about the llvm-commits mailing list