[llvm-commits] CVS: llvm/lib/Transforms/Utils/CodeExtractor.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Mar 17 22:13:01 PST 2004
Changes in directory llvm/lib/Transforms/Utils:
CodeExtractor.cpp updated: 1.12 -> 1.13
---
Log message:
Fix CodeExtractor/2004-03-17-OutputMismatch.ll
---
Diffs of the changes: (+7 -3)
Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp
diff -u llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.12 llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.13
--- llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.12 Wed Mar 17 21:49:40 2004
+++ llvm/lib/Transforms/Utils/CodeExtractor.cpp Wed Mar 17 22:12:05 2004
@@ -347,6 +347,10 @@
// just plain inputs for non-scalars
std::vector<Value*> params(inputs);
+ // Get an iterator to the first output argument.
+ Function::aiterator OutputArgBegin = newFunction->abegin();
+ std::advance(OutputArgBegin, inputs.size());
+
for (unsigned i = 0, e = outputs.size(); i != e; ++i) {
Value *Output = outputs[i];
// Create allocas for scalar outputs
@@ -401,12 +405,12 @@
// Restore values just before we exit
// FIXME: Use a GetElementPtr to bunch the outputs in a struct
- for (unsigned out = 0, e = outputs.size(); out != e; ++out)
+ Function::aiterator OAI = OutputArgBegin;
+ for (unsigned out = 0, e = outputs.size(); out != e; ++out, ++OAI)
if (!DS ||
DS->dominates(cast<Instruction>(outputs[out])->getParent(),
TI->getParent()))
- new StoreInst(outputs[out], getFunctionArg(newFunction, out),
- NTRet);
+ new StoreInst(outputs[out], OAI, NTRet);
}
// rewrite the original branch instruction with this new target
More information about the llvm-commits
mailing list