From 2684ddd72e6274be60129d5510d9d5073463d0a4 Mon Sep 17 00:00:00 2001 From: Paul Robinson Date: Thu, 6 Feb 2014 00:07:05 +0000 Subject: Disable most IR-level transform passes on functions marked 'optnone'. Ideally only those transform passes that run at -O0 remain enabled, in reality we get as close as we reasonably can. Passes are responsible for disabling themselves, it's not the job of the pass manager to do it for them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200892 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/LoopPass.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/Analysis/LoopPass.cpp') diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp index 4775359c50..db69e1325a 100644 --- a/lib/Analysis/LoopPass.cpp +++ b/lib/Analysis/LoopPass.cpp @@ -365,3 +365,17 @@ void LoopPass::assignPassManager(PMStack &PMS, LPPM->add(this); } + +// Containing function has Attribute::OptimizeNone and transformation +// passes should skip it. +bool LoopPass::skipOptnoneFunction(Loop *L) 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() + << "' in function " << F->getName() << "\n"); + // FIXME: Delete loop from pass manager's queue? + return true; + } + return false; +} -- cgit v1.2.3