From cf84b5ba5eecf5ae1b3d8b7af77fbb9f08b48d49 Mon Sep 17 00:00:00 2001 From: Paul Robinson Date: Wed, 26 Feb 2014 01:23:26 +0000 Subject: [PATCH] Constify the Optnone checks in IR passes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202213 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/LoopPass.h | 2 +- include/llvm/Pass.h | 4 ++-- lib/Analysis/LoopPass.cpp | 4 ++-- lib/IR/Pass.cpp | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/llvm/Analysis/LoopPass.h b/include/llvm/Analysis/LoopPass.h index 9ca55053f53..7ec994d3697 100644 --- a/include/llvm/Analysis/LoopPass.h +++ b/include/llvm/Analysis/LoopPass.h @@ -85,7 +85,7 @@ public: protected: /// skipOptnoneFunction - Containing function has Attribute::OptimizeNone /// and most transformation passes should skip it. - bool skipOptnoneFunction(Loop *L) const; + bool skipOptnoneFunction(const Loop *L) const; }; class LPPassManager : public FunctionPass, public PMDataManager { diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index e16144397c4..bfe57724d7b 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -311,7 +311,7 @@ public: protected: /// skipOptnoneFunction - This function has Attribute::OptimizeNone /// and most transformation passes should skip it. - bool skipOptnoneFunction(Function &F) const; + bool skipOptnoneFunction(const Function &F) const; }; @@ -360,7 +360,7 @@ public: protected: /// skipOptnoneFunction - Containing function has Attribute::OptimizeNone /// and most transformation passes should skip it. - bool skipOptnoneFunction(BasicBlock &BB) const; + bool skipOptnoneFunction(const BasicBlock &BB) const; }; /// If the user specifies the -time-passes argument on an LLVM tool command line diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp index db69e1325a8..90f64fb8657 100644 --- a/lib/Analysis/LoopPass.cpp +++ b/lib/Analysis/LoopPass.cpp @@ -368,8 +368,8 @@ void LoopPass::assignPassManager(PMStack &PMS, // Containing function has Attribute::OptimizeNone and transformation // passes should skip it. -bool LoopPass::skipOptnoneFunction(Loop *L) const { - Function *F = L->getHeader()->getParent(); +bool LoopPass::skipOptnoneFunction(const Loop *L) const { + const Function *F = L->getHeader()->getParent(); if (F && F->hasFnAttribute(Attribute::OptimizeNone)) { // FIXME: Report this to dbgs() only once per function. DEBUG(dbgs() << "Skipping pass '" << getPassName() diff --git a/lib/IR/Pass.cpp b/lib/IR/Pass.cpp index 84b0b04d698..f81a1c77a8f 100644 --- a/lib/IR/Pass.cpp +++ b/lib/IR/Pass.cpp @@ -138,7 +138,7 @@ PassManagerType FunctionPass::getPotentialPassManagerType() const { return PMT_FunctionPassManager; } -bool FunctionPass::skipOptnoneFunction(Function &F) const { +bool FunctionPass::skipOptnoneFunction(const Function &F) const { if (F.hasFnAttribute(Attribute::OptimizeNone)) { DEBUG(dbgs() << "Skipping pass '" << getPassName() << "' on function " << F.getName() << "\n"); @@ -166,8 +166,8 @@ bool BasicBlockPass::doFinalization(Function &) { return false; } -bool BasicBlockPass::skipOptnoneFunction(BasicBlock &BB) const { - Function *F = BB.getParent(); +bool BasicBlockPass::skipOptnoneFunction(const BasicBlock &BB) const { + const Function *F = BB.getParent(); if (F && F->hasFnAttribute(Attribute::OptimizeNone)) { // Report this only once per function. if (&BB == &F->getEntryBlock())