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

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 00:04:53 PDT 2021


foad accepted this revision.
foad added a comment.
This revision is now accepted and ready to land.

LGTM!



================
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());
----------------
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.


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