Further fixes for PR93
[oota-llvm.git] / lib / Linker / LinkModules.cpp
index 98dbacc3ea7c704b0dc683adb0928575be237873..0be840fb6cd8189df793db59ab5325435e788857 100644 (file)
@@ -318,13 +318,19 @@ 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->getOpcode() == Instruction::Shl ||
+                 CE->getOpcode() == Instruction::Shr) {      // Shift
+        Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
+        Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap);
+        Result = ConstantExpr::getShift(CE->getOpcode(), cast<Constant>(V1),
+                                        cast<Constant>(V2));
       } else if (CE->getNumOperands() == 2) {
         // Binary operator...
         Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
         Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap);
 
         Result = ConstantExpr::get(CE->getOpcode(), cast<Constant>(V1),
-                                   cast<Constant>(V2));        
+                                   cast<Constant>(V2));
       } else {
         assert(0 && "Unknown constant expr type!");
       }