[llvm-commits] CVS: llvm/lib/Transforms/IPO/IPConstantPropagation.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Dec 11 09:00:27 PST 2004



Changes in directory llvm/lib/Transforms/IPO:

IPConstantPropagation.cpp updated: 1.15 -> 1.16
---
Log message:

Only cound if we actually made a change.


---
Diffs of the changes:  (+6 -3)

Index: llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
diff -u llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.15 llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.16
--- llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.15	Sun Nov 14 00:57:47 2004
+++ llvm/lib/Transforms/IPO/IPConstantPropagation.cpp	Sat Dec 11 11:00:14 2004
@@ -180,9 +180,12 @@
   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;






More information about the llvm-commits mailing list