diff --git a/lib/Target/Sparc/EmitAssembly.cpp b/lib/Target/Sparc/EmitAssembly.cpp index fa2aeaa3b11..f4ca22f9da9 100644 --- a/lib/Target/Sparc/EmitAssembly.cpp +++ b/lib/Target/Sparc/EmitAssembly.cpp @@ -209,6 +209,10 @@ struct SparcFunctionAsmPrinter : public FunctionPass, public AsmPrinter { return false; } + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + } + void emitFunction(const Function *F); private : void emitBasicBlock(const BasicBlock *BB); @@ -427,6 +431,11 @@ public: return false; } + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + } + +private: void emitGlobalsAndConstants(const Module *M); void printGlobalVariable(const GlobalVariable *GV); @@ -436,7 +445,6 @@ public: static void FoldConstants(const Module *M, std::hash_set &moduleConstants); - }; diff --git a/lib/Transforms/HoistPHIConstants.cpp b/lib/Transforms/HoistPHIConstants.cpp index f6e6109ea5f..e969ac24b3a 100644 --- a/lib/Transforms/HoistPHIConstants.cpp +++ b/lib/Transforms/HoistPHIConstants.cpp @@ -76,6 +76,10 @@ static bool doHoistPHIConstants(Function *M) { namespace { struct HoistPHIConstants : public FunctionPass { virtual bool runOnFunction(Function *F) { return doHoistPHIConstants(F); } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.preservesCFG(); + } }; } diff --git a/lib/Transforms/IPO/ConstantMerge.cpp b/lib/Transforms/IPO/ConstantMerge.cpp index ee28b13a2cd..a635b8d21be 100644 --- a/lib/Transforms/IPO/ConstantMerge.cpp +++ b/lib/Transforms/IPO/ConstantMerge.cpp @@ -82,6 +82,10 @@ namespace { Constants.clear(); return false; } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + } }; struct DynamicConstantMerge : public ConstantMerge { diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp index 7b263c76ad8..384516283ca 100644 --- a/lib/Transforms/Instrumentation/TraceValues.cpp +++ b/lib/Transforms/Instrumentation/TraceValues.cpp @@ -49,6 +49,10 @@ namespace { bool runOnFunction(Function *F) { return doit(F, TraceBasicBlockExits, TraceFunctionExits, PrintfFunc); } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.preservesCFG(); + } }; } // end anonymous namespace diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp index 77d06a0946c..07981d0aa36 100644 --- a/lib/Transforms/LevelRaise.cpp +++ b/lib/Transforms/LevelRaise.cpp @@ -472,6 +472,10 @@ static bool doRPR(Function *F) { namespace { struct RaisePointerReferences : public FunctionPass { virtual bool runOnFunction(Function *F) { return doRPR(F); } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.preservesCFG(); + } }; } diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp index 0f1d0aea323..a8dbe3ff955 100644 --- a/lib/Transforms/Scalar/ConstantProp.cpp +++ b/lib/Transforms/Scalar/ConstantProp.cpp @@ -219,6 +219,12 @@ namespace { return Modified; } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + // FIXME: This pass does not preserve the CFG because it folds terminator + // instructions! + //AU.preservesCFG(); + } }; } diff --git a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp index 78dcfd50dd6..f901a29015d 100644 --- a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp +++ b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp @@ -175,6 +175,10 @@ namespace { virtual bool runOnFunction(Function *F) { return doDecomposeMultiDimRefs(F); } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.preservesCFG(); + } }; } diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp index 8bdbad522b9..b864760e688 100644 --- a/lib/Transforms/Scalar/GCSE.cpp +++ b/lib/Transforms/Scalar/GCSE.cpp @@ -51,7 +51,7 @@ namespace { // This transformation requires dominator and immediate dominator info virtual void getAnalysisUsage(AnalysisUsage &AU) const { - //preservesCFG(AU); + AU.preservesCFG(); AU.addRequired(DominatorSet::ID); AU.addRequired(ImmediateDominators::ID); } diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index a115e050d17..003419bb84f 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -203,6 +203,7 @@ namespace { virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(LoopInfo::ID); + AU.preservesCFG(); } }; } diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index dea024442de..626c1301141 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -42,10 +42,12 @@ namespace { } public: - - virtual bool runOnFunction(Function *F); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.preservesCFG(); + } + // Visitation implementation - Implement instruction combining for different // instruction types. The semantics are as follows: // Return Value: diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index c68004d2455..12d518b3c8c 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -470,6 +470,10 @@ namespace { SCCP S(F); return S.doSCCP(); } + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + // FIXME: SCCP does not preserve the CFG because it folds terminators! + //AU.preservesCFG(); + } }; } diff --git a/lib/Transforms/Scalar/SymbolStripping.cpp b/lib/Transforms/Scalar/SymbolStripping.cpp index 36b465ebb65..f99684faaf6 100644 --- a/lib/Transforms/Scalar/SymbolStripping.cpp +++ b/lib/Transforms/Scalar/SymbolStripping.cpp @@ -64,6 +64,9 @@ namespace { virtual bool runOnFunction(Function *F) { return doSymbolStripping(F); } + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + } }; struct FullSymbolStripping : public SymbolStripping { diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index ab945500777..e0d2c2475fc 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -53,6 +53,7 @@ namespace { // virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(DominanceFrontier::ID); + AU.preservesCFG(); } private: diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index de439b7792b..8621ea78813 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -81,6 +81,10 @@ namespace { // Anonymous namespace for class return false; } + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + } + // Verification methods... void verifySymbolTable(SymbolTable *ST); void visitFunction(Function *F); diff --git a/tools/analyze/analyze.cpp b/tools/analyze/analyze.cpp index 85d6ae4d64b..8a1d86caf17 100644 --- a/tools/analyze/analyze.cpp +++ b/tools/analyze/analyze.cpp @@ -110,6 +110,7 @@ public: virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(ID); + AU.setPreservesAll(); } }; @@ -137,6 +138,10 @@ struct InstForest : public FunctionPass { void doit(Function *F) { std::cout << analysis::InstForest(F); } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + } }; struct IndVars : public FunctionPass { @@ -152,6 +157,7 @@ struct IndVars : public FunctionPass { void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(LoopInfo::ID); + AU.setPreservesAll(); } }; @@ -183,6 +189,9 @@ struct Exprs : public FunctionPass { std::cout << "\n\n"; } } + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + } };