summaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-03-26 23:56:33 +0000
committerChris Lattner <sabre@nondot.org>2005-03-26 23:56:33 +0000
commite70492d0e298487f9cb8dd37cfcf9c4a060cc21c (patch)
tree77f6e793c17998473e48260db656eea318f1bb0f /lib/Analysis
parent1b9a2aac986344caec0f43378dadfdd04c593d46 (diff)
Factor out percentage printing into its own function. Make two changes to
the function: print more precision XX.X% instead of XX%, and cast to ULL before scaling by 100/1000 to avoid wrap around for large numbers of queries (such as occur for 253.perlbmk and 176.gcc) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20872 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/AliasAnalysisEvaluator.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp
index da8e4e8e627..593dbedea80 100644
--- a/lib/Analysis/AliasAnalysisEvaluator.cpp
+++ b/lib/Analysis/AliasAnalysisEvaluator.cpp
@@ -188,6 +188,11 @@ bool AAEval::runOnFunction(Function &F) {
return false;
}
+static void PrintPercent(unsigned Num, unsigned Sum) {
+ std::cerr << "(" << Num*100ULL/Sum << "."
+ << ((Num*1000ULL/Sum) % 10) << "%)\n";
+}
+
bool AAEval::doFinalization(Module &M) {
unsigned AliasSum = NoAlias + MayAlias + MustAlias;
std::cerr << "===== Alias Analysis Evaluator Report =====\n";
@@ -195,12 +200,12 @@ bool AAEval::doFinalization(Module &M) {
std::cerr << " Alias Analysis Evaluator Summary: No pointers!\n";
} else {
std::cerr << " " << AliasSum << " Total Alias Queries Performed\n";
- std::cerr << " " << NoAlias << " no alias responses ("
- << NoAlias*100/AliasSum << "%)\n";
- std::cerr << " " << MayAlias << " may alias responses ("
- << MayAlias*100/AliasSum << "%)\n";
- std::cerr << " " << MustAlias << " must alias responses ("
- << MustAlias*100/AliasSum <<"%)\n";
+ std::cerr << " " << NoAlias << " no alias responses ";
+ PrintPercent(NoAlias, AliasSum);
+ std::cerr << " " << MayAlias << " may alias responses ";
+ PrintPercent(MayAlias, AliasSum);
+ std::cerr << " " << MustAlias << " must alias responses ";
+ PrintPercent(MustAlias, AliasSum);
std::cerr << " Alias Analysis Evaluator Pointer Alias Summary: "
<< NoAlias*100/AliasSum << "%/" << MayAlias*100/AliasSum << "%/"
<< MustAlias*100/AliasSum << "%\n";
@@ -212,14 +217,14 @@ bool AAEval::doFinalization(Module &M) {
std::cerr << " Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!\n";
} else {
std::cerr << " " << ModRefSum << " Total ModRef Queries Performed\n";
- std::cerr << " " << NoModRef << " no mod/ref responses ("
- << NoModRef*100/ModRefSum << "%)\n";
- std::cerr << " " << Mod << " mod responses ("
- << Mod*100/ModRefSum << "%)\n";
- std::cerr << " " << Ref << " ref responses ("
- << Ref*100/ModRefSum <<"%)\n";
- std::cerr << " " << ModRef << " mod & ref responses ("
- << ModRef*100/ModRefSum <<"%)\n";
+ std::cerr << " " << NoModRef << " no mod/ref responses ";
+ PrintPercent(NoModRef, ModRefSum);
+ std::cerr << " " << Mod << " mod responses ";
+ PrintPercent(Mod, ModRefSum);
+ std::cerr << " " << Ref << " ref responses ";
+ PrintPercent(Ref, ModRefSum);
+ std::cerr << " " << ModRef << " mod & ref responses ";
+ PrintPercent(ModRef, ModRefSum);
std::cerr << " Alias Analysis Evaluator Mod/Ref Summary: "
<< NoModRef*100/ModRefSum << "%/" << Mod*100/ModRefSum << "%/"
<< Ref*100/ModRefSum << "%/" << ModRef*100/ModRefSum << "%\n";