Constant folding support for the insertelement operation.

llvm-svn: 25407
This commit is contained in:
Robert Bocchino 2006-01-17 20:07:07 +00:00
parent 6dce25019d
commit e6336a9b69
1 changed files with 3 additions and 0 deletions

View File

@ -104,6 +104,9 @@ Constant *llvm::ConstantFoldInstruction(Instruction *I) {
return 0;
case Instruction::ExtractElement:
return ConstantExpr::getExtractElement(Op0, Op1);
case Instruction::InsertElement:
if (Constant *Op2 = dyn_cast<Constant>(I->getOperand(2)))
return ConstantExpr::getInsertElement(Op0, Op1, Op2);
case Instruction::GetElementPtr:
std::vector<Constant*> IdxList;
IdxList.reserve(I->getNumOperands()-1);