From bc72a21666a9efc78e71b0296313f6e1449649fa Mon Sep 17 00:00:00 2001
From: Konstantin Zhuravlyov <kzhuravl_dev@outlook.com>
Date: Wed, 22 Mar 2017 21:48:18 +0000
Subject: [PATCH] [AMDGPU] Fix bug 31610

Differential Revision: https://reviews.llvm.org/D31258


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298551 91177308-0d34-0410-b5e6-96231b3b80d8
---
 lib/Target/AMDGPU/AMDGPURuntimeMetadata.h          | 8 ++++----
 lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp | 5 ++---
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h b/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h
index ed147ff4c43..36e7a0c42a9 100644
--- a/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h
+++ b/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h
@@ -40,8 +40,8 @@ namespace AMDGPU {
 namespace RuntimeMD {
 
   // Version and revision of runtime metadata
-  const unsigned char MDVersion   = 2;
-  const unsigned char MDRevision  = 0;
+  const uint32_t MDVersion   = 2;
+  const uint32_t MDRevision  = 0;
 
   // Name of keys for runtime metadata.
   namespace KeyName {
@@ -215,7 +215,7 @@ namespace RuntimeMD {
     struct Metadata {
       std::string Name;
       std::string Language;
-      std::vector<uint8_t> LanguageVersion;
+      std::vector<uint32_t> LanguageVersion;
       std::vector<uint32_t> ReqdWorkGroupSize;
       std::vector<uint32_t> WorkGroupSizeHint;
       std::string VecTypeHint;
@@ -265,7 +265,7 @@ namespace RuntimeMD {
   namespace Program {
     // In-memory representation of program information.
     struct Metadata {
-      std::vector<uint8_t> MDVersionSeq;
+      std::vector<uint32_t> MDVersionSeq;
       std::vector<std::string> PrintfInfo;
       std::vector<Kernel::Metadata> Kernels;
 
diff --git a/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp b/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp
index 0e87d750f5d..7c96898297c 100644
--- a/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp
+++ b/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp
@@ -49,7 +49,6 @@ static cl::opt<bool>
 CheckRuntimeMDParser("amdgpu-check-rtmd-parser", cl::Hidden,
                      cl::desc("Check AMDGPU runtime metadata YAML parser"));
 
-LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint8_t)
 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint32_t)
 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(std::string)
 LLVM_YAML_IS_SEQUENCE_VECTOR(Kernel::Metadata)
@@ -297,9 +296,9 @@ static Kernel::Metadata getRuntimeMDForKernel(const Function &F) {
       auto Node = MD->getOperand(0);
       if (Node->getNumOperands() > 1) {
         Kernel.Language = "OpenCL C";
-        uint16_t Major = mdconst::extract<ConstantInt>(Node->getOperand(0))
+        uint32_t Major = mdconst::extract<ConstantInt>(Node->getOperand(0))
                          ->getZExtValue();
-        uint16_t Minor = mdconst::extract<ConstantInt>(Node->getOperand(1))
+        uint32_t Minor = mdconst::extract<ConstantInt>(Node->getOperand(1))
                          ->getZExtValue();
         Kernel.LanguageVersion.push_back(Major);
         Kernel.LanguageVersion.push_back(Minor);
-- 
2.12.2

