From: Chris Lattner Date: Tue, 17 Jun 2003 15:07:20 +0000 (+0000) Subject: Avoid divide by zero errors X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=efa095e41830bdbbc4eb0c4ff423fe483f2de0e2;p=oota-llvm.git Avoid divide by zero errors git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6738 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/AliasAnalysisCounter.cpp b/lib/Analysis/AliasAnalysisCounter.cpp index d0471d76389..285a6d3f46c 100644 --- a/lib/Analysis/AliasAnalysisCounter.cpp +++ b/lib/Analysis/AliasAnalysisCounter.cpp @@ -32,23 +32,27 @@ namespace { << "\n===== Alias Analysis Counter Report =====\n" << " Analysis counted: " << Name << "\n" << " " << AASum << " Total Alias Queries Performed\n"; - printLine("no alias", No, AASum); - printLine("may alias", May, AASum); - printLine("must alias", Must, AASum); - std::cerr - << " Alias Analysis Counter Summary: " << No*100/AASum << "%/" - << May*100/AASum << "%/" << Must*100/AASum<<"%\n\n"; + if (AASum) { + printLine("no alias", No, AASum); + printLine("may alias", May, AASum); + printLine("must alias", Must, AASum); + std::cerr + << " Alias Analysis Counter Summary: " << No*100/AASum << "%/" + << May*100/AASum << "%/" << Must*100/AASum<<"%\n\n"; + } std::cerr << " " << MRSum << " Total Mod/Ref Queries Performed\n"; - printLine("no mod/ref", NoMR, MRSum); - printLine("ref", JustRef, MRSum); - printLine("mod", JustMod, MRSum); - printLine("mod/ref", MR, MRSum); - std::cerr - << " Mod/Ref Analysis Counter Summary: " << NoMR*100/MRSum<< "%/" - << JustRef*100/MRSum << "%/" << JustMod*100/MRSum << "%/" - << MR*100/MRSum <<"%\n\n"; + if (MRSum) { + printLine("no mod/ref", NoMR, MRSum); + printLine("ref", JustRef, MRSum); + printLine("mod", JustMod, MRSum); + printLine("mod/ref", MR, MRSum); + std::cerr + << " Mod/Ref Analysis Counter Summary: " << NoMR*100/MRSum<< "%/" + << JustRef*100/MRSum << "%/" << JustMod*100/MRSum << "%/" + << MR*100/MRSum <<"%\n\n"; + } } }