[PATCH] D109555: [APInt] Enable APInt to support zero bit integers.
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 13 14:56:56 PDT 2021
foad added a comment.
> 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)`.
You could just as well say: it doesn't make sense for a zero-width `APInt` to return true for isAllOnes() but not produce a n-bit all-ones value for `sext(n)`.
Zero-width ints satisfy both isZero() and (I assert) isAllOnes(), so something has to give. I think the solution is to say that `sext` is not defined on zero-width ints because...
> `sext` is a function defined based on the high bit of the existing value.
... a zero-width int doesn't //have// a high bit.
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