[ADT] APInt.h - remove <cmath> include. NFC.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 23 Oct 2022 11:44:14 +0000 (12:44 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 23 Oct 2022 11:44:20 +0000 (12:44 +0100)
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>

llvm/include/llvm/ADT/APInt.h

index 302fdd3..d3e645d 100644 (file)
@@ -19,7 +19,6 @@
 #include "llvm/Support/MathExtras.h"
 #include <cassert>
 #include <climits>
-#include <cmath>
 #include <cstring>
 #include <utility>
 
@@ -860,8 +859,7 @@ public:
 
   /// 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 @@ public:
 
   /// 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