[llvm] r221920 - R600: Fix assert on empty function
Matt Arsenault
Matthew.Arsenault at amd.com
Thu Nov 13 12:07:40 PST 2014
Author: arsenm
Date: Thu Nov 13 14:07:40 2014
New Revision: 221920
URL: http://llvm.org/viewvc/llvm-project?rev=221920&view=rev
Log:
R600: Fix assert on empty function
If a function is just an unreachable, this would hit a
"this is not a MachO target" assertion because of setting
HasSubsectionViaSymbols.
Added:
llvm/trunk/test/CodeGen/R600/empty-function.ll
Modified:
llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp
Modified: llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp?rev=221920&r1=221919&r2=221920&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp Thu Nov 13 14:07:40 2014
@@ -14,7 +14,6 @@ using namespace llvm;
AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(StringRef &TT) : MCAsmInfoELF() {
HasSingleParameterDotFile = false;
//===------------------------------------------------------------------===//
- HasSubsectionsViaSymbols = true;
MaxInstLength = 16;
SeparatorString = "\n";
CommentString = ";";
Added: llvm/trunk/test/CodeGen/R600/empty-function.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/R600/empty-function.ll?rev=221920&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/R600/empty-function.ll (added)
+++ llvm/trunk/test/CodeGen/R600/empty-function.ll Thu Nov 13 14:07:40 2014
@@ -0,0 +1,20 @@
+; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s
+
+; Make sure we don't assert on empty functions
+
+; SI-LABEL: {{^}}empty_function_ret:
+; SI: .text
+; SI: s_endpgm
+; SI: codeLenInByte = 4
+define void @empty_function_ret() #0 {
+ ret void
+}
+
+; SI-LABEL: {{^}}empty_function_unreachable:
+; SI: .text
+; SI: codeLenInByte = 0
+define void @empty_function_unreachable() #0 {
+ unreachable
+}
+
+attributes #0 = { nounwind }
More information about the llvm-commits
mailing list