[llvm] c0866ce - [IR] Remove Function.h include from Analysis.h (NFC) (#97056)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 07:41:03 PDT 2024


Author: Nikita Popov
Date: 2024-06-28T16:41:00+02:00
New Revision: c0866cefe9bc524d8f31400413fcc14de10c50e2

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

LOG: [IR] Remove Function.h include from Analysis.h (NFC) (#97056)

Use a forward-declaration instead.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/AliasAnalysis.h
    llvm/include/llvm/Analysis/Delinearization.h
    llvm/include/llvm/Analysis/DemandedBits.h
    llvm/include/llvm/Analysis/DominanceFrontier.h
    llvm/include/llvm/Analysis/IVUsers.h
    llvm/include/llvm/Analysis/LazyValueInfo.h
    llvm/include/llvm/Analysis/LoopAnalysisManager.h
    llvm/include/llvm/Analysis/OptimizationRemarkEmitter.h
    llvm/include/llvm/IR/Analysis.h
    llvm/include/llvm/IR/PassManagerImpl.h
    llvm/include/llvm/Transforms/IPO/ExtractGV.h
    llvm/include/llvm/Transforms/IPO/HotColdSplitting.h
    llvm/include/llvm/Transforms/IPO/Internalize.h
    llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
    llvm/include/llvm/Transforms/Scalar/AlignmentFromAssumptions.h
    llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h
    llvm/include/llvm/Transforms/Scalar/MemCpyOptimizer.h
    llvm/include/llvm/Transforms/Scalar/Reassociate.h
    llvm/include/llvm/Transforms/Scalar/SpeculativeExecution.h
    llvm/include/llvm/Transforms/Utils/Cloning.h
    llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
    llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
    llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
    llvm/lib/CodeGen/MachineFunctionAnalysis.cpp
    llvm/lib/CodeGen/PseudoSourceValue.cpp
    llvm/lib/CodeGen/SafeStackLayout.h
    llvm/lib/Target/AArch64/AArch64MCInstLower.cpp
    llvm/lib/Target/AMDGPU/AMDGPUMachineModuleInfo.h
    llvm/lib/Target/WebAssembly/WebAssemblyExceptionInfo.cpp
    llvm/lib/Transforms/Utils/CountVisits.cpp
    llvm/lib/Transforms/Utils/HelloWorld.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/AliasAnalysis.h b/llvm/include/llvm/Analysis/AliasAnalysis.h
index 4c6669fe78f67..812b5a9f72a3a 100644
--- a/llvm/include/llvm/Analysis/AliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/AliasAnalysis.h
@@ -41,6 +41,7 @@
 #include "llvm/ADT/Sequence.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Analysis/MemoryLocation.h"
+#include "llvm/IR/Function.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/ModRef.h"

diff  --git a/llvm/include/llvm/Analysis/Delinearization.h b/llvm/include/llvm/Analysis/Delinearization.h
index a00adb2896041..eb775babd6061 100644
--- a/llvm/include/llvm/Analysis/Delinearization.h
+++ b/llvm/include/llvm/Analysis/Delinearization.h
@@ -22,6 +22,7 @@ namespace llvm {
 class raw_ostream;
 template <typename T> class SmallVectorImpl;
 class GetElementPtrInst;
+class Instruction;
 class ScalarEvolution;
 class SCEV;
 

diff  --git a/llvm/include/llvm/Analysis/DemandedBits.h b/llvm/include/llvm/Analysis/DemandedBits.h
index aac7382528f06..0475c4ff07ad8 100644
--- a/llvm/include/llvm/Analysis/DemandedBits.h
+++ b/llvm/include/llvm/Analysis/DemandedBits.h
@@ -34,6 +34,8 @@ class Function;
 class Instruction;
 struct KnownBits;
 class raw_ostream;
+class Use;
+class Value;
 
 class DemandedBits {
 public:

diff  --git a/llvm/include/llvm/Analysis/DominanceFrontier.h b/llvm/include/llvm/Analysis/DominanceFrontier.h
index 772fdc9ddee02..1339b4869bc29 100644
--- a/llvm/include/llvm/Analysis/DominanceFrontier.h
+++ b/llvm/include/llvm/Analysis/DominanceFrontier.h
@@ -29,6 +29,7 @@
 
 namespace llvm {
 
+class BasicBlock;
 class Function;
 class raw_ostream;
 

diff  --git a/llvm/include/llvm/Analysis/IVUsers.h b/llvm/include/llvm/Analysis/IVUsers.h
index 6b9b6bf190f1c..2af3e389446c6 100644
--- a/llvm/include/llvm/Analysis/IVUsers.h
+++ b/llvm/include/llvm/Analysis/IVUsers.h
@@ -17,6 +17,7 @@
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/Analysis/LoopPass.h"
 #include "llvm/Analysis/ScalarEvolutionNormalization.h"
+#include "llvm/IR/Instruction.h"
 #include "llvm/IR/ValueHandle.h"
 
 namespace llvm {

diff  --git a/llvm/include/llvm/Analysis/LazyValueInfo.h b/llvm/include/llvm/Analysis/LazyValueInfo.h
index 5611a2b98020f..596fb2d73150f 100644
--- a/llvm/include/llvm/Analysis/LazyValueInfo.h
+++ b/llvm/include/llvm/Analysis/LazyValueInfo.h
@@ -19,6 +19,7 @@
 
 namespace llvm {
   class AssumptionCache;
+  class BasicBlock;
   class Constant;
   class ConstantRange;
   class DataLayout;
@@ -26,6 +27,7 @@ namespace llvm {
   class Instruction;
   class TargetLibraryInfo;
   class Value;
+  class Use;
   class LazyValueInfoImpl;
   /// This pass computes, caches, and vends lazy value constraint information.
   class LazyValueInfo {

diff  --git a/llvm/include/llvm/Analysis/LoopAnalysisManager.h b/llvm/include/llvm/Analysis/LoopAnalysisManager.h
index d22675a308aac..a760ea98d7cfb 100644
--- a/llvm/include/llvm/Analysis/LoopAnalysisManager.h
+++ b/llvm/include/llvm/Analysis/LoopAnalysisManager.h
@@ -35,6 +35,8 @@ namespace llvm {
 
 class AAResults;
 class AssumptionCache;
+class BlockFrequencyInfo;
+class BranchProbabilityInfo;
 class DominatorTree;
 class Function;
 class Loop;

diff  --git a/llvm/include/llvm/Analysis/OptimizationRemarkEmitter.h b/llvm/include/llvm/Analysis/OptimizationRemarkEmitter.h
index 8aaeaf2991029..f14344e743759 100644
--- a/llvm/include/llvm/Analysis/OptimizationRemarkEmitter.h
+++ b/llvm/include/llvm/Analysis/OptimizationRemarkEmitter.h
@@ -16,6 +16,7 @@
 
 #include "llvm/Analysis/BlockFrequencyInfo.h"
 #include "llvm/IR/DiagnosticInfo.h"
+#include "llvm/IR/Function.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
 #include <optional>

diff  --git a/llvm/include/llvm/IR/Analysis.h b/llvm/include/llvm/IR/Analysis.h
index ea7e2c3d0a08b..6c80c771d40b4 100644
--- a/llvm/include/llvm/IR/Analysis.h
+++ b/llvm/include/llvm/IR/Analysis.h
@@ -13,10 +13,10 @@
 #define LLVM_IR_ANALYSIS_H
 
 #include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/IR/Function.h"
 
 namespace llvm {
 
+class Function;
 class Module;
 
 /// A special type used by analysis passes to provide an address that

diff  --git a/llvm/include/llvm/IR/PassManagerImpl.h b/llvm/include/llvm/IR/PassManagerImpl.h
index 91f5774d2feb9..78877199e614f 100644
--- a/llvm/include/llvm/IR/PassManagerImpl.h
+++ b/llvm/include/llvm/IR/PassManagerImpl.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_IR_PASSMANAGERIMPL_H
 #define LLVM_IR_PASSMANAGERIMPL_H
 
+#include "llvm/IR/Function.h"
 #include "llvm/IR/PassInstrumentation.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Support/CommandLine.h"

diff  --git a/llvm/include/llvm/Transforms/IPO/ExtractGV.h b/llvm/include/llvm/Transforms/IPO/ExtractGV.h
index 45e29ba9a3ecf..1c2e7d9465fd6 100644
--- a/llvm/include/llvm/Transforms/IPO/ExtractGV.h
+++ b/llvm/include/llvm/Transforms/IPO/ExtractGV.h
@@ -13,6 +13,7 @@
 #include "llvm/IR/PassManager.h"
 
 namespace llvm {
+class GlobalValue;
 
 class ExtractGVPass : public PassInfoMixin<ExtractGVPass> {
 private:

diff  --git a/llvm/include/llvm/Transforms/IPO/HotColdSplitting.h b/llvm/include/llvm/Transforms/IPO/HotColdSplitting.h
index 13dda6d61284c..4308c0879dbcd 100644
--- a/llvm/include/llvm/Transforms/IPO/HotColdSplitting.h
+++ b/llvm/include/llvm/Transforms/IPO/HotColdSplitting.h
@@ -19,6 +19,7 @@ namespace llvm {
 
 class Module;
 class ProfileSummaryInfo;
+class BasicBlock;
 class BlockFrequencyInfo;
 class TargetTransformInfo;
 class OptimizationRemarkEmitter;

diff  --git a/llvm/include/llvm/Transforms/IPO/Internalize.h b/llvm/include/llvm/Transforms/IPO/Internalize.h
index ece5bfe77b798..c9b2d3ba2d71a 100644
--- a/llvm/include/llvm/Transforms/IPO/Internalize.h
+++ b/llvm/include/llvm/Transforms/IPO/Internalize.h
@@ -27,6 +27,8 @@
 #include <functional>
 
 namespace llvm {
+class Comdat;
+class GlobalValue;
 class Module;
 
 /// A pass that internalizes all functions and variables other than those that

diff  --git a/llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h b/llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
index 0be3146f695a6..415bb65352da3 100644
--- a/llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
+++ b/llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_TRANSFORMS_IPO_WHOLEPROGRAMDEVIRT_H
 #define LLVM_TRANSFORMS_IPO_WHOLEPROGRAMDEVIRT_H
 
+#include "llvm/ADT/DenseSet.h"
 #include "llvm/IR/GlobalValue.h"
 #include "llvm/IR/PassManager.h"
 #include <cassert>

diff  --git a/llvm/include/llvm/Transforms/Scalar/AlignmentFromAssumptions.h b/llvm/include/llvm/Transforms/Scalar/AlignmentFromAssumptions.h
index 10b6e1c6a21b6..ab2bb2e4cf1e4 100644
--- a/llvm/include/llvm/Transforms/Scalar/AlignmentFromAssumptions.h
+++ b/llvm/include/llvm/Transforms/Scalar/AlignmentFromAssumptions.h
@@ -22,9 +22,11 @@
 namespace llvm {
 
 class AssumptionCache;
+class CallInst;
 class DominatorTree;
 class ScalarEvolution;
 class SCEV;
+class Value;
 
 struct AlignmentFromAssumptionsPass
     : public PassInfoMixin<AlignmentFromAssumptionsPass> {

diff  --git a/llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h b/llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h
index 48f8421c1813c..a40f0e220044c 100644
--- a/llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h
+++ b/llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h
@@ -42,6 +42,7 @@
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/PassManager.h"
 #include <algorithm>
 #include <vector>
@@ -59,6 +60,7 @@ class GlobalVariable;
 class Instruction;
 class ProfileSummaryInfo;
 class TargetTransformInfo;
+class TargetTransformInfo;
 
 /// A private "module" namespace for types and utilities used by
 /// ConstantHoisting. These are implementation details and should not be used by

diff  --git a/llvm/include/llvm/Transforms/Scalar/MemCpyOptimizer.h b/llvm/include/llvm/Transforms/Scalar/MemCpyOptimizer.h
index 6c809bc881d05..8ed03d7f3ddbf 100644
--- a/llvm/include/llvm/Transforms/Scalar/MemCpyOptimizer.h
+++ b/llvm/include/llvm/Transforms/Scalar/MemCpyOptimizer.h
@@ -37,6 +37,7 @@ class MemSetInst;
 class PostDominatorTree;
 class StoreInst;
 class TargetLibraryInfo;
+class TypeSize;
 class Value;
 
 class MemCpyOptPass : public PassInfoMixin<MemCpyOptPass> {

diff  --git a/llvm/include/llvm/Transforms/Scalar/Reassociate.h b/llvm/include/llvm/Transforms/Scalar/Reassociate.h
index 84d72df6fc4d8..8c93afcd587e8 100644
--- a/llvm/include/llvm/Transforms/Scalar/Reassociate.h
+++ b/llvm/include/llvm/Transforms/Scalar/Reassociate.h
@@ -25,6 +25,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PostOrderIterator.h"
 #include "llvm/ADT/SetVector.h"
+#include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/ValueHandle.h"
 #include <deque>

diff  --git a/llvm/include/llvm/Transforms/Scalar/SpeculativeExecution.h b/llvm/include/llvm/Transforms/Scalar/SpeculativeExecution.h
index d17186682fb8f..168e0c3bb9521 100644
--- a/llvm/include/llvm/Transforms/Scalar/SpeculativeExecution.h
+++ b/llvm/include/llvm/Transforms/Scalar/SpeculativeExecution.h
@@ -65,7 +65,9 @@
 #include "llvm/IR/PassManager.h"
 
 namespace llvm {
+class BasicBlock;
 class TargetTransformInfo;
+
 class SpeculativeExecutionPass
     : public PassInfoMixin<SpeculativeExecutionPass> {
 public:

diff  --git a/llvm/include/llvm/Transforms/Utils/Cloning.h b/llvm/include/llvm/Transforms/Utils/Cloning.h
index 1c342b871a4a4..6226062dd713f 100644
--- a/llvm/include/llvm/Transforms/Utils/Cloning.h
+++ b/llvm/include/llvm/Transforms/Utils/Cloning.h
@@ -21,6 +21,7 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/Analysis/AssumptionCache.h"
 #include "llvm/Analysis/InlineCost.h"
+#include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/ValueHandle.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
 #include <functional>

diff  --git a/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h b/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
index d09fc328c452f..b4fe6351125b1 100644
--- a/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
+++ b/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
@@ -67,6 +67,7 @@ class BlockFrequencyInfo;
 class DemandedBits;
 class DominatorTree;
 class Function;
+class Instruction;
 class Loop;
 class LoopAccessInfoManager;
 class LoopInfo;

diff  --git a/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h b/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
index 4f99d171469e4..3b522dd642db5 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
@@ -29,6 +29,7 @@ namespace llvm {
 class AAResults;
 class AssumptionCache;
 class BasicBlock;
+class DataLayout;
 class DemandedBits;
 class DominatorTree;
 class Function;

diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
index 10c844ddb14a1..49f3fc1a1fa59 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
@@ -15,6 +15,7 @@
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/IR/Function.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCStreamer.h"

diff  --git a/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp b/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp
index 519a77c44acf8..24eb360723dad 100644
--- a/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp
+++ b/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp
@@ -14,6 +14,7 @@
 #include "llvm/CodeGen/MachineFunctionAnalysis.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/IR/Function.h"
 #include "llvm/Target/TargetMachine.h"
 
 using namespace llvm;

diff  --git a/llvm/lib/CodeGen/PseudoSourceValue.cpp b/llvm/lib/CodeGen/PseudoSourceValue.cpp
index 242889d317849..d102d22e87afb 100644
--- a/llvm/lib/CodeGen/PseudoSourceValue.cpp
+++ b/llvm/lib/CodeGen/PseudoSourceValue.cpp
@@ -13,6 +13,7 @@
 #include "llvm/CodeGen/PseudoSourceValue.h"
 #include "llvm/CodeGen/MachineFrameInfo.h"
 #include "llvm/CodeGen/PseudoSourceValueManager.h"
+#include "llvm/IR/GlobalValue.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetMachine.h"

diff  --git a/llvm/lib/CodeGen/SafeStackLayout.h b/llvm/lib/CodeGen/SafeStackLayout.h
index 6126c7a678547..8614c72f30500 100644
--- a/llvm/lib/CodeGen/SafeStackLayout.h
+++ b/llvm/lib/CodeGen/SafeStackLayout.h
@@ -12,6 +12,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Analysis/StackLifetime.h"
+#include "llvm/Support/Alignment.h"
 
 namespace llvm {
 

diff  --git a/llvm/lib/Target/AArch64/AArch64MCInstLower.cpp b/llvm/lib/Target/AArch64/AArch64MCInstLower.cpp
index 37d621cd2f658..48672241f905d 100644
--- a/llvm/lib/Target/AArch64/AArch64MCInstLower.cpp
+++ b/llvm/lib/Target/AArch64/AArch64MCInstLower.cpp
@@ -18,6 +18,7 @@
 #include "llvm/CodeGen/MachineBasicBlock.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
+#include "llvm/IR/Function.h"
 #include "llvm/IR/Mangler.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"

diff  --git a/llvm/lib/Target/AMDGPU/AMDGPUMachineModuleInfo.h b/llvm/lib/Target/AMDGPU/AMDGPUMachineModuleInfo.h
index 0ddf9d6b93267..5c2ecaa65714f 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUMachineModuleInfo.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUMachineModuleInfo.h
@@ -16,6 +16,7 @@
 #define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEMODULEINFO_H
 
 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
+#include "llvm/IR/LLVMContext.h"
 
 namespace llvm {
 

diff  --git a/llvm/lib/Target/WebAssembly/WebAssemblyExceptionInfo.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyExceptionInfo.cpp
index b312ca7f5346b..77ac5fcb5c0d3 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyExceptionInfo.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyExceptionInfo.cpp
@@ -20,6 +20,7 @@
 #include "llvm/CodeGen/MachineDominators.h"
 #include "llvm/CodeGen/WasmEHFuncInfo.h"
 #include "llvm/InitializePasses.h"
+#include "llvm/IR/Function.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/Target/TargetMachine.h"
 

diff  --git a/llvm/lib/Transforms/Utils/CountVisits.cpp b/llvm/lib/Transforms/Utils/CountVisits.cpp
index 4faded8fc6563..f22880bc9a661 100644
--- a/llvm/lib/Transforms/Utils/CountVisits.cpp
+++ b/llvm/lib/Transforms/Utils/CountVisits.cpp
@@ -8,6 +8,7 @@
 
 #include "llvm/Transforms/Utils/CountVisits.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/IR/Function.h"
 #include "llvm/IR/PassManager.h"
 
 using namespace llvm;

diff  --git a/llvm/lib/Transforms/Utils/HelloWorld.cpp b/llvm/lib/Transforms/Utils/HelloWorld.cpp
index 7019e9e4451b2..1098281fa0e13 100644
--- a/llvm/lib/Transforms/Utils/HelloWorld.cpp
+++ b/llvm/lib/Transforms/Utils/HelloWorld.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Transforms/Utils/HelloWorld.h"
+#include "llvm/IR/Function.h"
 
 using namespace llvm;
 


        


More information about the llvm-commits mailing list