[llvm] r332137 - [AMDGPU] Fix compilation failure when IR contains comdat
Yaxun Liu via llvm-commits
llvm-commits at lists.llvm.org
Fri May 11 13:40:14 PDT 2018
Author: yaxunl
Date: Fri May 11 13:40:14 2018
New Revision: 332137
URL: http://llvm.org/viewvc/llvm-project?rev=332137&view=rev
Log:
[AMDGPU] Fix compilation failure when IR contains comdat
Remove a useless SwitchSection which also causes compilation failure
when IR contains comdat.
The SwitchSection is useless because the current section is already
correct text section for the function therefore no need to switch.
It causes compilation failure for comdat because functions with comdat
has specific text section, not the default .text section.
Since HIP uses comdat, this bug caused failures for HIP.
Differential Revision: https://reviews.llvm.org/D46770
Added:
llvm/trunk/test/CodeGen/AMDGPU/comdat.ll
Modified:
llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp?rev=332137&r1=332136&r2=332137&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp Fri May 11 13:40:14 2018
@@ -197,8 +197,6 @@ void AMDGPUAsmPrinter::EmitFunctionBodyS
amd_kernel_code_t KernelCode;
if (STM.isAmdCodeObjectV2(*MF)) {
getAmdKernelCode(KernelCode, CurrentProgramInfo, *MF);
-
- OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
getTargetStreamer()->EmitAMDKernelCodeT(KernelCode);
}
Added: llvm/trunk/test/CodeGen/AMDGPU/comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/comdat.ll?rev=332137&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/comdat.ll (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/comdat.ll Fri May 11 13:40:14 2018
@@ -0,0 +1,19 @@
+; RUN: llc -mtriple amdgcn-amd-amdhsa -filetype=obj <%s \
+; RUN: | llvm-readobj -symbols - | FileCheck %s
+
+; CHECK: Name: func1
+; CHECK: Section: .text.func1
+
+; CHECK: Name: func2
+; CHECK: Section: .text.func2
+
+$func1 = comdat any
+$func2 = comdat any
+
+define amdgpu_kernel void @func1() local_unnamed_addr comdat {
+ ret void
+}
+
+define amdgpu_kernel void @func2() local_unnamed_addr comdat {
+ ret void
+}
More information about the llvm-commits
mailing list