[llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp

Evan Cheng evan.cheng at apple.com
Thu Apr 6 18:27:55 PDT 2006



Changes in directory llvm/lib/Linker:

LinkModules.cpp updated: 1.111 -> 1.112
---
Log message:

Add code to RemapOperand() to handle Instruction::ExtractElement and
Instruction::InsertElement.


---
Diffs of the changes:  (+12 -0)

 LinkModules.cpp |   12 ++++++++++++
 1 files changed, 12 insertions(+)


Index: llvm/lib/Linker/LinkModules.cpp
diff -u llvm/lib/Linker/LinkModules.cpp:1.111 llvm/lib/Linker/LinkModules.cpp:1.112
--- llvm/lib/Linker/LinkModules.cpp:1.111	Mon Jan 23 22:14:29 2006
+++ llvm/lib/Linker/LinkModules.cpp	Thu Apr  6 20:27:42 2006
@@ -305,6 +305,18 @@
                                                         ValueMap)));
 
         Result = ConstantExpr::getGetElementPtr(cast<Constant>(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<Constant>(Ptr),
+                                                 cast<Constant>(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<Constant>(Ptr),
+                                                cast<Constant>(Elt),
+                                                cast<Constant>(Idx));
       } else if (CE->getNumOperands() == 1) {
         // Cast instruction
         assert(CE->getOpcode() == Instruction::Cast);






More information about the llvm-commits mailing list