From a65371ea25cadd0f5669747394cce297fb3e47b7 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 26 May 2006 18:42:34 +0000 Subject: 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28501 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bytecode/Reader/Reader.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib/Bytecode/Reader') diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 36b2ecb37f..d441e7504b 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -830,7 +830,15 @@ void BytecodeReader::ParseInstruction(std::vector &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(F->getType()); if (PTy == 0) error("Call to non function pointer value!"); @@ -841,13 +849,6 @@ void BytecodeReader::ParseInstruction(std::vector &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!"); -- cgit v1.2.3-70-g09d2