[llvm] 3013f2d - Revert "[Attributor] Split the Attributor::run() into multiple functions."
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 10 03:11:35 PDT 2020
Author: sstefan1
Date: 2020-06-10T10:10:49Z
New Revision: 3013f2d329b7a41228d6404ab40ba412a26adcb4
URL: https://github.com/llvm/llvm-project/commit/3013f2d329b7a41228d6404ab40ba412a26adcb4
DIFF: https://github.com/llvm/llvm-project/commit/3013f2d329b7a41228d6404ab40ba412a26adcb4.diff
LOG: Revert "[Attributor] Split the Attributor::run() into multiple functions."
This reverts commit 0ee47cc92f510e4f21b584dc265105f4d51776a0.
Added:
Modified:
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/Attributor.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index 3fd9eebc0fc4..a5d504334745 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -1213,22 +1213,6 @@ struct Attributor {
BumpPtrAllocator &Allocator;
private:
- /// This method will do fixpoint iteration until fixpoint or the
- /// maximum iteration count is reached.
- ///
- /// If the maximum iteration count is reached, This method will
- /// indicate pessimistic fixpoint on attributes that transitively depend
- /// on attributes that were scheduled for an update.
- void runTillFixpoint();
-
- /// Gets called after scheduling, manifests attributes to the LLVM IR.
- ChangeStatus manifestAttributes();
-
- /// Gets called after attributes have been manifested, cleans up the IR.
- /// Deletes dead functions, blocks and instructions.
- /// Rewrites function signitures and updates the call graph.
- ChangeStatus cleanupIR();
-
/// Run `::update` on \p AA and track the dependences queried while doing so.
/// Also adjust the state if we know further updates are not necessary.
ChangeStatus updateAA(AbstractAttribute &AA);
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index fb36f2844c58..c597e058a8c9 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -894,7 +894,7 @@ bool Attributor::checkForAllReadWriteInstructions(
return true;
}
-void Attributor::runTillFixpoint() {
+ChangeStatus Attributor::run() {
LLVM_DEBUG(dbgs() << "[Attributor] Identified and initialized "
<< AllAbstractAttributes.size()
<< " abstract attributes.\n");
@@ -988,6 +988,8 @@ void Attributor::runTillFixpoint() {
<< IterationCounter << "/" << MaxFixpointIterations
<< " iterations\n");
+ size_t NumFinalAAs = AllAbstractAttributes.size();
+
// Reset abstract arguments not settled in a sound fixpoint by now. This
// happens when we stopped the fixpoint iteration early. Note that only the
// ones marked as "changed" *and* the ones transitively depending on them
@@ -1018,19 +1020,6 @@ void Attributor::runTillFixpoint() {
<< " abstract attributes.\n";
});
- if (VerifyMaxFixpointIterations &&
- IterationCounter != MaxFixpointIterations) {
- errs() << "\n[Attributor] Fixpoint iteration done after: "
- << IterationCounter << "/" << MaxFixpointIterations
- << " iterations\n";
- llvm_unreachable("The fixpoint was not reached with exactly the number of "
- "specified iterations!");
- }
-}
-
-ChangeStatus Attributor::manifestAttributes() {
- size_t NumFinalAAs = AllAbstractAttributes.size();
-
unsigned NumManifested = 0;
unsigned NumAtFixpoint = 0;
ChangeStatus ManifestChange = ChangeStatus::UNCHANGED;
@@ -1083,11 +1072,9 @@ ChangeStatus Attributor::manifestAttributes() {
llvm_unreachable("Expected the final number of abstract attributes to "
"remain unchanged!");
}
- return ManifestChange;
-}
-ChangeStatus Attributor::cleanupIR() {
// Delete stuff at the end to avoid invalid references and a nice order.
+ {
LLVM_DEBUG(dbgs() << "\n[Attributor] Delete at least "
<< ToBeDeletedFunctions.size() << " functions and "
<< ToBeDeletedBlocks.size() << " blocks and "
@@ -1225,18 +1212,28 @@ ChangeStatus Attributor::cleanupIR() {
FoundDeadFn = true;
}
}
+ }
// Rewrite the functions as requested during manifest.
- ChangeStatus ManifestChange =
- rewriteFunctionSignatures(CGModifiedFunctions);
+ ManifestChange =
+ ManifestChange | rewriteFunctionSignatures(CGModifiedFunctions);
- for (Function *Fn : CGModifiedFunctions)
- CGUpdater.reanalyzeFunction(*Fn);
+ for (Function *Fn : CGModifiedFunctions)
+ CGUpdater.reanalyzeFunction(*Fn);
- for (Function *Fn : ToBeDeletedFunctions)
- CGUpdater.removeFunction(*Fn);
+ for (Function *Fn : ToBeDeletedFunctions)
+ CGUpdater.removeFunction(*Fn);
- NumFnDeleted += ToBeDeletedFunctions.size();
+ NumFnDeleted += ToBeDeletedFunctions.size();
+
+ if (VerifyMaxFixpointIterations &&
+ IterationCounter != MaxFixpointIterations) {
+ errs() << "\n[Attributor] Fixpoint iteration done after: "
+ << IterationCounter << "/" << MaxFixpointIterations
+ << " iterations\n";
+ llvm_unreachable("The fixpoint was not reached with exactly the number of "
+ "specified iterations!");
+ }
#ifdef EXPENSIVE_CHECKS
for (Function *F : Functions) {
@@ -1249,13 +1246,6 @@ ChangeStatus Attributor::cleanupIR() {
return ManifestChange;
}
-ChangeStatus Attributor::run() {
- runTillFixpoint();
- ChangeStatus ManifestChange = manifestAttributes();
- ChangeStatus CleanupChange = cleanupIR();
- return ManifestChange | CleanupChange;
-}
-
ChangeStatus Attributor::updateAA(AbstractAttribute &AA) {
// Use a new dependence vector for this update.
DependenceVector DV;
More information about the llvm-commits
mailing list