Fix bug: CodeExtractor/2004-03-17-MissedLiveIns.ll
authorChris Lattner <sabre@nondot.org>
Thu, 18 Mar 2004 05:56:32 +0000 (05:56 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 18 Mar 2004 05:56:32 +0000 (05:56 +0000)
With this fix we now successfully extract all 149 loops from 256.bzip2 without
crashing or miscompiling the program!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12493 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/CodeExtractor.cpp

index 9a47130c7b3a8302e2fad423423c2cd698947681..f2af475c0424b4c871f4dcef2d7456cc0baf321a 100644 (file)
@@ -75,6 +75,11 @@ void CodeExtractor::findInputsOutputs(Values &inputs, Values &outputs,
           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