[llvm] r292062 - Reverted: Track validity of pass results
Serge Pavlov via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 15 02:23:19 PST 2017
Author: sepavloff
Date: Sun Jan 15 04:23:18 2017
New Revision: 292062
URL: http://llvm.org/viewvc/llvm-project?rev=292062&view=rev
Log:
Reverted: Track validity of pass results
Commits r291882 and related r291887.
Modified:
llvm/trunk/include/llvm/Pass.h
llvm/trunk/include/llvm/PassAnalysisSupport.h
llvm/trunk/lib/Analysis/CallGraphSCCPass.cpp
llvm/trunk/lib/Analysis/LoopInfo.cpp
llvm/trunk/lib/Analysis/LoopPass.cpp
llvm/trunk/lib/Analysis/RegionPass.cpp
llvm/trunk/lib/CodeGen/MachineDominators.cpp
llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp
llvm/trunk/lib/IR/LegacyPassManager.cpp
llvm/trunk/lib/IR/Pass.cpp
llvm/trunk/test/CodeGen/Generic/externally_available.ll
llvm/trunk/test/CodeGen/Mips/mul.ll
Modified: llvm/trunk/include/llvm/Pass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Pass.h?rev=292062&r1=292061&r2=292062&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Pass.h (original)
+++ llvm/trunk/include/llvm/Pass.h Sun Jan 15 04:23:18 2017
@@ -29,7 +29,6 @@
#ifndef LLVM_PASS_H
#define LLVM_PASS_H
-#include <assert.h>
#include <string>
namespace llvm {
@@ -83,39 +82,16 @@ class Pass {
AnalysisResolver *Resolver; // Used to resolve analysis
const void *PassID;
PassKind Kind;
- bool Executed;
-
void operator=(const Pass&) = delete;
Pass(const Pass &) = delete;
public:
explicit Pass(PassKind K, char &pid)
- : Resolver(nullptr), PassID(&pid), Kind(K), Executed(false) { }
+ : Resolver(nullptr), PassID(&pid), Kind(K) { }
virtual ~Pass();
- PassKind getPassKind() const { return Kind; }
-
- /// Returns true if the pass has already executed.
- ///
- /// For an analysis pass it means the result is available. If the function
- /// returns false, the pass was not run, was skipped or freed.
- ///
- bool isExecuted() const { return Executed; }
- /// Marks the pass as executed or not.
- ///
- /// A pass should be marked as executed, if its 'runOn*' method successfully
- /// finished. When the pass is not needed anymore, it is marked as
- /// 'non-executed', it takes place in \c freePass. It also occurs when the
- /// pass is skipped for some reason.
- ///
- /// The flag should be set prior to call to 'runOn*' method. If it decides
- /// that the pass should be skipped, it will reset the flag.
- ///
- void setExecuted(bool x) {
- assert(x || !getAsImmutablePass()); // Immutable pass cannot be invalidated.
- Executed = x;
- }
+ PassKind getPassKind() const { return Kind; }
/// getPassName - Return a nice clean name for a pass. This usually
/// implemented in terms of the name that is registered by one of the
@@ -303,7 +279,8 @@ public:
///
bool runOnModule(Module &) override { return false; }
- explicit ImmutablePass(char &pid) : ModulePass(pid) { setExecuted(true); }
+ explicit ImmutablePass(char &pid)
+ : ModulePass(pid) {}
// Force out-of-line virtual method.
~ImmutablePass() override;
@@ -339,9 +316,8 @@ public:
protected:
/// Optional passes call this function to check whether the pass should be
/// skipped. This is the case when Attribute::OptimizeNone is set or when
- /// optimization bisect is over the limit. It also resets flag Executed on
- /// the pass.
- bool skipFunction(const Function &F);
+ /// optimization bisect is over the limit.
+ bool skipFunction(const Function &F) const;
};
Modified: llvm/trunk/include/llvm/PassAnalysisSupport.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassAnalysisSupport.h?rev=292062&r1=292061&r2=292062&view=diff
==============================================================================
--- llvm/trunk/include/llvm/PassAnalysisSupport.h (original)
+++ llvm/trunk/include/llvm/PassAnalysisSupport.h Sun Jan 15 04:23:18 2017
@@ -206,9 +206,6 @@ AnalysisType *Pass::getAnalysisIfAvailab
Pass *ResultPass = Resolver->getAnalysisIfAvailable(PI, true);
if (!ResultPass) return nullptr;
- if (!ResultPass->isExecuted())
- return nullptr;
-
// Because the AnalysisType may not be a subclass of pass (for
// AnalysisGroups), we use getAdjustedAnalysisPointer here to potentially
// adjust the return pointer (because the class may multiply inherit, once
@@ -237,8 +234,6 @@ AnalysisType &Pass::getAnalysisID(Analys
assert (ResultPass &&
"getAnalysis*() called on an analysis that was not "
"'required' by pass!");
- assert(ResultPass->isExecuted() &&
- "getAnalysis*() called on an analysis that was freed");
// Because the AnalysisType may not be a subclass of pass (for
// AnalysisGroups), we use getAdjustedAnalysisPointer here to potentially
Modified: llvm/trunk/lib/Analysis/CallGraphSCCPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CallGraphSCCPass.cpp?rev=292062&r1=292061&r2=292062&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CallGraphSCCPass.cpp (original)
+++ llvm/trunk/lib/Analysis/CallGraphSCCPass.cpp Sun Jan 15 04:23:18 2017
@@ -414,7 +414,6 @@ bool CGPassManager::RunAllPassesOnSCC(Ca
initializeAnalysisImpl(P);
// Actually run this pass on the current SCC.
- P->setExecuted(true);
Changed |= RunPassOnSCC(P, CurSCC, CG,
CallGraphUpToDate, DevirtualizedCall);
Modified: llvm/trunk/lib/Analysis/LoopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopInfo.cpp?rev=292062&r1=292061&r2=292062&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopInfo.cpp Sun Jan 15 04:23:18 2017
@@ -731,10 +731,8 @@ void LoopInfoWrapperPass::verifyAnalysis
// checking by default, LoopPass has been taught to call verifyLoop manually
// during loop pass sequences.
if (VerifyLoopInfo) {
- if (auto *Analysis = getAnalysisIfAvailable<DominatorTreeWrapperPass>()) {
- auto &DT = Analysis->getDomTree();
- LI.verify(DT);
- }
+ auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
+ LI.verify(DT);
}
}
Modified: llvm/trunk/lib/Analysis/LoopPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPass.cpp?rev=292062&r1=292061&r2=292062&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopPass.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopPass.cpp Sun Jan 15 04:23:18 2017
@@ -198,7 +198,6 @@ bool LPPassManager::runOnFunction(Functi
PassManagerPrettyStackEntry X(P, *CurrentLoop->getHeader());
TimeRegion PassTimer(getPassTimer(P));
- P->setExecuted(true);
Changed |= P->runOnLoop(CurrentLoop, *this);
}
LoopWasDeleted = CurrentLoop->isInvalid();
Modified: llvm/trunk/lib/Analysis/RegionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/RegionPass.cpp?rev=292062&r1=292061&r2=292062&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/RegionPass.cpp (original)
+++ llvm/trunk/lib/Analysis/RegionPass.cpp Sun Jan 15 04:23:18 2017
@@ -94,7 +94,6 @@ bool RGPassManager::runOnFunction(Functi
PassManagerPrettyStackEntry X(P, *CurrentRegion->getEntry());
TimeRegion PassTimer(getPassTimer(P));
- P->setExecuted(true);
Changed |= P->runOnRegion(CurrentRegion, *this);
}
Modified: llvm/trunk/lib/CodeGen/MachineDominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineDominators.cpp?rev=292062&r1=292061&r2=292062&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineDominators.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineDominators.cpp Sun Jan 15 04:23:18 2017
@@ -69,7 +69,7 @@ void MachineDominatorTree::releaseMemory
}
void MachineDominatorTree::verifyAnalysis() const {
- if (VerifyMachineDomInfo && isExecuted())
+ if (VerifyMachineDomInfo)
verifyDomTree();
}
Modified: llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp?rev=292062&r1=292061&r2=292062&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp Sun Jan 15 04:23:18 2017
@@ -38,10 +38,8 @@ Pass *MachineFunctionPass::createPrinter
bool MachineFunctionPass::runOnFunction(Function &F) {
// Do not codegen any 'available_externally' functions at all, they have
// definitions outside the translation unit.
- if (F.hasAvailableExternallyLinkage()) {
- setExecuted(false);
+ if (F.hasAvailableExternallyLinkage())
return false;
- }
MachineModuleInfo &MMI = getAnalysis<MachineModuleInfo>();
MachineFunction &MF = MMI.getMachineFunction(F);
Modified: llvm/trunk/lib/IR/LegacyPassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LegacyPassManager.cpp?rev=292062&r1=292061&r2=292062&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LegacyPassManager.cpp (original)
+++ llvm/trunk/lib/IR/LegacyPassManager.cpp Sun Jan 15 04:23:18 2017
@@ -955,9 +955,6 @@ void PMDataManager::freePass(Pass *P, St
AvailableAnalysis.erase(Pos);
}
}
-
- if (!P->getAsImmutablePass())
- P->setExecuted(false);
}
/// Add pass P into the PassVector. Update
@@ -1296,7 +1293,6 @@ bool BBPassManager::runOnFunction(Functi
PassManagerPrettyStackEntry X(BP, *I);
TimeRegion PassTimer(getPassTimer(BP));
- BP->setExecuted(true);
LocalChanged |= BP->runOnBasicBlock(*I);
}
@@ -1463,9 +1459,7 @@ bool FunctionPassManagerImpl::run(Functi
initializeAllAnalysisInfo();
for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) {
- FPPassManager *P = getContainedManager(Index);
- P->setExecuted(true);
- Changed |= P->runOnFunction(F);
+ Changed |= getContainedManager(Index)->runOnFunction(F);
F.getContext().yield();
}
@@ -1516,7 +1510,6 @@ bool FPPassManager::runOnFunction(Functi
PassManagerPrettyStackEntry X(FP, F);
TimeRegion PassTimer(getPassTimer(FP));
- FP->setExecuted(true);
LocalChanged |= FP->runOnFunction(F);
}
@@ -1537,10 +1530,8 @@ bool FPPassManager::runOnFunction(Functi
bool FPPassManager::runOnModule(Module &M) {
bool Changed = false;
- for (Function &F : M) {
- setExecuted(true);
+ for (Function &F : M)
Changed |= runOnFunction(F);
- }
return Changed;
}
@@ -1596,7 +1587,6 @@ MPPassManager::runOnModule(Module &M) {
PassManagerPrettyStackEntry X(MP, M);
TimeRegion PassTimer(getPassTimer(MP));
- MP->setExecuted(true);
LocalChanged |= MP->runOnModule(M);
}
@@ -1700,9 +1690,7 @@ bool PassManagerImpl::run(Module &M) {
initializeAllAnalysisInfo();
for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) {
- MPPassManager *P = getContainedManager(Index);
- P->setExecuted(true);
- Changed |= P->runOnModule(M);
+ Changed |= getContainedManager(Index)->runOnModule(M);
M.getContext().yield();
}
Modified: llvm/trunk/lib/IR/Pass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Pass.cpp?rev=292062&r1=292061&r2=292062&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Pass.cpp (original)
+++ llvm/trunk/lib/IR/Pass.cpp Sun Jan 15 04:23:18 2017
@@ -146,16 +146,13 @@ PassManagerType FunctionPass::getPotenti
return PMT_FunctionPassManager;
}
-bool FunctionPass::skipFunction(const Function &F) {
- if (!F.getContext().getOptBisect().shouldRunPass(this, F)) {
- setExecuted(false);
+bool FunctionPass::skipFunction(const Function &F) const {
+ if (!F.getContext().getOptBisect().shouldRunPass(this, F))
return true;
- }
if (F.hasFnAttribute(Attribute::OptimizeNone)) {
DEBUG(dbgs() << "Skipping pass '" << getPassName() << "' on function "
<< F.getName() << "\n");
- setExecuted(false);
return true;
}
return false;
Modified: llvm/trunk/test/CodeGen/Generic/externally_available.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/externally_available.ll?rev=292062&r1=292061&r2=292062&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/externally_available.ll (original)
+++ llvm/trunk/test/CodeGen/Generic/externally_available.ll Sun Jan 15 04:23:18 2017
@@ -1,4 +1,4 @@
-; RUN: llc -verify-machine-dom-info < %s | not grep test_
+; RUN: llc < %s | not grep test_
; test_function should not be emitted to the .s file.
define available_externally i32 @test_function() {
Modified: llvm/trunk/test/CodeGen/Mips/mul.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/mul.ll?rev=292062&r1=292061&r2=292062&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/mul.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/mul.ll Sun Jan 15 04:23:18 2017
@@ -1,4 +1,4 @@
-; RUN: llc -march=mipsel -mattr=mips16 -relocation-model=pic -O3 -verify-loop-info < %s | FileCheck %s -check-prefix=16
+; RUN: llc -march=mipsel -mattr=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16
@iiii = global i32 5, align 4
@jjjj = global i32 -6, align 4
More information about the llvm-commits
mailing list