[all-commits] [llvm/llvm-project] db8132: [Support] Add KnownBits::countMaxSignedBits(). Mak...

Craig Topper via All-commits all-commits at lists.llvm.org
Sun Jan 2 23:31:16 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: db81324c8da56cd498b58d0081b49b08095ec534
      https://github.com/llvm/llvm-project/commit/db81324c8da56cd498b58d0081b49b08095ec534
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-01-02 (Sun, 02 Jan 2022)

  Changed paths:
    M llvm/include/llvm/Support/KnownBits.h
    M llvm/unittests/Support/KnownBitsTest.cpp

  Log Message:
  -----------
  [Support] Add KnownBits::countMaxSignedBits(). Make KnownBits::countMinSignBits() always return at least 1.

Even if we don't have any known bits, we can assume that there is
at least 1 sign bit. This is consistent with ComputeNumSignBits
which always returns at least 1.

Add KnownBits::countMaxSignedBits() which computes the number of
bits needed to represent all signed values with those known bits.
This is the signed equivalent of countMaxActiveBits().

Split from D116469.

Reviewed By: lebedev.ri

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




More information about the All-commits mailing list