From 956fd7254f976581a27ba0ee73d7707ff484d2c3 Mon Sep 17 00:00:00 2001 From: Robert Bocchino Date: Tue, 17 Jan 2006 20:07:07 +0000 Subject: [PATCH] Constant folding support for the insertelement operation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25407 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/Local.cpp | 3 +++ 1 file changed, 3 insertions(+) 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);