[PATCH] D97074: Add getDemandedBits for uses.

Qunyan Mangus via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 16 14:51:30 PDT 2021


qunyanm added a comment.

In D97074#2628169 <https://reviews.llvm.org/D97074#2628169>, @lebedev.ri wrote:

> I think we'll need to see the patch that depends on this.

I don't have a patch to submit that depends on this (I just use it in a tool built on top of llvm). The change is basically a wrapper to expose determineLiveOperandBits(),  which is private,  and set up the dummy arguments. It would allow inspection of demandedBits for each use in case we want finer grain information than the demandedBits of def which is an aggregate of all its uses..



================
Comment at: llvm/lib/Analysis/DemandedBits.cpp:465
+
+  unsigned BitWidth = T->getScalarSizeInBits();
+
----------------
qunyanm wrote:
> RKSimon wrote:
> > Could this be used in the APInt::getAllOnesValue() above instead of the getTypeSizeInBits call?
> Yes. Thanks!
Actually it won't work since getScalarSizeInBits() returns 0 for non-primitive types that demandedBits don't track therefore should be marked as all bit used.


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