From: Chris Lattner Date: Sat, 11 Dec 2004 17:00:14 +0000 (+0000) Subject: Only cound if we actually made a change. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2ffa47b6bf5e98f887a45fd3a51452d4f3b67c2d;p=oota-llvm.git Only cound if we actually made a change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18800 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp index 99ad8445b15..65d507798b7 100644 --- a/lib/Transforms/IPO/IPConstantPropagation.cpp +++ b/lib/Transforms/IPO/IPConstantPropagation.cpp @@ -180,9 +180,12 @@ bool IPCP::PropagateConstantReturn(Function &F) { if (ReplacedAllUsers && F.hasInternalLinkage() && !isa(RetVal)) { Value *RV = UndefValue::get(RetVal->getType()); for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) - if (ReturnInst *RI = dyn_cast(BB->getTerminator())) - RI->setOperand(0, RV); - MadeChange = true; + if (ReturnInst *RI = dyn_cast(BB->getTerminator())) { + if (RI->getOperand(0) != RV) { + RI->setOperand(0, RV); + MadeChange = true; + } + } } if (MadeChange) ++NumReturnValProped;