From 2afd0723a245ffaa4053c37fe989cee2b6b45edb Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Mon, 2 Nov 2009 02:55:39 +0000 Subject: [PATCH] Apply fix for PR5135, Credit to Andreas Neustifter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85779 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ProfileInfoLoaderPass.cpp | 8 ++++---- lib/Analysis/ProfileVerifierPass.cpp | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/Analysis/ProfileInfoLoaderPass.cpp b/lib/Analysis/ProfileInfoLoaderPass.cpp index 7fd714d8b175..9e1dfb6ff711 100644 --- a/lib/Analysis/ProfileInfoLoaderPass.cpp +++ b/lib/Analysis/ProfileInfoLoaderPass.cpp @@ -60,7 +60,7 @@ namespace { // recurseBasicBlock() - Calculates the edge weights for as much basic // blocks as possbile. virtual void recurseBasicBlock(const BasicBlock *BB); - virtual void readEdgeOrRemember(Edge, Edge&, unsigned &, unsigned &); + virtual void readEdgeOrRemember(Edge, Edge&, unsigned &, double &); virtual void readEdge(ProfileInfo::Edge, std::vector&); /// run - Load the profile information from the specified file. @@ -84,7 +84,7 @@ Pass *llvm::createProfileLoaderPass(const std::string &Filename) { } void LoaderPass::readEdgeOrRemember(Edge edge, Edge &tocalc, - unsigned &uncalc, unsigned &count) { + unsigned &uncalc, double &count) { double w; if ((w = getEdgeWeight(edge)) == MissingValue) { tocalc = edge; @@ -117,7 +117,7 @@ void LoaderPass::recurseBasicBlock(const BasicBlock *BB) { // collect weights of all incoming and outgoing edges, rememer edges that // have no value - unsigned incount = 0; + double incount = 0; SmallSet pred_visited; pred_const_iterator bbi = pred_begin(BB), bbe = pred_end(BB); if (bbi==bbe) { @@ -129,7 +129,7 @@ void LoaderPass::recurseBasicBlock(const BasicBlock *BB) { } } - unsigned outcount = 0; + double outcount = 0; SmallSet succ_visited; succ_const_iterator sbbi = succ_begin(BB), sbbe = succ_end(BB); if (sbbi==sbbe) { diff --git a/lib/Analysis/ProfileVerifierPass.cpp b/lib/Analysis/ProfileVerifierPass.cpp index 60b1d143f5cf..5f362944dc3c 100644 --- a/lib/Analysis/ProfileVerifierPass.cpp +++ b/lib/Analysis/ProfileVerifierPass.cpp @@ -229,7 +229,8 @@ void ProfileVerifierPass::recurseBasicBlock(const BasicBlock *BB) { // to debug printers. DetailedBlockInfo DI; DI.BB = BB; - DI.outCount = DI.inCount = DI.inWeight = DI.outWeight = 0; + DI.outCount = DI.inCount = 0; + DI.inWeight = DI.outWeight = 0.0; // Read predecessors. std::set ProcessedPreds;