Skip to content

Commit 7786737

Browse files
authored
[NFC] Instrument loop pass manager (microsoft#7039)
This adds time trace hooks to instrument loop pass manager exectuion logging the function as a scope and each pass under the function.
1 parent 5b75d5d commit 7786737

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/Analysis/LoopPass.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "llvm/IR/IRPrintingPasses.h"
1818
#include "llvm/IR/LLVMContext.h"
1919
#include "llvm/Support/Debug.h"
20+
#include "llvm/Support/TimeProfiler.h" // HLSL Change
2021
#include "llvm/Support/Timer.h"
2122
#include "llvm/Support/raw_ostream.h"
2223
using namespace llvm;
@@ -199,6 +200,10 @@ bool LPPassManager::runOnFunction(Function &F) {
199200
LI = &LIWP.getLoopInfo();
200201
bool Changed = false;
201202

203+
// HLSL Change Begin - Support hierarchial time tracing.
204+
llvm::TimeTraceScope FunctionScope("Loop Pass Manager Function", F.getName());
205+
// HLSL Change End
206+
202207
// Collect inherited analysis from Module level pass manager.
203208
populateInheritedAnalysis(TPM->activeStack);
204209

@@ -248,6 +253,10 @@ bool LPPassManager::runOnFunction(Function &F) {
248253
PassManagerPrettyStackEntry X(P, *CurrentLoop->getHeader());
249254
TimeRegion PassTimer(getPassTimer(P));
250255

256+
// HLSL Change Begin - Support hierarchial time tracing.
257+
llvm::TimeTraceScope PassScope("RunLoopPass", P->getPassName());
258+
// HLSL Change End - Support hierarchial time tracing.
259+
251260
Changed |= P->runOnLoop(CurrentLoop, *this);
252261
}
253262

0 commit comments

Comments
 (0)