82f13f6ba1
SWDEV-101354 - HSA HLC: fix unify metadata pass When we link multiple modules we have metadata duplicated, so after we link with our library bitcode is twice bigger than needs to be. Besides we did not unify llvm.ident metadata since llvm 3.6 merge. Fix that: 1. Add llvm.ident to the processing; 2. Do not duplicate strings within unified metadata; 3. Run unification pass post link, not before the link. Now since our library is compiled for OpenCL 2.0 we will always get OCL version 2.0 as a maximum. That is not really correct, and since the pass was not really working before that would lead to regression, as we would fail to identify correct kernel's OpenCL version and perform simplifications for 1.2. Now the pass will pick the first version, which shall represent the kernel module. That might not be 100% correct because we may have several kernel modules, but a proper fix would require to correctly identify library as 1.2, which is troublesome. In the current state that just keeps the status quo. Testing: smoke, precheckin Reviewed by Evgeny Mankov Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/linker.cpp#152 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/linker/include/AMDFixupKernelModule.h#2 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/linker/lib/AMDFixupKernelModule.cpp#7 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/linker/tools/opencl-link/opencl-link.cpp#10 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/Scalar/AMDUnifyMetadata.cpp#2 edit