Only cound if we actually made a change.
authorChris Lattner <sabre@nondot.org>
Sat, 11 Dec 2004 17:00:14 +0000 (17:00 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 11 Dec 2004 17:00:14 +0000 (17:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18800 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/IPConstantPropagation.cpp

index 99ad8445b15bf246068b82ee0ad0cf2180f8d06e..65d507798b77d6614270cdcc99e9da8712605384 100644 (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;