add support for ConstantPacked to the linker
authorChris Lattner <sabre@nondot.org>
Thu, 19 Jan 2006 23:15:58 +0000 (23:15 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 19 Jan 2006 23:15:58 +0000 (23:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25467 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Linker/LinkModules.cpp

index 732fdf919e3a9ea89cc7cdbd18f217898b0020bf..8295418cd7f30d8e7d86a8d33e165f892f4c024c 100644 (file)
@@ -290,6 +290,11 @@ static Value *RemapOperand(const Value *In,
       Result = const_cast<Constant*>(CPV);
     } else if (isa<GlobalValue>(CPV)) {
       Result = cast<Constant>(RemapOperand(CPV, ValueMap));
+    } else if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(CPV)) {
+      std::vector<Constant*> Operands(CP->getNumOperands());
+      for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
+        Operands[i] = cast<Constant>(RemapOperand(CP->getOperand(i), ValueMap));
+      Result = ConstantPacked::get(Operands);
     } else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CPV)) {
       if (CE->getOpcode() == Instruction::GetElementPtr) {
         Value *Ptr = RemapOperand(CE->getOperand(0), ValueMap);