[PATCH] D63691: [APInt] Fix getBitsNeeded for INT_MIN values

Noel Grandin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 01:40:51 PDT 2019


grandinj added inline comments.


================
Comment at: lib/Support/APInt.cpp:488
   unsigned log = tmp.logBase2();
+  int32_t exactLog = tmp.exactLogBase2();
   if (log == (unsigned)-1) {
----------------
this seems inefficient? we're calling logbase2 and exactlogbase2? Perhaps just call isPowerOf2() directly since exactlogbase2 is 

int32_t exactLogBase2() const {
    if (!isPowerOf2())
      return -1;
    return logBase2();
  }

?

 Just a suggestion


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63691





More information about the llvm-commits mailing list