Fix bug: CodeExtractor/2004-03-17-MissedLiveIns.ll
With this fix we now successfully extract all 149 loops from 256.bzip2 without
crashing or miscompiling the program!
llvm-svn: 12493
diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
index 9a47130..f2af475c 100644
--- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
@@ -75,6 +75,11 @@
if (!BlocksToExtract.count(PN->getIncomingBlock(i)) &&
(isa<Instruction>(V) || isa<Argument>(V)))
inputs.push_back(V);
+ else if (Instruction *opI = dyn_cast<Instruction>(V)) {
+ if (!BlocksToExtract.count(opI->getParent()))
+ inputs.push_back(opI);
+ } else if (isa<Argument>(V))
+ inputs.push_back(V);
}
} else {
// All other instructions go through the generic input finder