[PATCH] D130557: [Support] Add KnownBits::concatBits helper

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 04:13:43 PDT 2022


foad added a subscriber: lattner.
foad added inline comments.


================
Comment at: llvm/include/llvm/Support/KnownBits.h:309
+  static KnownBits concatBits(const KnownBits &Lo, const KnownBits &Hi) {
+    unsigned LoBits = Lo.getBitWidth();
+    unsigned HiBits = Hi.getBitWidth();
----------------
RKSimon wrote:
> foad wrote:
> > Maybe just `return { Hi.Zero.concat(Lo.Zero), Hi.One.concat(Lo.One) }`?
> Hmm - I'd forgotten about APInt::concat - I guess we should try to make a similar KnownBits::concat ? We do tend to make them match where possible
> I guess we should try to make a similar KnownBits::concat ?

Dunno. @lattner gave reasons for the API of the member function APInt::concat in D109620. I'm not sure if those reasons also apply to a non-member version - i.e. should it take (hi, lo) instead of (lo, hi)? Personally I prefer the (lo, hi) order.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130557/new/

https://reviews.llvm.org/D130557



More information about the llvm-commits mailing list