[llvm-commits] CVS: llvm/lib/Transforms/Utils/CodeExtractor.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Mar 13 21:18:01 PST 2004


Changes in directory llvm/lib/Transforms/Utils:

CodeExtractor.cpp updated: 1.3 -> 1.4

---
Log message:

Verify functions as they are produced if -debug is specified.  Reduce
curly braceage


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

Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp
diff -u llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.3 llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.4
--- llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.3	Mon Mar  1 18:20:57 2004
+++ llvm/lib/Transforms/Utils/CodeExtractor.cpp	Sat Mar 13 21:17:22 2004
@@ -20,6 +20,7 @@
 #include "llvm/Module.h"
 #include "llvm/Pass.h"
 #include "llvm/Analysis/LoopInfo.h"
+#include "llvm/Analysis/Verifier.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 #include "llvm/Transforms/Utils/FunctionUtils.h"
 #include "Support/Debug.h"
@@ -324,13 +325,10 @@
   for (unsigned i = 0, e = inputs.size(); i != e; ++i) {
     std::vector<User*> Users(inputs[i]->use_begin(), inputs[i]->use_end());
     for (std::vector<User*>::iterator use = Users.begin(), useE = Users.end();
-         use != useE; ++use) {
-      if (Instruction* inst = dyn_cast<Instruction>(*use)) {
-        if (contains(code, inst->getParent())) {
+         use != useE; ++use)
+      if (Instruction* inst = dyn_cast<Instruction>(*use))
+        if (contains(code, inst->getParent()))
           inst->replaceUsesOfWith(inputs[i], getFunctionArg(newFunction, i));
-        }
-      }
-    }
   }
 
   // Rewrite branches to basic blocks outside of the loop to new dummy blocks
@@ -563,6 +561,7 @@
 
   moveCodeToFunction(code, newFunction);
 
+  DEBUG(if (verifyFunction(*newFunction)) abort());
   return newFunction;
 }
 





More information about the llvm-commits mailing list