[llvm] 5ed8cea - [Support] APInt.h - remove <algorithm> include. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 22 01:24:25 PDT 2021
No particular data, it came about as cleaning up the fix for D100656
https://commondatastorage.googleapis.com/chromium-browser-clang/llvm-include-analysis.html
indicates that <string> and <algorithm> are some of the bulkiest std
includes we use (and speaking as a user of an old + crusty home desktop
I'm after any potential build savings I can get.....).
On 22/04/2021 00:43, David Blaikie wrote:
> Any particular data that suggests removing this #include is worthwhile?
>
> On Tue, Apr 20, 2021 at 3:23 AM Simon Pilgrim via llvm-commits
> <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>
>
> Author: Simon Pilgrim
> Date: 2021-04-20T11:21:39+01:00
> New Revision: 5ed8cea9a8166b81ade4a9352971ba061f9b6f65
>
> URL:
> https://github.com/llvm/llvm-project/commit/5ed8cea9a8166b81ade4a9352971ba061f9b6f65
> <https://github.com/llvm/llvm-project/commit/5ed8cea9a8166b81ade4a9352971ba061f9b6f65>
> DIFF:
> https://github.com/llvm/llvm-project/commit/5ed8cea9a8166b81ade4a9352971ba061f9b6f65.diff
> <https://github.com/llvm/llvm-project/commit/5ed8cea9a8166b81ade4a9352971ba061f9b6f65.diff>
>
> LOG: [Support] APInt.h - remove <algorithm> include. NFCI.
>
> Replace std::min use which should allow us to avoid including the
> <algorithm> header in every include of APInt.h.
>
> Added:
>
>
> Modified:
> llvm/include/llvm/ADT/APInt.h
>
> Removed:
>
>
>
> ################################################################################
> diff --git a/llvm/include/llvm/ADT/APInt.h
> b/llvm/include/llvm/ADT/APInt.h
> index 0fca6bac43fd9..0cd4a0c9fc9f7 100644
> --- a/llvm/include/llvm/ADT/APInt.h
> +++ b/llvm/include/llvm/ADT/APInt.h
> @@ -17,7 +17,6 @@
>
> #include "llvm/Support/Compiler.h"
> #include "llvm/Support/MathExtras.h"
> -#include <algorithm>
> #include <cassert>
> #include <climits>
> #include <cstring>
> @@ -1699,8 +1698,10 @@ class LLVM_NODISCARD APInt {
> /// \returns BitWidth if the value is zero, otherwise returns
> the number of
> /// zeros from the least significant bit to the first one bit.
> unsigned countTrailingZeros() const {
> - if (isSingleWord())
> - return std::min(unsigned(llvm::countTrailingZeros(U.VAL)),
> BitWidth);
> + if (isSingleWord()) {
> + unsigned TrailingZeros = llvm::countTrailingZeros(U.VAL);
> + return (TrailingZeros > BitWidth ? BitWidth : TrailingZeros);
> + }
> return countTrailingZerosSlowCase();
> }
>
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> <https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210422/05ef2f18/attachment.html>
More information about the llvm-commits
mailing list