diff options
author | Chris Lattner <sabre@nondot.org> | 2006-05-26 18:42:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-05-26 18:42:34 +0000 |
commit | 44a793c3a69d78a89bad1dbadbf29caf2d4524e4 (patch) | |
tree | d561eb1e4acd0a99a5dca16b2d1bb6995a88c64b /llvm/lib/Bytecode/Reader/Reader.cpp | |
parent | 49e7f56e7f73c9ac843deedbcf1d3167d2c092ca (diff) | |
download | bcm5719-llvm-44a793c3a69d78a89bad1dbadbf29caf2d4524e4.tar.gz bcm5719-llvm-44a793c3a69d78a89bad1dbadbf29caf2d4524e4.zip |
Fix a bug in the bc reader/writer: we were not correctly encoding varargs
nonccc calls (we were dropping the CC and tail flag). This broke several
FORTRAN programs.
Testcase here: Regression/Assembler/2006-05-26-VarargsCallEncode.ll
llvm-svn: 28501
Diffstat (limited to 'llvm/lib/Bytecode/Reader/Reader.cpp')
-rw-r--r-- | llvm/lib/Bytecode/Reader/Reader.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp index 36b2ecb37fd..d441e7504b7 100644 --- a/llvm/lib/Bytecode/Reader/Reader.cpp +++ b/llvm/lib/Bytecode/Reader/Reader.cpp @@ -830,7 +830,15 @@ void BytecodeReader::ParseInstruction(std::vector<unsigned> &Oprnds, if (Opcode == 61 || Opcode == 59) isTailCall = true; - + + if (Opcode == 58) { + isTailCall = Oprnds.back() & 1; + CallingConv = Oprnds.back() >> 1; + Oprnds.pop_back(); + } else if (Opcode == 59 || Opcode == 60) { + CallingConv = CallingConv::Fast; + } + // Check to make sure we have a pointer to function type const PointerType *PTy = dyn_cast<PointerType>(F->getType()); if (PTy == 0) error("Call to non function pointer value!"); @@ -841,13 +849,6 @@ void BytecodeReader::ParseInstruction(std::vector<unsigned> &Oprnds, if (!FTy->isVarArg()) { FunctionType::param_iterator It = FTy->param_begin(); - if (Opcode == 58) { - isTailCall = Oprnds.back() & 1; - CallingConv = Oprnds.back() >> 1; - Oprnds.pop_back(); - } else if (Opcode == 59 || Opcode == 60) - CallingConv = CallingConv::Fast; - for (unsigned i = 1, e = Oprnds.size(); i != e; ++i) { if (It == FTy->param_end()) error("Invalid call instruction!"); |