From ffada9327301094411146627cf6bc16cd517585d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 14 Mar 2004 03:17:22 +0000 Subject: [PATCH] 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 --- lib/Transforms/Utils/CodeExtractor.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp index 7de30066806..cbe9858aa44 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 Users(inputs[i]->use_begin(), inputs[i]->use_end()); for (std::vector::iterator use = Users.begin(), useE = Users.end(); - use != useE; ++use) { - if (Instruction* inst = dyn_cast(*use)) { - if (contains(code, inst->getParent())) { + use != useE; ++use) + if (Instruction* inst = dyn_cast(*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 &code) moveCodeToFunction(code, newFunction); + DEBUG(if (verifyFunction(*newFunction)) abort()); return newFunction; } -- 2.34.1