From: Robert Bocchino Date: Tue, 17 Jan 2006 20:07:07 +0000 (+0000) Subject: Constant folding support for the insertelement operation. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=956fd7254f976581a27ba0ee73d7707ff484d2c3;p=oota-llvm.git Constant folding support for the insertelement operation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25407 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index cfd67f2d831..f2598c16ce4 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/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);