diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index cfd67f2d8315134e706ed70d0b059fdc5f88aef1..f2598c16ce4d91dc3f3cb8ff1071159e5eeefab8 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -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(I->getOperand(2))) + return ConstantExpr::getInsertElement(Op0, Op1, Op2); case Instruction::GetElementPtr: std::vector IdxList; IdxList.reserve(I->getNumOperands()-1);