[PATCH] D69387: [ConstantRange] Add toKnownBits() method

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 09:58:03 PDT 2019


nikic added inline comments.


================
Comment at: llvm/lib/IR/ConstantRange.cpp:88
+    Known.Zero = ~(Range.getUpper() - 1);
+    return Known;
+  }
----------------
This doesn't look right. Consider a simple range like `[0b001, 0b010]`. This should give known bits `0b0xx`, but what you compute is `One = 0b001` and `Zero = 0b101`, which is conflicting in the lower bit.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69387/new/

https://reviews.llvm.org/D69387





More information about the llvm-commits mailing list