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/Reader/BitcodeReader.cpp | |
parent | 655775293f318b43fb80427274675250b4b7b7a7 (diff) | |
download | bcm5719-llvm-94aa38d5684d8b21d8b2337f75cdd7637771138c.tar.gz bcm5719-llvm-94aa38d5684d8b21d8b2337f75cdd7637771138c.zip |
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/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index adffe829202..2ddfbe3a13c 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -933,7 +933,7 @@ bool BitcodeReader::ParseConstants() { case bitc::CST_CODE_CE_SHUFFLEVEC: { // CE_SHUFFLEVEC: [opval, opval, opval] const VectorType *OpTy = dyn_cast<VectorType>(CurTy); if (Record.size() < 3 || OpTy == 0) - return Error("Invalid CE_INSERTELT record"); + return Error("Invalid CE_SHUFFLEVEC record"); Constant *Op0 = ValueList.getConstantFwdRef(Record[0], OpTy); Constant *Op1 = ValueList.getConstantFwdRef(Record[1], OpTy); const Type *ShufTy=VectorType::get(Type::Int32Ty, OpTy->getNumElements()); @@ -941,6 +941,18 @@ bool BitcodeReader::ParseConstants() { V = ConstantExpr::getShuffleVector(Op0, Op1, Op2); break; } + case bitc::CST_CODE_CE_SHUFVEC_EX: { // [opty, opval, opval, opval] + const VectorType *RTy = dyn_cast<VectorType>(CurTy); + const VectorType *OpTy = dyn_cast<VectorType>(getTypeByID(Record[0])); + if (Record.size() < 4 || RTy == 0 || OpTy == 0) + return Error("Invalid CE_SHUFVEC_EX record"); + Constant *Op0 = ValueList.getConstantFwdRef(Record[1], OpTy); + Constant *Op1 = ValueList.getConstantFwdRef(Record[2], OpTy); + const Type *ShufTy=VectorType::get(Type::Int32Ty, RTy->getNumElements()); + Constant *Op2 = ValueList.getConstantFwdRef(Record[3], ShufTy); + V = ConstantExpr::getShuffleVector(Op0, Op1, Op2); + break; + } case bitc::CST_CODE_CE_CMP: { // CE_CMP: [opty, opval, opval, pred] if (Record.size() < 4) return Error("Invalid CE_CMP record"); const Type *OpTy = getTypeByID(Record[0]); |