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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 08:23:47 PDT 2019


lebedev.ri created this revision.
lebedev.ri added reviewers: nikic, spatel, sanjoy.
lebedev.ri added a project: LLVM.
Herald added a subscriber: hiraditya.

Currently there is only one-way transform from `KnownBits` to `ConstantRange`.
Having an opposite transform could be good for consistency/testing coverage.

This could be also be of limited use for `exact` deduction on right-shifts,
although that will be limited to constant LHS, and won't fit within
existing `ConstantRange::makeGuaranteedNoWrapRegion()` interface
(it expects RHS and provides possible LHS'es, while there
we'd provide LHS and as about possible RHS's)

So not sure if this is worth merging, posting just to save the diff.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69387

Files:
  llvm/include/llvm/IR/ConstantRange.h
  llvm/include/llvm/Support/KnownBits.h
  llvm/lib/IR/ConstantRange.cpp
  llvm/lib/Support/KnownBits.cpp
  llvm/unittests/IR/ConstantRangeTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69387.226258.patch
Type: text/x-patch
Size: 5535 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191024/5f3c0f2a/attachment.bin>


More information about the llvm-commits mailing list