[llvm-dev] Question about demanded bits analysis

Craig Topper via llvm-dev llvm-dev at lists.llvm.org
Thu May 18 09:27:53 PDT 2017


The demanded bits pass is an analysis pass. By itself it won't make any
changes to the IR. It is used by other transformation passes that care
about this type of information.

The main place I know where we look to see if we can perform an operation
truncated is in InstCombine. See canEvaluateTruncated in
InstCombineCasts.cpp. But I believe we have to be able to completely remove
the trunc before we will move it. So we'll need to find something like an
earlier sign extend or zero extend that extended from the same type we'd be
truncatng to.

~Craig

On Thu, May 18, 2017 at 8:04 AM, Raul Garcia via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hello All,
>
>
> I am trying to understand the demanded-bits pass. The example in the
> source code (below) seems quite explicit. In the example, only 16 bits from
> a 32 bit variable in IR are demanded and therefore the variable is
> truncated to a 16 bit variable.
>
> %1 = add i32 %x, %y%2 = trunc i32 %1 to i16
>
>
> However I was wondering if  for example, the addition demanded, say 18
> bits, would this pass generate a i18 integer variable? I have not done the
> experiment, but I would like to know beforehand if this is something that
> this pass can do.
>
>
> Regards,
> Raul.
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170518/4d0a6368/attachment.html>


More information about the llvm-dev mailing list