[PATCH] D109620: [APInt] Add a concat method, use LLVM_UNLIKELY to help optimizer.

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 13 06:17:39 PDT 2021


foad added inline comments.


================
Comment at: llvm/include/llvm/ADT/APInt.h:884
+  ///   (this->zext(NewWidth) << NewLSB.getBitWidth()) | NewLSB.zext(NewWidth)
+  APInt concat(const APInt &NewLSB) const {
+    /// If the result will be small, then both the merged values are small.
----------------
Is there a reason for the argument to be NewLSB instead of NewMSB?

If there was a non-member form would it be `static APInt concat(const APInt &MSB, const APInt &LSB)`? I would slightly prefer a `(LSB, MSB)` argument order, but I guess there is no real consistency in existing APIs.


================
Comment at: llvm/lib/Support/APInt.cpp:345
+///   (this->zext(NewWidth) << NewLSB.getBitWidth()) | NewLSB.zext(NewWidth)
+/// In the slow case, we know the result is larger.
+APInt APInt::concatSlowCase(const APInt &NewLSB) const {
----------------
Larger than what? Did you mean "large"?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109620



More information about the llvm-commits mailing list