[PATCH] D111113: [APInt] Make insertBits and concat work with zero width APInts.

Chris Lattner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 08:41:40 PDT 2021


lattner added a comment.

Thanks for the review Jay!



================
Comment at: llvm/lib/Support/APInt.cpp:348
   unsigned NewWidth = getBitWidth() + NewLSB.getBitWidth();
-  APInt Result = NewLSB.zext(NewWidth);
+  APInt Result = NewLSB.zextOrSelf(NewWidth);
   Result.insertBits(*this, NewLSB.getBitWidth());
----------------
foad wrote:
> Just a pet peeve, I would much prefer that methods like zext and trunc allow the degenerate cases where you're extending or truncating to the same width. I think having separate "OrSelf" versions just adds clutter for no real benefit.
I agree completely,  would you like to allow this and deprecate the "OrSelf" versions?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111113



More information about the llvm-commits mailing list