From: Evan Cheng Date: Fri, 7 Apr 2006 01:27:42 +0000 (+0000) Subject: Add code to RemapOperand() to handle Instruction::ExtractElement and X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=39c61fd5274509f34766073f10aaa20c99068804;p=oota-llvm.git Add code to RemapOperand() to handle Instruction::ExtractElement and Instruction::InsertElement. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27477 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index aeef9e65e02..c8ea03898e3 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -305,6 +305,18 @@ static Value *RemapOperand(const Value *In, ValueMap))); Result = ConstantExpr::getGetElementPtr(cast(Ptr), Indices); + } else if (CE->getOpcode() == Instruction::ExtractElement) { + Value *Ptr = RemapOperand(CE->getOperand(0), ValueMap); + Value *Idx = RemapOperand(CE->getOperand(1), ValueMap); + Result = ConstantExpr::getExtractElement(cast(Ptr), + cast(Idx)); + } else if (CE->getOpcode() == Instruction::InsertElement) { + Value *Ptr = RemapOperand(CE->getOperand(0), ValueMap); + Value *Elt = RemapOperand(CE->getOperand(1), ValueMap); + Value *Idx = RemapOperand(CE->getOperand(2), ValueMap); + Result = ConstantExpr::getInsertElement(cast(Ptr), + cast(Elt), + cast(Idx)); } else if (CE->getNumOperands() == 1) { // Cast instruction assert(CE->getOpcode() == Instruction::Cast);