forked from OSchip/llvm-project
Output per-function size-info remarks
This patch adds per-function size information remarks. Previously, passing -Rpass-analysis=size-info would only give you per-module changes. By adding the ability to do this per-function, it's easier to see which functions contributed the most to size changes. https://reviews.llvm.org/D51467 llvm-svn: 341588
This commit is contained in:
parent
b23648cfdb
commit
a0aa5b35e7
|
@ -406,14 +406,23 @@ public:
|
|||
/// Set the initial size of the module if the user has specified that they
|
||||
/// want remarks for size.
|
||||
/// Returns 0 if the remark was not requested.
|
||||
unsigned initSizeRemarkInfo(Module &M);
|
||||
unsigned initSizeRemarkInfo(
|
||||
Module &M,
|
||||
StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount);
|
||||
|
||||
/// Emit a remark signifying that the number of IR instructions in the module
|
||||
/// changed.
|
||||
/// \p F is optionally passed by passes which run on Functions, and thus
|
||||
/// always know whether or not a non-empty function is available.
|
||||
void emitInstrCountChangedRemark(Pass *P, Module &M, int64_t Delta,
|
||||
unsigned CountBefore, Function *F = nullptr);
|
||||
///
|
||||
/// \p FunctionToInstrCount maps the name of a \p Function to a pair. The
|
||||
/// first member of the pair is the IR count of the \p Function before running
|
||||
/// \p P, and the second member is the IR count of the \p Function after
|
||||
/// running \p P.
|
||||
void emitInstrCountChangedRemark(
|
||||
Pass *P, Module &M, int64_t Delta, unsigned CountBefore,
|
||||
StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount,
|
||||
Function *F = nullptr);
|
||||
|
||||
protected:
|
||||
// Top level manager.
|
||||
|
|
|
@ -132,10 +132,11 @@ bool CGPassManager::RunPassOnSCC(Pass *P, CallGraphSCC &CurSCC,
|
|||
|
||||
{
|
||||
unsigned InstrCount, SCCCount = 0;
|
||||
StringMap<std::pair<unsigned, unsigned>> FunctionToInstrCount;
|
||||
bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
|
||||
TimeRegion PassTimer(getPassTimer(CGSP));
|
||||
if (EmitICRemark)
|
||||
InstrCount = initSizeRemarkInfo(M);
|
||||
InstrCount = initSizeRemarkInfo(M, FunctionToInstrCount);
|
||||
Changed = CGSP->runOnSCC(CurSCC);
|
||||
|
||||
if (EmitICRemark) {
|
||||
|
@ -146,7 +147,8 @@ bool CGPassManager::RunPassOnSCC(Pass *P, CallGraphSCC &CurSCC,
|
|||
// Yep. Emit a remark and update InstrCount.
|
||||
int64_t Delta =
|
||||
static_cast<int64_t>(SCCCount) - static_cast<int64_t>(InstrCount);
|
||||
emitInstrCountChangedRemark(P, M, Delta, InstrCount);
|
||||
emitInstrCountChangedRemark(P, M, Delta, InstrCount,
|
||||
FunctionToInstrCount);
|
||||
InstrCount = SCCCount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,10 +195,11 @@ bool LPPassManager::runOnFunction(Function &F) {
|
|||
|
||||
// Walk Loops
|
||||
unsigned InstrCount, FunctionSize = 0;
|
||||
StringMap<std::pair<unsigned, unsigned>> FunctionToInstrCount;
|
||||
bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
|
||||
// Collect the initial size of the module and the function we're looking at.
|
||||
if (EmitICRemark) {
|
||||
InstrCount = initSizeRemarkInfo(M);
|
||||
InstrCount = initSizeRemarkInfo(M, FunctionToInstrCount);
|
||||
FunctionSize = F.getInstructionCount();
|
||||
}
|
||||
while (!LQ.empty()) {
|
||||
|
@ -226,7 +227,8 @@ bool LPPassManager::runOnFunction(Function &F) {
|
|||
if (NewSize != FunctionSize) {
|
||||
int64_t Delta = static_cast<int64_t>(NewSize) -
|
||||
static_cast<int64_t>(FunctionSize);
|
||||
emitInstrCountChangedRemark(P, M, Delta, InstrCount, &F);
|
||||
emitInstrCountChangedRemark(P, M, Delta, InstrCount,
|
||||
FunctionToInstrCount, &F);
|
||||
InstrCount = static_cast<int64_t>(InstrCount) + Delta;
|
||||
FunctionSize = NewSize;
|
||||
}
|
||||
|
|
|
@ -136,15 +136,32 @@ bool PMDataManager::isPassDebuggingExecutionsOrMore() const {
|
|||
return PassDebugging >= Executions;
|
||||
}
|
||||
|
||||
unsigned PMDataManager::initSizeRemarkInfo(Module &M) {
|
||||
unsigned PMDataManager::initSizeRemarkInfo(
|
||||
Module &M, StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount) {
|
||||
// Only calculate getInstructionCount if the size-info remark is requested.
|
||||
return M.getInstructionCount();
|
||||
unsigned InstrCount = 0;
|
||||
|
||||
// Collect instruction counts for every function. We'll use this to emit
|
||||
// per-function size remarks later.
|
||||
for (Function &F : M) {
|
||||
unsigned FCount = F.getInstructionCount();
|
||||
|
||||
// Insert a record into FunctionToInstrCount keeping track of the current
|
||||
// size of the function as the first member of a pair. Set the second
|
||||
// member to 0; if the function is deleted by the pass, then when we get
|
||||
// here, we'll be able to let the user know that F no longer contributes to
|
||||
// the module.
|
||||
FunctionToInstrCount[F.getName().str()] =
|
||||
std::pair<unsigned, unsigned>(FCount, 0);
|
||||
InstrCount += FCount;
|
||||
}
|
||||
return InstrCount;
|
||||
}
|
||||
|
||||
void PMDataManager::emitInstrCountChangedRemark(Pass *P, Module &M,
|
||||
int64_t Delta,
|
||||
unsigned CountBefore,
|
||||
Function *F) {
|
||||
void PMDataManager::emitInstrCountChangedRemark(
|
||||
Pass *P, Module &M, int64_t Delta, unsigned CountBefore,
|
||||
StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount,
|
||||
Function *F) {
|
||||
// If it's a pass manager, don't emit a remark. (This hinges on the assumption
|
||||
// that the only passes that return non-null with getAsPMDataManager are pass
|
||||
// managers.) The reason we have to do this is to avoid emitting remarks for
|
||||
|
@ -155,6 +172,33 @@ void PMDataManager::emitInstrCountChangedRemark(Pass *P, Module &M,
|
|||
// Set to true if this isn't a module pass or CGSCC pass.
|
||||
bool CouldOnlyImpactOneFunction = (F != nullptr);
|
||||
|
||||
// Helper lambda that updates the changes to the size of some function.
|
||||
auto UpdateFunctionChanges =
|
||||
[&FunctionToInstrCount](Function &MaybeChangedFn) {
|
||||
// Update the total module count.
|
||||
unsigned FnSize = MaybeChangedFn.getInstructionCount();
|
||||
auto It = FunctionToInstrCount.find(MaybeChangedFn.getName());
|
||||
|
||||
// If we created a new function, then we need to add it to the map and
|
||||
// say that it changed from 0 instructions to FnSize.
|
||||
if (It == FunctionToInstrCount.end()) {
|
||||
FunctionToInstrCount[MaybeChangedFn.getName()] =
|
||||
std::pair<unsigned, unsigned>(0, FnSize);
|
||||
return;
|
||||
}
|
||||
// Insert the new function size into the second member of the pair. This
|
||||
// tells us whether or not this function changed in size.
|
||||
It->second.second = FnSize;
|
||||
};
|
||||
|
||||
// We need to initially update all of the function sizes.
|
||||
// If no function was passed in, then we're either a module pass or an
|
||||
// CGSCC pass.
|
||||
if (!CouldOnlyImpactOneFunction)
|
||||
std::for_each(M.begin(), M.end(), UpdateFunctionChanges);
|
||||
else
|
||||
UpdateFunctionChanges(*F);
|
||||
|
||||
// Do we have a function we can use to emit a remark?
|
||||
if (!CouldOnlyImpactOneFunction) {
|
||||
// We need a function containing at least one basic block in order to output
|
||||
|
@ -185,6 +229,55 @@ void PMDataManager::emitInstrCountChangedRemark(Pass *P, Module &M,
|
|||
<< "; Delta: "
|
||||
<< DiagnosticInfoOptimizationBase::Argument("DeltaInstrCount", Delta);
|
||||
F->getContext().diagnose(R); // Not using ORE for layering reasons.
|
||||
|
||||
// Emit per-function size change remarks separately.
|
||||
std::string PassName = P->getPassName().str();
|
||||
|
||||
// Helper lambda that emits a remark when the size of a function has changed.
|
||||
auto EmitFunctionSizeChangedRemark = [&FunctionToInstrCount, &F, &BB,
|
||||
&PassName](const std::string &Fname) {
|
||||
unsigned FnCountBefore, FnCountAfter;
|
||||
std::pair<unsigned, unsigned> &Change = FunctionToInstrCount[Fname];
|
||||
std::tie(FnCountBefore, FnCountAfter) = Change;
|
||||
int64_t FnDelta = static_cast<int64_t>(FnCountAfter) -
|
||||
static_cast<int64_t>(FnCountBefore);
|
||||
|
||||
if (FnDelta == 0)
|
||||
return;
|
||||
|
||||
// FIXME: We shouldn't use BB for the location here. Unfortunately, because
|
||||
// the function that we're looking at could have been deleted, we can't use
|
||||
// it for the source location. We *want* remarks when a function is deleted
|
||||
// though, so we're kind of stuck here as is. (This remark, along with the
|
||||
// whole-module size change remarks really ought not to have source
|
||||
// locations at all.)
|
||||
OptimizationRemarkAnalysis FR("size-info", "FunctionIRSizeChange",
|
||||
DiagnosticLocation(), &BB);
|
||||
FR << DiagnosticInfoOptimizationBase::Argument("Pass", PassName)
|
||||
<< ": Function: "
|
||||
<< DiagnosticInfoOptimizationBase::Argument("Function", Fname)
|
||||
<< ": IR instruction count changed from "
|
||||
<< DiagnosticInfoOptimizationBase::Argument("IRInstrsBefore",
|
||||
FnCountBefore)
|
||||
<< " to "
|
||||
<< DiagnosticInfoOptimizationBase::Argument("IRInstrsAfter",
|
||||
FnCountAfter)
|
||||
<< "; Delta: "
|
||||
<< DiagnosticInfoOptimizationBase::Argument("DeltaInstrCount", FnDelta);
|
||||
F->getContext().diagnose(FR);
|
||||
|
||||
// Update the function size.
|
||||
Change.first = FnCountAfter;
|
||||
};
|
||||
|
||||
// Are we looking at more than one function? If so, emit remarks for all of
|
||||
// the functions in the module. Otherwise, only emit one remark.
|
||||
if (!CouldOnlyImpactOneFunction)
|
||||
std::for_each(FunctionToInstrCount.keys().begin(),
|
||||
FunctionToInstrCount.keys().end(),
|
||||
EmitFunctionSizeChangedRemark);
|
||||
else
|
||||
EmitFunctionSizeChangedRemark(F->getName().str());
|
||||
}
|
||||
|
||||
void PassManagerPrettyStackEntry::print(raw_ostream &OS) const {
|
||||
|
@ -1284,9 +1377,10 @@ bool BBPassManager::runOnFunction(Function &F) {
|
|||
Module &M = *F.getParent();
|
||||
|
||||
unsigned InstrCount, BBSize = 0;
|
||||
StringMap<std::pair<unsigned, unsigned>> FunctionToInstrCount;
|
||||
bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
|
||||
if (EmitICRemark)
|
||||
InstrCount = initSizeRemarkInfo(M);
|
||||
InstrCount = initSizeRemarkInfo(M, FunctionToInstrCount);
|
||||
|
||||
for (BasicBlock &BB : F) {
|
||||
// Collect the initial size of the basic block.
|
||||
|
@ -1313,7 +1407,8 @@ bool BBPassManager::runOnFunction(Function &F) {
|
|||
if (NewSize != BBSize) {
|
||||
int64_t Delta =
|
||||
static_cast<int64_t>(NewSize) - static_cast<int64_t>(BBSize);
|
||||
emitInstrCountChangedRemark(BP, M, Delta, InstrCount, &F);
|
||||
emitInstrCountChangedRemark(BP, M, Delta, InstrCount,
|
||||
FunctionToInstrCount, &F);
|
||||
InstrCount = static_cast<int64_t>(InstrCount) + Delta;
|
||||
BBSize = NewSize;
|
||||
}
|
||||
|
@ -1522,10 +1617,11 @@ bool FPPassManager::runOnFunction(Function &F) {
|
|||
populateInheritedAnalysis(TPM->activeStack);
|
||||
|
||||
unsigned InstrCount, FunctionSize = 0;
|
||||
StringMap<std::pair<unsigned, unsigned>> FunctionToInstrCount;
|
||||
bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
|
||||
// Collect the initial size of the module.
|
||||
if (EmitICRemark) {
|
||||
InstrCount = initSizeRemarkInfo(M);
|
||||
InstrCount = initSizeRemarkInfo(M, FunctionToInstrCount);
|
||||
FunctionSize = F.getInstructionCount();
|
||||
}
|
||||
|
||||
|
@ -1550,7 +1646,8 @@ bool FPPassManager::runOnFunction(Function &F) {
|
|||
if (NewSize != FunctionSize) {
|
||||
int64_t Delta = static_cast<int64_t>(NewSize) -
|
||||
static_cast<int64_t>(FunctionSize);
|
||||
emitInstrCountChangedRemark(FP, M, Delta, InstrCount, &F);
|
||||
emitInstrCountChangedRemark(FP, M, Delta, InstrCount,
|
||||
FunctionToInstrCount, &F);
|
||||
InstrCount = static_cast<int64_t>(InstrCount) + Delta;
|
||||
FunctionSize = NewSize;
|
||||
}
|
||||
|
@ -1619,10 +1716,11 @@ MPPassManager::runOnModule(Module &M) {
|
|||
Changed |= getContainedPass(Index)->doInitialization(M);
|
||||
|
||||
unsigned InstrCount, ModuleCount = 0;
|
||||
StringMap<std::pair<unsigned, unsigned>> FunctionToInstrCount;
|
||||
bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
|
||||
// Collect the initial size of the module.
|
||||
if (EmitICRemark) {
|
||||
InstrCount = initSizeRemarkInfo(M);
|
||||
InstrCount = initSizeRemarkInfo(M, FunctionToInstrCount);
|
||||
ModuleCount = InstrCount;
|
||||
}
|
||||
|
||||
|
@ -1646,7 +1744,8 @@ MPPassManager::runOnModule(Module &M) {
|
|||
if (ModuleCount != InstrCount) {
|
||||
int64_t Delta = static_cast<int64_t>(ModuleCount) -
|
||||
static_cast<int64_t>(InstrCount);
|
||||
emitInstrCountChangedRemark(MP, M, Delta, InstrCount);
|
||||
emitInstrCountChangedRemark(MP, M, Delta, InstrCount,
|
||||
FunctionToInstrCount);
|
||||
InstrCount = ModuleCount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
; Ensure that IR count remarks in the legacy pass manager work.
|
||||
; What this test should check for:
|
||||
; * Positive, nonzero sizes before/after
|
||||
; * Positive, nonzero sizes before/after for whole-module remarks
|
||||
; (It's okay to have nonzero sizes in per-function remarks, since a function
|
||||
; can be created/destroyed by a pass.)
|
||||
; * Nonzero deltas
|
||||
; * Sizes are being tracked properly across multiple remarks. E.g, if we have
|
||||
; original_count_1, final_count_1, and
|
||||
|
@ -20,12 +22,16 @@
|
|||
; CGSCC-SAME: IR instruction count changed from
|
||||
; CGSCC-SAME: [[ORIG:[1-9][0-9]*]] to [[FINAL:[1-9][0-9]*]];
|
||||
; CGSCC-SAME: Delta: [[DELTA:-?[1-9][0-9]*]]
|
||||
; CGSCC-NEXT: remark: <unknown>:0:0: Function Integration/Inlining:
|
||||
; CGSCC-SAME: Function: bar: IR instruction count changed from
|
||||
; CGSCC-SAME: [[ORIGFN:[1-9][0-9]*]] to [[FINALFN:[0-9][0-9]*]];
|
||||
; CGSCC-SAME: Delta: [[DELTAFN:-?[1-9][0-9]*]]
|
||||
; CGSCC-NEXT: ---
|
||||
; CGSCC-DAG: !Analysis
|
||||
; CGSCC-NEXT: Pass: size-info
|
||||
; CGSCC-NEXT: Name: IRSizeChange
|
||||
; CGSCC-NEXT: Function:
|
||||
; CGSCC-NEXT: Args:
|
||||
; CGSCC-NEXT: Args:
|
||||
; CGSCC-NEXT: - Pass: Function Integration/Inlining
|
||||
; CGSCC-NEXT: - String: ': IR instruction count changed from '
|
||||
; CGSCC-NEXT: - IRInstrsBefore: '[[ORIG]]'
|
||||
|
@ -33,24 +39,47 @@
|
|||
; CGSCC-NEXT: - IRInstrsAfter: '[[FINAL]]'
|
||||
; CGSCC-NEXT: - String: '; Delta: '
|
||||
; CGSCC-NEXT: - DeltaInstrCount: '[[DELTA]]'
|
||||
; CGSCC-DAG: --- !Analysis
|
||||
; CGSCC-NEXT: Pass: size-info
|
||||
; CGSCC-NEXT: Name: FunctionIRSizeChange
|
||||
; CGSCC-NEXT: Function:
|
||||
; CGSCC-NEXT: Args:
|
||||
; CGSCC-NEXT: - Pass: Function Integration/Inlining
|
||||
; CGSCC-NEXT: - String: ': Function: '
|
||||
; CGSCC-NEXT: - Function: bar
|
||||
; CGSCC-NEXT: - String: ': IR instruction count changed from '
|
||||
; CGSCC-NEXT: - IRInstrsBefore: '[[ORIGFN]]'
|
||||
; CGSCC-NEXT: - String: ' to '
|
||||
; CGSCC-NEXT: - IRInstrsAfter: '[[FINALFN]]'
|
||||
; CGSCC-NEXT: - String: '; Delta: '
|
||||
; CGSCC-NEXT: - DeltaInstrCount: '[[DELTAFN]]'
|
||||
; CGSCC-NEXT: ...
|
||||
|
||||
; RUN: opt < %s -instcombine -pass-remarks-analysis='size-info' \
|
||||
; RUN:-pass-remarks-output=%t.yaml -S -o /dev/null 2> %t; \
|
||||
; RUN: cat %t %t.yaml | FileCheck %s -check-prefix=FUNC
|
||||
; FUNC: remark: <unknown>:0:0: Combine redundant instructions:
|
||||
; FUNC-SAME: IR instruction count changed from
|
||||
; FUNC-SAME: [[SIZE1:[1-9][0-9]*]] to [[SIZE2:[1-9][0-9]*]];
|
||||
; FUNC-SAME: [[SIZE1:[1-9][0-9]*]] to [[SIZE2:[0-9][0-9]*]];
|
||||
; FUNC-SAME: Delta: [[DELTA1:-?[1-9][0-9]*]]
|
||||
; FUNC-NEXT: remark: <unknown>:0:0: Combine redundant instructions: Function:
|
||||
; FUNC-SAME: foo: IR instruction count changed from
|
||||
; FUNC-SAME: [[FOOSIZE1:[1-9][0-9]*]] to [[FOOSIZE2:[0-9][0-9]*]];
|
||||
; FUNC-SAME: Delta: [[DELTAFOO:-?[1-9][0-9]*]]
|
||||
; FUNC-NEXT: remark: <unknown>:0:0: Combine redundant instructions:
|
||||
; FUNC-SAME: IR instruction count changed from
|
||||
; FUNC-SAME: [[SIZE2]] to [[SIZE3:[1-9][0-9]*]];
|
||||
; FUNC-SAME: Delta: [[DELTA2:-?[1-9][0-9]*]]
|
||||
; FUNC-NEXT: remark: <unknown>:0:0: Combine redundant instructions: Function:
|
||||
; FUNC-SAME: bar: IR instruction count changed from
|
||||
; FUNC-SAME: [[BARSIZE1:[1-9][0-9]*]] to [[BARSIZE2:[0-9][0-9]*]];
|
||||
; FUNC-SAME: Delta: [[DELTABAR:-?[1-9][0-9]*]]
|
||||
; FUNC-NEXT: ---
|
||||
; FUNC-DAG: !Analysis
|
||||
; FUNC-NEXT: Pass: size-info
|
||||
; FUNC-NEXT: Name: IRSizeChange
|
||||
; FUNC-NEXT: Function:
|
||||
; FUNC-NEXT: Args:
|
||||
; FUNC-NEXT: Args:
|
||||
; FUNC-NEXT: - Pass: Combine redundant instructions
|
||||
; FUNC-NEXT: - String: ': IR instruction count changed from '
|
||||
; FUNC-NEXT: - IRInstrsBefore: '[[SIZE1]]'
|
||||
|
@ -58,11 +87,25 @@
|
|||
; FUNC-NEXT: - IRInstrsAfter: '[[SIZE2]]'
|
||||
; FUNC-NEXT: - String: '; Delta: '
|
||||
; FUNC-NEXT: - DeltaInstrCount: '[[DELTA1]]'
|
||||
; FUNC-DAG: --- !Analysis
|
||||
; FUNC-NEXT: Pass: size-info
|
||||
; FUNC-NEXT: Name: FunctionIRSizeChange
|
||||
; FUNC-NEXT: Function:
|
||||
; FUNC-NEXT: Args:
|
||||
; FUNC-NEXT: - Pass: Combine redundant instructions
|
||||
; FUNC-NEXT: - String: ': Function: '
|
||||
; FUNC-NEXT: - Function: foo
|
||||
; FUNC-NEXT: - String: ': IR instruction count changed from '
|
||||
; FUNC-NEXT: - IRInstrsBefore: '[[FOOSIZE1]]'
|
||||
; FUNC-NEXT: - String: ' to '
|
||||
; FUNC-NEXT: - IRInstrsAfter: '[[FOOSIZE2]]'
|
||||
; FUNC-NEXT: - String: '; Delta: '
|
||||
; FUNC-NEXT: - DeltaInstrCount: '[[DELTAFOO]]'
|
||||
; FUNC: --- !Analysis
|
||||
; FUNC-NEXT: Pass: size-info
|
||||
; FUNC-NEXT: Name: IRSizeChange
|
||||
; FUNC-NEXT: Function:
|
||||
; FUNC-NEXT: Args:
|
||||
; FUNC-NEXT: Args:
|
||||
; FUNC-NEXT: - Pass: Combine redundant instructions
|
||||
; FUNC-NEXT: - String: ': IR instruction count changed from '
|
||||
; FUNC-NEXT: - IRInstrsBefore: '[[SIZE2]]'
|
||||
|
@ -70,6 +113,20 @@
|
|||
; FUNC-NEXT: - IRInstrsAfter: '[[SIZE3]]'
|
||||
; FUNC-NEXT: - String: '; Delta: '
|
||||
; FUNC-NEXT: - DeltaInstrCount: '[[DELTA2]]'
|
||||
; FUNC-DAG: --- !Analysis
|
||||
; FUNC-NEXT: Pass: size-info
|
||||
; FUNC-NEXT: Name: FunctionIRSizeChange
|
||||
; FUNC-NEXT: Function:
|
||||
; FUNC-NEXT: Args:
|
||||
; FUNC-NEXT: - Pass: Combine redundant instructions
|
||||
; FUNC-NEXT: - String: ': Function: '
|
||||
; FUNC-NEXT: - Function: bar
|
||||
; FUNC-NEXT: - String: ': IR instruction count changed from '
|
||||
; FUNC-NEXT: - IRInstrsBefore: '[[BARSIZE1]]'
|
||||
; FUNC-NEXT: - String: ' to '
|
||||
; FUNC-NEXT: - IRInstrsAfter: '[[BARSIZE2]]'
|
||||
; FUNC-NEXT: - String: '; Delta: '
|
||||
; FUNC-NEXT: - DeltaInstrCount: '[[DELTABAR]]'
|
||||
|
||||
; RUN: opt < %s -globaldce -pass-remarks-analysis='size-info' \
|
||||
; RUN: -pass-remarks-output=%t.yaml -S -o /dev/null 2> %t; \
|
||||
|
@ -79,12 +136,16 @@
|
|||
; MODULE-SAME: IR instruction count changed from
|
||||
; MODULE-SAME: [[ORIG:[1-9][0-9]*]] to [[FINAL:[1-9][0-9]*]];
|
||||
; MODULE-SAME: Delta: [[DELTA:-?[1-9][0-9]*]]
|
||||
; MODULE-NEXT: remark:
|
||||
; MODULE-SAME: Dead Global Elimination: Function: pluto:
|
||||
; MODULE-SAME: IR instruction count changed from [[ORIGFN:[1-9][0-9]*]] to
|
||||
; MODULE-SAME: [[FINALFN:[0-9][0-9]*]]; Delta: [[DELTAFN:-?[1-9][0-9]*]]
|
||||
; MODULE-NEXT: ---
|
||||
; MODULE-DAG: !Analysis
|
||||
; MODULE-NEXT: Pass: size-info
|
||||
; MODULE-NEXT: Name: IRSizeChange
|
||||
; MODULE-NEXT: Function:
|
||||
; MODULE-NEXT: Args:
|
||||
; MODULE-NEXT: Args:
|
||||
; MODULE-NEXT: - Pass: Dead Global Elimination
|
||||
; MODULE-NEXT: - String: ': IR instruction count changed from '
|
||||
; MODULE-NEXT: - IRInstrsBefore: '[[ORIG]]'
|
||||
|
@ -92,6 +153,20 @@
|
|||
; MODULE-NEXT: - IRInstrsAfter: '[[FINAL]]'
|
||||
; MODULE-NEXT: - String: '; Delta: '
|
||||
; MODULE-NEXT: - DeltaInstrCount: '[[DELTA]]'
|
||||
; MODULE-DAG: --- !Analysis
|
||||
; MODULE-NEXT: Pass: size-info
|
||||
; MODULE-NEXT: Name: FunctionIRSizeChange
|
||||
; MODULE-NEXT: Function:
|
||||
; MODULE-NEXT: Args:
|
||||
; MODULE-NEXT: - Pass: Dead Global Elimination
|
||||
; MODULE-NEXT: - String: ': Function: '
|
||||
; MODULE-NEXT: - Function: pluto
|
||||
; MODULE-NEXT: - String: ': IR instruction count changed from '
|
||||
; MODULE-NEXT: - IRInstrsBefore: '[[ORIGFN]]'
|
||||
; MODULE-NEXT: - String: ' to '
|
||||
; MODULE-NEXT: - IRInstrsAfter: '[[FINALFN]]'
|
||||
; MODULE-NEXT: - String: '; Delta: '
|
||||
; MODULE-NEXT: - DeltaInstrCount: '[[DELTAFN]]'
|
||||
|
||||
; RUN: opt < %s -dce -pass-remarks-analysis='size-info' \
|
||||
; RUN: -pass-remarks-output=%t.yaml -S -o /dev/null 2> %t; \
|
||||
|
@ -100,6 +175,9 @@
|
|||
; BB-SAME: IR instruction count changed from
|
||||
; BB-SAME: [[ORIG:[1-9][0-9]*]] to [[FINAL:[1-9][0-9]*]];
|
||||
; BB-SAME: Delta: [[DELTA:-?[1-9][0-9]*]]
|
||||
; BB-NEXT: remark: <unknown>:0:0: Dead Code Elimination: Function: bar:
|
||||
; BB-SAME: IR instruction count changed from [[ORIGFN:[1-9][0-9]*]] to
|
||||
; BB-SAME: [[FINALFN:[0-9][0-9]*]]; Delta: [[DELTAFN:-?[1-9][0-9]*]]
|
||||
; BB-NEXT: ---
|
||||
; BB-DAG: !Analysis
|
||||
; BB-NEXT: Pass: size-info
|
||||
|
@ -113,6 +191,20 @@
|
|||
; BB-NEXT: - IRInstrsAfter: '[[FINAL]]'
|
||||
; BB-NEXT: - String: '; Delta: '
|
||||
; BB-NEXT: - DeltaInstrCount: '[[DELTA]]'
|
||||
; BB-DAG: --- !Analysis
|
||||
; BB-NEXT: Pass: size-info
|
||||
; BB-NEXT: Name: FunctionIRSizeChange
|
||||
; BB-NEXT: Function:
|
||||
; BB-NEXT: Args:
|
||||
; BB-NEXT: - Pass: Dead Code Elimination
|
||||
; BB-NEXT: - String: ': Function: '
|
||||
; BB-NEXT: - Function: bar
|
||||
; BB-NEXT: - String: ': IR instruction count changed from '
|
||||
; BB-NEXT: - IRInstrsBefore: '[[ORIGFN]]'
|
||||
; BB-NEXT: - String: ' to '
|
||||
; BB-NEXT: - IRInstrsAfter: '[[FINALFN]]'
|
||||
; BB-NEXT: - String: '; Delta: '
|
||||
; BB-NEXT: - DeltaInstrCount: '[[DELTAFN]]'
|
||||
|
||||
; RUN: opt < %s -loop-unroll -pass-remarks-analysis='size-info' \
|
||||
; RUN: -pass-remarks-output=%t.yaml -S -o /dev/null 2> %t; \
|
||||
|
@ -121,12 +213,18 @@
|
|||
; LOOP-SAME: IR instruction count changed from
|
||||
; LOOP-SAME: [[ORIG:[1-9][0-9]*]] to [[FINAL:[1-9][0-9]*]];
|
||||
; LOOP-SAME: Delta: [[DELTA:-?[1-9][0-9]*]]
|
||||
; LOOP-NEXT: remark: <unknown>:0:0: Unroll loops: Function: bar:
|
||||
; LOOP-SAME: IR instruction count changed from [[ORIGFN:[1-9][0-9]*]]
|
||||
; LOOP-SAME: to [[FINALFN:[0-9][0-9]*]];
|
||||
; Since bar is the only function containing a loop, its delta must be identical
|
||||
; to the whole module remark's delta.
|
||||
; LOOP-SAME: Delta: [[DELTA]]
|
||||
; LOOP-NEXT: ---
|
||||
; LOOP-DAG: !Analysis
|
||||
; LOOP-NEXT: Pass: size-info
|
||||
; LOOP-NEXT: Name: IRSizeChange
|
||||
; LOOP-NEXT: Function:
|
||||
; LOOP-NEXT: Args:
|
||||
; LOOP-NEXT: Args:
|
||||
; LOOP-DAG: - Pass: Unroll loops
|
||||
; LOOP-NEXT: - String: ': IR instruction count changed from '
|
||||
; LOOP-NEXT: - IRInstrsBefore: '[[ORIG]]'
|
||||
|
@ -134,6 +232,20 @@
|
|||
; LOOP-NEXT: - IRInstrsAfter: '[[FINAL]]'
|
||||
; LOOP-NEXT: - String: '; Delta: '
|
||||
; LOOP-NEXT: - DeltaInstrCount: '[[DELTA]]'
|
||||
; LOOP-DAG: --- !Analysis
|
||||
; LOOP-NEXT: Pass: size-info
|
||||
; LOOP-NEXT: Name: FunctionIRSizeChange
|
||||
; LOOP-NEXT: Function:
|
||||
; LOOP-NEXT: Args:
|
||||
; LOOP-NEXT: - Pass: Unroll loops
|
||||
; LOOP-NEXT: - String: ': Function: '
|
||||
; LOOP-NEXT: - Function: bar
|
||||
; LOOP-NEXT: - String: ': IR instruction count changed from '
|
||||
; LOOP-NEXT: - IRInstrsBefore: '[[ORIGFN]]'
|
||||
; LOOP-NEXT: - String: ' to '
|
||||
; LOOP-NEXT: - IRInstrsAfter: '[[FINALFN]]'
|
||||
; LOOP-NEXT: - String: '; Delta: '
|
||||
; LOOP-NEXT: - DeltaInstrCount: '[[DELTA]]'
|
||||
declare i1 ()* @boop()
|
||||
|
||||
define internal i1 @pluto() {
|
||||
|
|
Loading…
Reference in New Issue