[llvm] r290114 - [AMDGPU] When unifying metadata, add operands to named metadata individually
Konstantin Zhuravlyov via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 19 08:54:25 PST 2016
Author: kzhuravl
Date: Mon Dec 19 10:54:24 2016
New Revision: 290114
URL: http://llvm.org/viewvc/llvm-project?rev=290114&view=rev
Log:
[AMDGPU] When unifying metadata, add operands to named metadata individually
Differential Revision: https://reviews.llvm.org/D27725
Modified:
llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyMetadata.cpp
llvm/trunk/test/CodeGen/AMDGPU/unify-metadata.ll
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyMetadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyMetadata.cpp?rev=290114&r1=290113&r2=290114&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyMetadata.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyMetadata.cpp Mon Dec 19 10:54:24 2016
@@ -100,7 +100,9 @@ namespace {
NamedMD->eraseFromParent();
NamedMD = M.getOrInsertNamedMetadata(Name);
- NamedMD->addOperand(MDNode::get(M.getContext(), All));
+ for (const auto &MD : All)
+ NamedMD->addOperand(MDNode::get(M.getContext(), MD));
+
return true;
}
};
@@ -133,10 +135,10 @@ bool AMDGPUUnifyMetadata::runOnModule(Mo
bool Changed = false;
- for (auto &I:Vers)
+ for (auto &I : Vers)
Changed |= unifyVersionMD(M, I, true);
- for (auto &I:Exts)
+ for (auto &I : Exts)
Changed |= unifyExtensionMD(M, I);
return Changed;
Modified: llvm/trunk/test/CodeGen/AMDGPU/unify-metadata.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/unify-metadata.ll?rev=290114&r1=290113&r2=290114&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/unify-metadata.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/unify-metadata.ll Mon Dec 19 10:54:24 2016
@@ -4,23 +4,28 @@
; modules for records such as opencl.ocl.version, llvm.ident and similar.
; ALL-DAG: !opencl.ocl.version = !{![[OCL_VER:[0-9]+]]}
-; ALL-DAG: !llvm.ident = !{![[LLVM_IDENT:[0-9]+]]}
-; ALL-DAG: !opencl.used.extensions = !{![[USED_EXT:[0-9]+]]}
+; ALL-DAG: !llvm.ident = !{![[LLVM_IDENT_0:[0-9]+]], ![[LLVM_IDENT_1:[0-9]+]]}
+; ALL-DAG: !opencl.used.extensions = !{![[USED_EXT_0:[0-9]+]], ![[USED_EXT_1:[0-9]+]], ![[USED_EXT_2:[0-9]+]]}
+
; ALL-DAG: ![[OCL_VER]] = !{i32 1, i32 2}
-; ALL-DAG: ![[LLVM_IDENT]] = !{!"clang version 4.0 "}
-; ALL-DAG: ![[USED_EXT]] = !{!"cl_images", !"cl_khr_fp16", !"cl_doubles"}
+; ALL-DAG: ![[LLVM_IDENT_0]] = !{!"clang version 4.0"}
+; ALL-DAG: ![[LLVM_IDENT_1]] = !{!"clang version 4.0 (rLXXXXXX)"}
+; ALL-DAG: ![[USED_EXT_0]] = !{!"cl_images"}
+; ALL-DAG: ![[USED_EXT_1]] = !{!"cl_khr_fp16"}
+; ALL-DAG: ![[USED_EXT_2]] = !{!"cl_doubles"}
define void @test() {
ret void
}
!opencl.ocl.version = !{!1, !0, !0, !0}
-!llvm.ident = !{!2, !2, !2, !2}
+!llvm.ident = !{!2, !2, !2, !2, !6}
!opencl.used.extensions = !{!3, !3, !4, !5}
!0 = !{i32 2, i32 0}
!1 = !{i32 1, i32 2}
-!2 = !{!"clang version 4.0 "}
+!2 = !{!"clang version 4.0"}
!3 = !{!"cl_images", !"cl_khr_fp16"}
!4 = !{!"cl_images", !"cl_doubles"}
!5 = !{}
+!6 = !{!"clang version 4.0 (rLXXXXXX)"}
More information about the llvm-commits
mailing list