[PATCH] D86678: [Attributor] Add a phase flag to Attributor
Shinji Okumura via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 09:27:00 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7a68f0f1e00b: [Attributor] Add a phase flag to Attributor (authored by okura).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86678/new/
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
@@ -1323,7 +1323,7 @@
ChangeStatus Attributor::run() {
TimeTraceScope TimeScope("Attributor::run");
- SeedingPeriod = false;
+ Phase = AttributorPhase::UPDATE;
runTillFixpoint();
// dump graphs on demand
@@ -1336,8 +1336,12 @@
if (PrintDependencies)
DG.print();
+ Phase = AttributorPhase::MANIFEST;
ChangeStatus ManifestChange = manifestAttributes();
+
+ Phase = AttributorPhase::CLEANUP;
ChangeStatus CleanupChange = cleanupIR();
+
return ManifestChange | CleanupChange;
}
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 == AttributorPhase::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 = AttributorPhase::UPDATE;
updateAA(AA);
- SeedingPeriod = OldSeedingPeriod;
+ Phase = OldPhase;
if (TrackDependence && AA.getState().isValidState())
recordDependence(AA, const_cast<AbstractAttribute &>(*QueryingAA),
@@ -1522,9 +1522,14 @@
/// 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. Phase is changed in `Attributor::run()`
+ enum class AttributorPhase {
+ SEEDING,
+ UPDATE,
+ MANIFEST,
+ CLEANUP,
+ } Phase = AttributorPhase::SEEDING;
/// Functions, blocks, and instructions we delete after manifest is done.
///
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86678.288365.patch
Type: text/x-patch
Size: 2436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200827/46ce02d7/attachment.bin>
More information about the llvm-commits
mailing list