[PATCH] D97074: Add getDemandedBits for uses.

Qunyan Mangus via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 5 12:17:46 PDT 2021


qunyanm added a comment.

We have an out-of-tree code analysis tool that we want to surface use-level consumed-bits information, and thus want this method to be added to the public API surface of libLLVM (and therefore need it to be included in release builds). Part of the analysis includes propagating the demanded bits of returned values. So for the code example from the commit message:

  define i32 @test_use(i32 %a) {
        %1 = and i32 %a, -256
        %2 = or i32 %1, 1
        %3 = trunc i32 %2 to i8 (didn't optimize this to 1 for illustration purpose)
        ... some use of %3
        ret %2
    }

In order to propagate the demanded bits of the returned value, we need to be able to get the demanded bits of %2 at "trunc". This change is just trying to make "determineLiveOperandBits" public as was done for "determineLiveOperandBitsAdd/determineLiveOperandBitsSub", and I added the use in the dump to make sure that the lit test suite exercises the code and verifies the result. Could you please clarify the concern/request?  I.e., if the dump code executed in the lit test is not "actual code", but our motivating use case is an out-of-tree llvm-based code analysis tool, what code do you  recommend I add a use in?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97074



More information about the llvm-commits mailing list