Only cound if we actually made a change.

llvm-svn: 18800
This commit is contained in:
Chris Lattner 2004-12-11 17:00:14 +00:00
parent ffefea0772
commit 263b0a1669
1 changed files with 6 additions and 3 deletions

View File

@ -180,9 +180,12 @@ bool IPCP::PropagateConstantReturn(Function &F) {
if (ReplacedAllUsers && F.hasInternalLinkage() && !isa<UndefValue>(RetVal)) {
Value *RV = UndefValue::get(RetVal->getType());
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
if (ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator()))
RI->setOperand(0, RV);
MadeChange = true;
if (ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator())) {
if (RI->getOperand(0) != RV) {
RI->setOperand(0, RV);
MadeChange = true;
}
}
}
if (MadeChange) ++NumReturnValProped;