[PATCH] D86678: [Attributor] Add a phase flag to Attributor
Shinji Okumura via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 22:27:28 PDT 2020
okura created this revision.
Herald added subscribers: llvm-commits, kuter, uenoku, hiraditya.
Herald added a reviewer: uenoku.
Herald added a reviewer: homerdin.
Herald added a project: LLVM.
okura requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.
Herald added a subscriber: bbn.
https://reviews.llvm.org/D86678
Files:
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/Attributor.cpp
Index: llvm/lib/Transforms/IPO/Attributor.cpp
===================================================================
--- llvm/lib/Transforms/IPO/Attributor.cpp
+++ llvm/lib/Transforms/IPO/Attributor.cpp
@@ -949,6 +949,7 @@
}
void Attributor::runTillFixpoint() {
+ Phase = UPDATE;
TimeTraceScope TimeScope("Attributor::runTillFixpoint");
LLVM_DEBUG(dbgs() << "[Attributor] Identified and initialized "
<< DG.SyntheticRoot.Deps.size()
@@ -1086,6 +1087,7 @@
}
ChangeStatus Attributor::manifestAttributes() {
+ Phase = MANIFEST;
TimeTraceScope TimeScope("Attributor::manifestAttributes");
size_t NumFinalAAs = DG.SyntheticRoot.Deps.size();
@@ -1149,6 +1151,7 @@
}
ChangeStatus Attributor::cleanupIR() {
+ Phase = CLEANUP;
TimeTraceScope TimeScope("Attributor::cleanupIR");
// Delete stuff at the end to avoid invalid references and a nice order.
LLVM_DEBUG(dbgs() << "\n[Attributor] Delete at least "
@@ -1320,7 +1323,6 @@
ChangeStatus Attributor::run() {
TimeTraceScope TimeScope("Attributor::run");
- SeedingPeriod = false;
runTillFixpoint();
// dump graphs on demand
Index: llvm/include/llvm/Transforms/IPO/Attributor.h
===================================================================
--- llvm/include/llvm/Transforms/IPO/Attributor.h
+++ llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -986,7 +986,7 @@
auto &AA = AAType::createForPosition(IRP, *this);
// If we are currenty seeding attributes, enforce seeding rules.
- if (SeedingPeriod && !shouldSeedAttribute(AA)) {
+ if (Phase == SEEDING && !shouldSeedAttribute(AA)) {
AA.getState().indicatePessimisticFixpoint();
return AA;
}
@@ -1022,12 +1022,12 @@
// Allow seeded attributes to declare dependencies.
// Remember the seeding state.
- bool OldSeedingPeriod = SeedingPeriod;
- SeedingPeriod = false;
+ AttributorPhase OldPhase = Phase;
+ Phase = UPDATE;
updateAA(AA);
- SeedingPeriod = OldSeedingPeriod;
+ Phase = OldPhase;
if (TrackDependence && AA.getState().isValidState())
recordDependence(AA, const_cast<AbstractAttribute &>(*QueryingAA),
@@ -1522,9 +1522,15 @@
/// Invoke instructions with at least a single dead successor block.
SmallVector<WeakVH, 16> InvokeWithDeadSuccessor;
- /// Wheather attributes are being `seeded`, always false after ::run function
- /// gets called \see getOrCreateAAFor.
- bool SeedingPeriod = true;
+ /// A flag that indicates which stage of the process we are in. Initially, the
+ /// phase is SEEDING. UPDATE, MANIFEST and CLEANUP correspond to
+ /// ::runTillFixpoint, ::manifestAttributes and ::cleanupIR, respectively.
+ enum AttributorPhase {
+ SEEDING,
+ UPDATE,
+ MANIFEST,
+ CLEANUP,
+ } Phase = SEEDING;
/// Functions, blocks, and instructions we delete after manifest is done.
///
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86678.288190.patch
Type: text/x-patch
Size: 2883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200827/2fff07cd/attachment.bin>
More information about the llvm-commits
mailing list