[PATCH] D109555: [APInt] Enable APInt to support zero bit integers.
    Chris Lattner via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Sep 13 12:42:29 PDT 2021
    
    
  
lattner added a comment.
> My starting point is that a zero-width unsigned integer makes sense and always has the value 0, but a zero-width signed integer makes no sense at all (I think you could "logically" argue that it is always 0, or that is is always -1). With that in mind...
> I think isZero and isOne and zext should all work on zero-width integers, but sext should assert that the width is non-zero.
I don't understand how sext is different.  APInt doesn't hold a signed value, and `sext` doesn't extend from a signed value.  `sext` is a function defined based on the high bit of the existing value.  It doesn't make sense for a zero-width `APInt` to return true for isZero() but not produce a n-bit zero value for `sext(n)`.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109555/new/
https://reviews.llvm.org/D109555
    
    
More information about the llvm-commits
mailing list