[llvm] 16544cb - [iwyu] Move <cmath> out of llvm/Support/MathExtras.h

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 11:49:25 PDT 2022


Author: serge-sans-paille
Date: 2022-09-28T20:49:01+02:00
New Revision: 16544cbe64b81a50800a88296ef37f4873a37b25

URL: https://github.com/llvm/llvm-project/commit/16544cbe64b81a50800a88296ef37f4873a37b25
DIFF: https://github.com/llvm/llvm-project/commit/16544cbe64b81a50800a88296ef37f4873a37b25.diff

LOG: [iwyu] Move <cmath> out of llvm/Support/MathExtras.h

Interestingly, MathExtras.h doesn't use <cmath> declaration, so move it out of
that header and include it when needed.

No functional change intended, but there's no longer a transitive include
fromMathExtras.h to cmath.

Added: 
    

Modified: 
    llvm/include/llvm/IR/FixedPointBuilder.h
    llvm/include/llvm/Support/JSON.h
    llvm/include/llvm/Support/MathExtras.h
    llvm/lib/Analysis/HeatUtils.cpp
    llvm/lib/BinaryFormat/MsgPackWriter.cpp
    llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
    llvm/lib/CodeGen/MachineBasicBlock.cpp
    llvm/lib/Support/APFixedPoint.cpp
    llvm/lib/Support/NativeFormatting.cpp
    llvm/lib/Support/Signals.cpp
    llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
    llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
    llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
    llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
    llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
    llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    llvm/tools/llvm-profdata/llvm-profdata.cpp
    llvm/tools/llvm-xray/xray-account.cpp
    llvm/tools/llvm-xray/xray-graph.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/FixedPointBuilder.h b/llvm/include/llvm/IR/FixedPointBuilder.h
index a99c761ad3e91..1a22dd6b60936 100644
--- a/llvm/include/llvm/IR/FixedPointBuilder.h
+++ b/llvm/include/llvm/IR/FixedPointBuilder.h
@@ -25,6 +25,8 @@
 #include "llvm/IR/Type.h"
 #include "llvm/IR/Value.h"
 
+#include <cmath>
+
 namespace llvm {
 
 template <class IRBuilderTy> class FixedPointBuilder {

diff  --git a/llvm/include/llvm/Support/JSON.h b/llvm/include/llvm/Support/JSON.h
index 0a44aabedae60..3605622841b3b 100644
--- a/llvm/include/llvm/Support/JSON.h
+++ b/llvm/include/llvm/Support/JSON.h
@@ -53,6 +53,7 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/raw_ostream.h"
+#include <cmath>
 #include <map>
 
 namespace llvm {

diff  --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
index b72d483df1862..7e26e01f617fa 100644
--- a/llvm/include/llvm/Support/MathExtras.h
+++ b/llvm/include/llvm/Support/MathExtras.h
@@ -17,7 +17,6 @@
 #include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <climits>
-#include <cmath>
 #include <cstdint>
 #include <cstring>
 #include <limits>

diff  --git a/llvm/lib/Analysis/HeatUtils.cpp b/llvm/lib/Analysis/HeatUtils.cpp
index 0057de322caca..b6a0d5810b04f 100644
--- a/llvm/lib/Analysis/HeatUtils.cpp
+++ b/llvm/lib/Analysis/HeatUtils.cpp
@@ -15,6 +15,8 @@
 #include "llvm/Analysis/BlockFrequencyInfo.h"
 #include "llvm/IR/Instructions.h"
 
+#include <cmath>
+
 namespace llvm {
 
 static const unsigned heatSize = 100;

diff  --git a/llvm/lib/BinaryFormat/MsgPackWriter.cpp b/llvm/lib/BinaryFormat/MsgPackWriter.cpp
index b4d70e8f78c12..d3b557d005774 100644
--- a/llvm/lib/BinaryFormat/MsgPackWriter.cpp
+++ b/llvm/lib/BinaryFormat/MsgPackWriter.cpp
@@ -14,6 +14,8 @@
 #include "llvm/BinaryFormat/MsgPackWriter.h"
 #include "llvm/BinaryFormat/MsgPack.h"
 
+#include <cmath>
+
 using namespace llvm;
 using namespace msgpack;
 

diff  --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
index 5ba8bfefe1a40..ac11bdc55e005 100644
--- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
@@ -31,6 +31,7 @@
 #include "llvm/Support/DivisionByConstantInfo.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Target/TargetMachine.h"
+#include <cmath>
 #include <tuple>
 
 #define DEBUG_TYPE "gi-combiner"

diff  --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 7fd51c86e264c..f7684ae67d38c 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -34,6 +34,7 @@
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetMachine.h"
 #include <algorithm>
+#include <cmath>
 using namespace llvm;
 
 #define DEBUG_TYPE "codegen"

diff  --git a/llvm/lib/Support/APFixedPoint.cpp b/llvm/lib/Support/APFixedPoint.cpp
index f1d07184793c8..461a389b6c88e 100644
--- a/llvm/lib/Support/APFixedPoint.cpp
+++ b/llvm/lib/Support/APFixedPoint.cpp
@@ -14,6 +14,8 @@
 #include "llvm/ADT/APFixedPoint.h"
 #include "llvm/ADT/APFloat.h"
 
+#include <cmath>
+
 namespace llvm {
 
 APFixedPoint APFixedPoint::convert(const FixedPointSemantics &DstSema,

diff  --git a/llvm/lib/Support/NativeFormatting.cpp b/llvm/lib/Support/NativeFormatting.cpp
index 9cf7e20a7d46f..cceaad4e8b9e6 100644
--- a/llvm/lib/Support/NativeFormatting.cpp
+++ b/llvm/lib/Support/NativeFormatting.cpp
@@ -14,6 +14,8 @@
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
 
+#include <cmath>
+
 #if defined(_WIN32) && !defined(__MINGW32__)
 #include <float.h> // For _fpclass in llvm::write_double.
 #endif

diff  --git a/llvm/lib/Support/Signals.cpp b/llvm/lib/Support/Signals.cpp
index a6fd845da8690..c9cf7337c8c95 100644
--- a/llvm/lib/Support/Signals.cpp
+++ b/llvm/lib/Support/Signals.cpp
@@ -30,6 +30,7 @@
 #include "llvm/Support/StringSaver.h"
 #include "llvm/Support/raw_ostream.h"
 #include <array>
+#include <cmath>
 #include <vector>
 
 //===----------------------------------------------------------------------===//

diff  --git a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
index 5ddf68ecba3ed..f2751e06ab59b 100644
--- a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
@@ -31,6 +31,7 @@
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Transforms/Scalar.h"
 
+#include <cmath>
 #include <string>
 
 using namespace llvm;

diff  --git a/llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp b/llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
index 605c3520bbf90..a1c2c3cd7275c 100644
--- a/llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
@@ -27,6 +27,8 @@
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Utils/MisExpect.h"
 
+#include <cmath>
+
 using namespace llvm;
 
 #define DEBUG_TYPE "lower-expect-intrinsic"

diff  --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
index d899447dbe516..0a0827a933fb4 100644
--- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
@@ -46,6 +46,8 @@
 #include "llvm/Transforms/Utils/LoopUtils.h"
 #include "llvm/Transforms/Utils/MatrixUtils.h"
 
+#include <cmath>
+
 using namespace llvm;
 using namespace PatternMatch;
 

diff  --git a/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp b/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
index 6e87da9fb1680..aab5206dd3f98 100644
--- a/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
+++ b/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
@@ -40,6 +40,9 @@
 #include "llvm/InitializePasses.h"
 #include "llvm/Pass.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
+
+#include <cmath>
+
 using namespace llvm;
 
 #define DEBUG_TYPE "libcalls-shrinkwrap"

diff  --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index a463ae3dc542a..63a4c41ca9efc 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -33,6 +33,8 @@
 #include "llvm/Transforms/Utils/Local.h"
 #include "llvm/Transforms/Utils/SizeOpts.h"
 
+#include <cmath>
+
 using namespace llvm;
 using namespace PatternMatch;
 

diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 2a530ffabe2f4..fb1ec062d5fbb 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -142,6 +142,7 @@
 #include "llvm/Transforms/Vectorize/LoopVectorizationLegality.h"
 #include <algorithm>
 #include <cassert>
+#include <cmath>
 #include <cstdint>
 #include <functional>
 #include <iterator>

diff  --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 47bd8666fdf81..0acc2d0b3f6e9 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -39,6 +39,7 @@
 #include "llvm/Support/WithColor.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
+#include <cmath>
 #include <queue>
 
 using namespace llvm;

diff  --git a/llvm/tools/llvm-xray/xray-account.cpp b/llvm/tools/llvm-xray/xray-account.cpp
index 988b535030c7c..a9d91297b4e18 100644
--- a/llvm/tools/llvm-xray/xray-account.cpp
+++ b/llvm/tools/llvm-xray/xray-account.cpp
@@ -23,6 +23,8 @@
 #include "llvm/XRay/InstrumentationMap.h"
 #include "llvm/XRay/Trace.h"
 
+#include <cmath>
+
 using namespace llvm;
 using namespace llvm::xray;
 

diff  --git a/llvm/tools/llvm-xray/xray-graph.cpp b/llvm/tools/llvm-xray/xray-graph.cpp
index ff47eb64e9473..b8328052f4731 100644
--- a/llvm/tools/llvm-xray/xray-graph.cpp
+++ b/llvm/tools/llvm-xray/xray-graph.cpp
@@ -17,6 +17,8 @@
 #include "llvm/XRay/InstrumentationMap.h"
 #include "llvm/XRay/Trace.h"
 
+#include <cmath>
+
 using namespace llvm;
 using namespace llvm::xray;
 


        


More information about the llvm-commits mailing list