From: Andrew Lenharth Date: Mon, 3 Nov 2008 16:05:35 +0000 (+0000) Subject: Ensure that we are checking only calls to the function we are interested in specializing X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=97bd9a914bbf754e3a1624b1def7b9224041cbbf;p=oota-llvm.git Ensure that we are checking only calls to the function we are interested in specializing git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58615 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/IPO/PartialSpecialization.cpp b/lib/Transforms/IPO/PartialSpecialization.cpp index 006da596106..486294dd4c8 100644 --- a/lib/Transforms/IPO/PartialSpecialization.cpp +++ b/lib/Transforms/IPO/PartialSpecialization.cpp @@ -165,14 +165,16 @@ void PartSpec::scanForInterest(Function& F, SmallVector& args) { } } +/// scanDistribution - Construct a histogram of constants for arg of F at arg int PartSpec::scanDistribution(Function& F, int arg, std::map& dist) { bool hasIndirect = false; int total = 0; for(Value::use_iterator ii = F.use_begin(), ee = F.use_end(); ii != ee; ++ii) - if (CallInst* CI = dyn_cast(ii)) { - ++dist[dyn_cast(CI->getOperand(arg + 1))]; + if ((isa(ii) || isa(ii)) + && ii->getOperand(0) == &F) { + ++dist[dyn_cast(ii->getOperand(arg + 1))]; ++total; } else hasIndirect = true;