Create the cast constant expression that was read instead of attempting
authorReid Spencer <rspencer@reidspencer.com>
Mon, 11 Dec 2006 23:20:20 +0000 (23:20 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Mon, 11 Dec 2006 23:20:20 +0000 (23:20 +0000)
to infer the cast from its operand and type. This fixes:
test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32450 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bytecode/Reader/Reader.cpp

index 2ac92bc94685bbcdde52c4d4c176a2f7031fddf8..e2ab8c10e671e8ddfc8b71b19d17be1c2491f829 100644 (file)
@@ -1325,7 +1325,8 @@ Value *BytecodeReader::ParseConstantPoolValue(unsigned TypeID) {
       if (!Instruction::isCast(Opcode))
         error("Only cast instruction has one argument for ConstantExpr");
 
-      Constant *Result = ConstantExpr::getCast(ArgVec[0], getType(TypeID));
+      Constant *Result = ConstantExpr::getCast(Opcode, ArgVec[0], 
+                                               getType(TypeID));
       if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result);
       return Result;
     } else if (Opcode == Instruction::GetElementPtr) { // GetElementPtr