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

Chris Lattner lattner at cs.uiuc.edu
Tue Jun 17 08:32:01 PDT 2003


Changes in directory llvm/lib/Bytecode/Reader:

ReadInst.cpp updated: 1.42 -> 1.43

---
Log message:

Fix bug: Assembler/2003-06-17-InvokeDisassemble.llx

"yes, invoke instructions can have just three arguments"


---
Diffs of the changes:

Index: llvm/lib/Bytecode/Reader/ReadInst.cpp
diff -u llvm/lib/Bytecode/Reader/ReadInst.cpp:1.42 llvm/lib/Bytecode/Reader/ReadInst.cpp:1.43
--- llvm/lib/Bytecode/Reader/ReadInst.cpp:1.42	Thu May 22 13:08:30 2003
+++ llvm/lib/Bytecode/Reader/ReadInst.cpp	Tue Jun 17 08:31:10 2003
@@ -302,16 +302,19 @@
       if (Raw.NumOperands < 3) return true;
 
       Normal = cast<BasicBlock>(getValue(Type::LabelTy, Raw.Arg2));
-      Except = cast<BasicBlock>(getValue(Type::LabelTy, args[0]));
+      if (Raw.NumOperands ==  3)
+        Except = cast<BasicBlock>(getValue(Type::LabelTy, Raw.Arg3));
+      else {
+        Except = cast<BasicBlock>(getValue(Type::LabelTy, args[0]));
 
-      FunctionType::ParamTypes::const_iterator It = PL.begin();
-      for (unsigned i = 1; i < args.size(); i++) {
-	if (It == PL.end()) return true;
-	// TODO: Check getValue for null!
-	Params.push_back(getValue(*It++, args[i]));
+        FunctionType::ParamTypes::const_iterator It = PL.begin();
+        for (unsigned i = 1; i < args.size(); i++) {
+          if (It == PL.end()) return true;
+          // TODO: Check getValue for null!
+          Params.push_back(getValue(*It++, args[i]));
+        }
+        if (It != PL.end()) return true;
       }
-
-      if (It != PL.end()) return true;
     } else {
       if (args.size() < 4) return true;
 
@@ -326,7 +329,8 @@
       }
     }
 
-    delete Raw.VarArgs;
+    if (Raw.NumOperands > 3)
+      delete Raw.VarArgs;
     Res = new InvokeInst(M, Normal, Except, Params);
     return false;
   }





More information about the llvm-commits mailing list