Skip to content

Commit 49def10

Browse files
committed
[Attributor] Add time trace support.
This patch addes time trace functionality to have a better understanding of the analysis times. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D84980
1 parent 24f5235 commit 49def10

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

llvm/include/llvm/Transforms/IPO/Attributor.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
#include "llvm/Support/Casting.h"
118118
#include "llvm/Support/DOTGraphTraits.h"
119119
#include "llvm/Support/GraphWriter.h"
120+
#include "llvm/Support/TimeProfiler.h"
120121
#include "llvm/Transforms/Utils/CallGraphUpdater.h"
121122

122123
namespace llvm {
@@ -1001,8 +1002,10 @@ struct Attributor {
10011002
return AA;
10021003
}
10031004

1004-
AA.initialize(*this);
1005-
1005+
{
1006+
TimeTraceScope TimeScope(AA.getName() + "::initialize");
1007+
AA.initialize(*this);
1008+
}
10061009
// We can initialize (=look at) code outside the current function set but
10071010
// not call update because that would again spawn new abstract attributes in
10081011
// potentially unconnected code regions (=SCCs).

llvm/lib/Transforms/IPO/Attributor.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,7 @@ bool Attributor::checkForAllReadWriteInstructions(
931931
}
932932

933933
void Attributor::runTillFixpoint() {
934+
TimeTraceScope TimeScope("Attributor::runTillFixpoint");
934935
LLVM_DEBUG(dbgs() << "[Attributor] Identified and initialized "
935936
<< DG.SyntheticRoot.Deps.size()
936937
<< " abstract attributes.\n");
@@ -1067,6 +1068,7 @@ void Attributor::runTillFixpoint() {
10671068
}
10681069

10691070
ChangeStatus Attributor::manifestAttributes() {
1071+
TimeTraceScope TimeScope("Attributor::manifestAttributes");
10701072
size_t NumFinalAAs = DG.SyntheticRoot.Deps.size();
10711073

10721074
unsigned NumManifested = 0;
@@ -1129,6 +1131,7 @@ ChangeStatus Attributor::manifestAttributes() {
11291131
}
11301132

11311133
ChangeStatus Attributor::cleanupIR() {
1134+
TimeTraceScope TimeScope("Attributor::cleanupIR");
11321135
// Delete stuff at the end to avoid invalid references and a nice order.
11331136
LLVM_DEBUG(dbgs() << "\n[Attributor] Delete at least "
11341137
<< ToBeDeletedFunctions.size() << " functions and "
@@ -1297,6 +1300,8 @@ ChangeStatus Attributor::cleanupIR() {
12971300
}
12981301

12991302
ChangeStatus Attributor::run() {
1303+
TimeTraceScope TimeScope("Attributor::run");
1304+
13001305
SeedingPeriod = false;
13011306
runTillFixpoint();
13021307

@@ -1316,6 +1321,8 @@ ChangeStatus Attributor::run() {
13161321
}
13171322

13181323
ChangeStatus Attributor::updateAA(AbstractAttribute &AA) {
1324+
TimeTraceScope TimeScope(AA.getName() + "::updateAA");
1325+
13191326
// Use a new dependence vector for this update.
13201327
DependenceVector DV;
13211328
DependenceStack.push_back(&DV);

0 commit comments

Comments
 (0)