Skip to content

Commit

Permalink
[NFC] Instrument loop pass manager (#7039)
Browse files Browse the repository at this point in the history
This adds time trace hooks to instrument loop pass manager exectuion
logging the function as a scope and each pass under the function.
  • Loading branch information
llvm-beanz authored Dec 18, 2024
1 parent 5b75d5d commit 7786737
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Analysis/LoopPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "llvm/IR/IRPrintingPasses.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/TimeProfiler.h" // HLSL Change
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
Expand Down Expand Up @@ -199,6 +200,10 @@ bool LPPassManager::runOnFunction(Function &F) {
LI = &LIWP.getLoopInfo();
bool Changed = false;

// HLSL Change Begin - Support hierarchial time tracing.
llvm::TimeTraceScope FunctionScope("Loop Pass Manager Function", F.getName());
// HLSL Change End

// Collect inherited analysis from Module level pass manager.
populateInheritedAnalysis(TPM->activeStack);

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

// HLSL Change Begin - Support hierarchial time tracing.
llvm::TimeTraceScope PassScope("RunLoopPass", P->getPassName());
// HLSL Change End - Support hierarchial time tracing.

Changed |= P->runOnLoop(CurrentLoop, *this);
}

Expand Down

0 comments on commit 7786737

Please sign in to comment.