[ConstantRange] Add fromKnownBits() method
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 17 Mar 2019 20:24:02 +0000 (20:24 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Sun, 17 Mar 2019 20:24:02 +0000 (20:24 +0000)
commitef2d9799435807d0b4143ff4975336842c7eab0b
treeca26a9c8d46b4b7d2f42c9dda8dc4513cad445c8
parentb3bcd95771810f75736c1be0088618a03c9f0fe3
[ConstantRange] Add fromKnownBits() method

Following the suggestion in D59450, I'm moving the code for constructing
a ConstantRange from KnownBits out of ValueTracking, which also allows us
to test this code independently.

I'm adding this method to ConstantRange rather than KnownBits (which
would have been a bit nicer API wise) to avoid creating a dependency
from Support to IR, where ConstantRange lives.

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

llvm-svn: 356339
llvm/include/llvm/IR/ConstantRange.h
llvm/lib/Analysis/ValueTracking.cpp
llvm/lib/IR/ConstantRange.cpp
llvm/unittests/IR/ConstantRangeTest.cpp