summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-05-31 19:11:15 +0000
committerDan Gohman <gohman@apple.com>2008-05-31 19:11:15 +0000
commitca0256abb26dd11507a7f484632284a811681ba6 (patch)
treefe797faf7c31971484b38e8e5a1716abf418f4df /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parent4b1c1a46a690d9a1933a7c81b30f0cc8188d7402 (diff)
downloadbcm5719-llvm-ca0256abb26dd11507a7f484632284a811681ba6.tar.gz
bcm5719-llvm-ca0256abb26dd11507a7f484632284a811681ba6.zip
Improved bitcode support for insertvalue/extractvalue.
llvm-svn: 51822
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 376cc056392..df644d00b92 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -738,16 +738,23 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i)
PushValueAndType(I.getOperand(i), InstID, Vals, VE);
break;
- case Instruction::ExtractValue:
+ case Instruction::ExtractValue: {
Code = bitc::FUNC_CODE_INST_EXTRACTVAL;
- for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i)
- PushValueAndType(I.getOperand(i), InstID, Vals, VE);
+ PushValueAndType(I.getOperand(0), InstID, Vals, VE);
+ const ExtractValueInst *EVI = cast<ExtractValueInst>(&I);
+ for (const unsigned *i = EVI->idx_begin(), *e = EVI->idx_end(); i != e; ++i)
+ Vals.push_back(*i);
break;
- case Instruction::InsertValue:
+ }
+ case Instruction::InsertValue: {
Code = bitc::FUNC_CODE_INST_INSERTVAL;
- for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i)
- PushValueAndType(I.getOperand(i), InstID, Vals, VE);
+ PushValueAndType(I.getOperand(0), InstID, Vals, VE);
+ PushValueAndType(I.getOperand(1), InstID, Vals, VE);
+ const InsertValueInst *IVI = cast<InsertValueInst>(&I);
+ for (const unsigned *i = IVI->idx_begin(), *e = IVI->idx_end(); i != e; ++i)
+ Vals.push_back(*i);
break;
+ }
case Instruction::Select:
Code = bitc::FUNC_CODE_INST_SELECT;
PushValueAndType(I.getOperand(1), InstID, Vals, VE);
OpenPOWER on IntegriCloud