summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/CodeExtractor.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-03-14 03:17:22 +0000
committerChris Lattner <sabre@nondot.org>2004-03-14 03:17:22 +0000
commitffada9327301094411146627cf6bc16cd517585d (patch)
tree5e81b72916ab4f184e804f04f18797e031490103 /lib/Transforms/Utils/CodeExtractor.cpp
parent2eff85941f1262ed607b19a95475bdabe5ecf4f1 (diff)
downloadllvm-ffada9327301094411146627cf6bc16cd517585d.tar.gz
llvm-ffada9327301094411146627cf6bc16cd517585d.tar.bz2
llvm-ffada9327301094411146627cf6bc16cd517585d.tar.xz
Verify functions as they are produced if -debug is specified. Reduce
curly braceage git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12378 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/CodeExtractor.cpp')
-rw-r--r--lib/Transforms/Utils/CodeExtractor.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp
index 7de3006680..cbe9858aa4 100644
--- a/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/lib/Transforms/Utils/CodeExtractor.cpp
@@ -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 @@ Function *CodeExtractor::constructFunction(const Values &inputs,
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 @@ Function *CodeExtractor::ExtractCodeRegion(const std::vector<BasicBlock*> &code)
moveCodeToFunction(code, newFunction);
+ DEBUG(if (verifyFunction(*newFunction)) abort());
return newFunction;
}