Fix linking of constant expr casts due to type resolution changes. With
authorChris Lattner <sabre@nondot.org>
Wed, 31 Mar 2004 02:58:28 +0000 (02:58 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 31 Mar 2004 02:58:28 +0000 (02:58 +0000)
this and the other patches 253.perlbmk links again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12565 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Linker/LinkModules.cpp
lib/Transforms/Utils/Linker.cpp
lib/VMCore/Linker.cpp

index 529fb7714893841f231833524c1d6a8e51972b22..c113ca1a0ffa208043e8d17df52cd3f115a8fc7a 100644 (file)
@@ -325,6 +325,14 @@ static Value *RemapOperand(const Value *In,
         assert(CE->getOpcode() == Instruction::Cast);
         Value *V = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
         Result = ConstantExpr::getCast(cast<Constant>(V), CE->getType());
+      } else if (CE->getNumOperands() == 3) {
+        // Select instruction
+        assert(CE->getOpcode() == Instruction::Select);
+        Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
+        Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap);
+        Value *V3 = RemapOperand(CE->getOperand(2), LocalMap, GlobalMap);
+        Result = ConstantExpr::getSelect(cast<Constant>(V1), cast<Constant>(V2),
+                                         cast<Constant>(V3));
       } else if (CE->getNumOperands() == 2) {
         // Binary operator...
         Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
index 529fb7714893841f231833524c1d6a8e51972b22..c113ca1a0ffa208043e8d17df52cd3f115a8fc7a 100644 (file)
@@ -325,6 +325,14 @@ static Value *RemapOperand(const Value *In,
         assert(CE->getOpcode() == Instruction::Cast);
         Value *V = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
         Result = ConstantExpr::getCast(cast<Constant>(V), CE->getType());
+      } else if (CE->getNumOperands() == 3) {
+        // Select instruction
+        assert(CE->getOpcode() == Instruction::Select);
+        Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
+        Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap);
+        Value *V3 = RemapOperand(CE->getOperand(2), LocalMap, GlobalMap);
+        Result = ConstantExpr::getSelect(cast<Constant>(V1), cast<Constant>(V2),
+                                         cast<Constant>(V3));
       } else if (CE->getNumOperands() == 2) {
         // Binary operator...
         Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
index 529fb7714893841f231833524c1d6a8e51972b22..c113ca1a0ffa208043e8d17df52cd3f115a8fc7a 100644 (file)
@@ -325,6 +325,14 @@ static Value *RemapOperand(const Value *In,
         assert(CE->getOpcode() == Instruction::Cast);
         Value *V = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
         Result = ConstantExpr::getCast(cast<Constant>(V), CE->getType());
+      } else if (CE->getNumOperands() == 3) {
+        // Select instruction
+        assert(CE->getOpcode() == Instruction::Select);
+        Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
+        Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap);
+        Value *V3 = RemapOperand(CE->getOperand(2), LocalMap, GlobalMap);
+        Result = ConstantExpr::getSelect(cast<Constant>(V1), cast<Constant>(V2),
+                                         cast<Constant>(V3));
       } else if (CE->getNumOperands() == 2) {
         // Binary operator...
         Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);