Constant folding support for the insertelement operation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25407 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Robert Bocchino 2006-01-17 20:07:07 +00:00
parent 8fcf01ead0
commit 956fd7254f

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);