diff options
author | Gabor Greif <ggreif@gmail.com> | 2010-04-15 20:51:13 +0000 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2010-04-15 20:51:13 +0000 |
commit | 2ff961f66816daab8bbc58a19025161d969821c2 (patch) | |
tree | 4eeab3b6a41dbd4d7d2b9282fe94cafa495e3ff0 /lib/Transforms/IPO/LowerSetJmp.cpp | |
parent | 83821c8941b7e9e70de9d5e76556b07872ac371b (diff) | |
download | external_llvm-2ff961f66816daab8bbc58a19025161d969821c2.zip external_llvm-2ff961f66816daab8bbc58a19025161d969821c2.tar.gz external_llvm-2ff961f66816daab8bbc58a19025161d969821c2.tar.bz2 |
reapply r101364, which has been backed out in r101368
with a fix
rotate CallInst operands, i.e. move callee to the back
of the operand array
the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101397 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/LowerSetJmp.cpp')
-rw-r--r-- | lib/Transforms/IPO/LowerSetJmp.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp index 4d61e83..d1eaadd 100644 --- a/lib/Transforms/IPO/LowerSetJmp.cpp +++ b/lib/Transforms/IPO/LowerSetJmp.cpp @@ -262,8 +262,8 @@ void LowerSetJmp::TransformLongJmpCall(CallInst* Inst) // char*. It returns "void", so it doesn't need to replace any of // Inst's uses and doesn't get a name. CastInst* CI = - new BitCastInst(Inst->getOperand(1), SBPTy, "LJBuf", Inst); - Value *Args[] = { CI, Inst->getOperand(2) }; + new BitCastInst(Inst->getOperand(0), SBPTy, "LJBuf", Inst); + Value *Args[] = { CI, Inst->getOperand(1) }; CallInst::Create(ThrowLongJmp, Args, Args + 2, "", Inst); SwitchValuePair& SVP = SwitchValMap[Inst->getParent()->getParent()]; @@ -378,7 +378,7 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst) const Type* SBPTy = Type::getInt8PtrTy(Inst->getContext()); CastInst* BufPtr = - new BitCastInst(Inst->getOperand(1), SBPTy, "SBJmpBuf", Inst); + new BitCastInst(Inst->getOperand(0), SBPTy, "SBJmpBuf", Inst); Value *Args[] = { GetSetJmpMap(Func), BufPtr, ConstantInt::get(Type::getInt32Ty(Inst->getContext()), SetJmpIDMap[Func]++) @@ -473,7 +473,7 @@ void LowerSetJmp::visitCallInst(CallInst& CI) // Construct the new "invoke" instruction. TerminatorInst* Term = OldBB->getTerminator(); - std::vector<Value*> Params(CI.op_begin() + 1, CI.op_end()); + std::vector<Value*> Params(CI.op_begin(), CI.op_end() - 1); InvokeInst* II = InvokeInst::Create(CI.getCalledValue(), NewBB, PrelimBBMap[Func], Params.begin(), Params.end(), CI.getName(), Term); |