[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 09:25:28 PDT 2021


lattner added a comment.

You're right - I think there are two logically consistent paths we could take (and this patch isn't either of them):

1. We could take your approach.
2. We could abort and die on `isAllOnes()` saying it is not defined.

The patch is already treating zero bit integers as "zero" (no bits set means the value is zero) in the `isZero()` and `isOne()` predicates, so I think that going with #1 is defensible.  We could also define `sext(zerobit)` as filling with zeros as well.  WDYT?

I'm happy to switch this if we can settle on a design.


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