diff options
| author | Nate Begeman <natebegeman@mac.com> | 2009-02-12 21:28:33 +0000 |
|---|---|---|
| committer | Nate Begeman <natebegeman@mac.com> | 2009-02-12 21:28:33 +0000 |
| commit | 94aa38d5684d8b21d8b2337f75cdd7637771138c (patch) | |
| tree | 0e3883681553be1ba9a6c086a321eaa18febd56d /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
| parent | 655775293f318b43fb80427274675250b4b7b7a7 (diff) | |
| download | llvm-94aa38d5684d8b21d8b2337f75cdd7637771138c.zip llvm-94aa38d5684d8b21d8b2337f75cdd7637771138c.tar.gz llvm-94aa38d5684d8b21d8b2337f75cdd7637771138c.tar.bz2 | |
Add suppport for ConstantExprs of shufflevectors whose result type is not equal to the
type of the vectors being shuffled.
llvm-svn: 64401
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
| -rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index e37c439f..5633f0f 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -643,7 +643,16 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, Record.push_back(VE.getValueID(C->getOperand(2))); break; case Instruction::ShuffleVector: - Code = bitc::CST_CODE_CE_SHUFFLEVEC; + // If the return type and argument types are the same, this is a + // standard shufflevector instruction. If the types are different, + // then the shuffle is widening or truncating the input vectors, and + // the argument type must also be encoded. + if (C->getType() == C->getOperand(0)->getType()) { + Code = bitc::CST_CODE_CE_SHUFFLEVEC; + } else { + Code = bitc::CST_CODE_CE_SHUFVEC_EX; + Record.push_back(VE.getTypeID(C->getOperand(0)->getType())); + } Record.push_back(VE.getValueID(C->getOperand(0))); Record.push_back(VE.getValueID(C->getOperand(1))); Record.push_back(VE.getValueID(C->getOperand(2))); |
