[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri May 26 11:42:47 PDT 2006



Changes in directory llvm/lib/Bytecode/Reader:

Reader.cpp updated: 1.193 -> 1.194
---
Log message:

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


---
Diffs of the changes:  (+9 -8)

 Reader.cpp |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)


Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.193 llvm/lib/Bytecode/Reader/Reader.cpp:1.194
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.193	Fri Apr  7 23:09:19 2006
+++ llvm/lib/Bytecode/Reader/Reader.cpp	Fri May 26 13:42:34 2006
@@ -830,7 +830,15 @@
 
     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 @@
     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!");






More information about the llvm-commits mailing list