diff --git a/include/llvm/IR/Intrinsics.td b/include/llvm/IR/Intrinsics.td
index fb66085915ade5fc971d5e5c6c1d534164319b9c..9840516a266754087cc2c321410c350d5930375b 100644
--- a/include/llvm/IR/Intrinsics.td
+++ b/include/llvm/IR/Intrinsics.td
@@ -592,7 +592,7 @@ def int_debugtrap : Intrinsic<[]>,
 def int_loopbound : Intrinsic<[], [llvm_i32_ty, llvm_i32_ty]>;
 
 // Platina annotation intrinsic - hold metadata
-def int_platina : Intrinsic<[]>;
+def int_platina : Intrinsic<[], [llvm_metadata_ty, llvm_metadata_ty]>;
 
 // NOP: calls/invokes to this intrinsic are removed by codegen
 def int_donothing : Intrinsic<[], [], [IntrNoMem]>;
diff --git a/lib/CodeGen/PMLExport.cpp b/lib/CodeGen/PMLExport.cpp
index dcf1d0736fc5af5beae336394de77bad55eff83b..37f43506c96f82bc49bf443b72e91fe6d5839af3 100644
--- a/lib/CodeGen/PMLExport.cpp
+++ b/lib/CodeGen/PMLExport.cpp
@@ -411,8 +411,8 @@ void PMLBitcodeExport::exportInstruction(yaml::Instruction* I,
       case Intrinsic::platina:
         {
           const BasicBlock *BB = II->getParent();
-          const MDNode *ntype = CI->getMetadata("platina.type");
-          const MDNode *nexpr = CI->getMetadata("platina.expr");
+          const MDNode *ntype = cast<MDNode>(cast<MetadataAsValue>(CI->getArgOperand(0))->getMetadata());
+          const MDNode *nexpr = cast<MDNode>(cast<MetadataAsValue>(CI->getArgOperand(1))->getMetadata());
           assert(ntype && nexpr &&
               "Platina intrinsic expects platina.type and platina.expr metadata");
           MDString *type = cast<MDString>(ntype->getOperand(0));
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index cefe5c02e96e411938bcde7ec572b3cc02361724..799d9437ff1a3ce5cc244736ff90d59abe360297 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -4893,8 +4893,8 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
     return 0;
   }
   case Intrinsic::platina: {
-    SDValue type = DAG.getMDNode(I.getMetadata("platina.type"));
-    SDValue expr = DAG.getMDNode(I.getMetadata("platina.expr"));
+    SDValue type = DAG.getMDNode(cast<MDNode>(cast<MetadataAsValue>(I.getArgOperand(0))->getMetadata()));
+    SDValue expr = DAG.getMDNode(cast<MDNode>(cast<MetadataAsValue>(I.getArgOperand(1))->getMetadata()));
     DAG.setRoot(DAG.getNode(ISD::PLATINA, sdl, MVT::Other, getRoot(), type, expr));
     return 0;
   }