[llvm] 016c830 - [ADT] APInt.h - remove <cmath> include. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 23 04:44:41 PDT 2022
Author: Simon Pilgrim
Date: 2022-10-23T12:44:20+01:00
New Revision: 016c83047f6ffdca8e83176733e5777176702e79
URL: https://github.com/llvm/llvm-project/commit/016c83047f6ffdca8e83176733e5777176702e79
DIFF: https://github.com/llvm/llvm-project/commit/016c83047f6ffdca8e83176733e5777176702e79.diff
LOG: [ADT] APInt.h - remove <cmath> include. NFC.
We only need this for std::abs, but since we're also testing the sign of the same value, then its not really necessary.
As detailed in https://commondatastorage.googleapis.com/chromium-browser-clang/llvm-include-analysis.html - APInt.h is the generic header with the highest expanded size, due to the dependency on <cmath>
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 302fdd3955502..d3e645d30094d 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -19,7 +19,6 @@
#include "llvm/Support/MathExtras.h"
#include <cassert>
#include <climits>
-#include <cmath>
#include <cstring>
#include <utility>
@@ -860,8 +859,7 @@ class [[nodiscard]] APInt {
/// relative logical shift right
APInt relativeLShr(int RelativeShift) const {
- int Shift = std::abs(RelativeShift);
- return RelativeShift > 0 ? lshr(Shift) : shl(Shift);
+ return RelativeShift > 0 ? lshr(RelativeShift) : shl(-RelativeShift);
}
/// relative logical shift left
@@ -871,8 +869,7 @@ class [[nodiscard]] APInt {
/// relative arithmetic shift right
APInt relativeAShr(int RelativeShift) const {
- int Shift = std::abs(RelativeShift);
- return RelativeShift > 0 ? ashr(Shift) : shl(Shift);
+ return RelativeShift > 0 ? ashr(RelativeShift) : shl(-RelativeShift);
}
/// relative arithmetic shift left
More information about the llvm-commits
mailing list