Add supprot for shufflevector
[oota-llvm.git] / lib / Transforms / Utils / ValueMapper.cpp
index 3093acafab2b83e52b29a149786adc734695d49b..b309f9c0e2a7d715bf23f00d3425fff644f594ac 100644 (file)
@@ -94,6 +94,11 @@ Value *llvm::MapValue(const Value *V, std::map<const Value*, Value*> &VM) {
         Constant *MV1 = cast<Constant>(MapValue(CE->getOperand(0), VM));
         Constant *MV2 = cast<Constant>(MapValue(CE->getOperand(1), VM));
         return VMSlot = ConstantExpr::getExtractElement(MV1, MV2);
+      } else if (CE->getOpcode() == Instruction::ShuffleVector) {
+        Constant *MV1 = cast<Constant>(MapValue(CE->getOperand(0), VM));
+        Constant *MV2 = cast<Constant>(MapValue(CE->getOperand(1), VM));
+        Constant *MV3 = cast<Constant>(CE->getOperand(2));
+        return VMSlot = ConstantExpr::getShuffleVector(MV1, MV2, MV3);
       } else {
         assert(CE->getNumOperands() == 2 && "Must be binary operator?");
         Constant *MV1 = cast<Constant>(MapValue(CE->getOperand(0), VM));