summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2014-11-13 20:07:40 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2014-11-13 20:07:40 +0000
commit6ef66144f3e9512d11caeb46425c12a1e0d817f8 (patch)
tree2ad7b30b36101659bdf420d0d7a10ad4e8c9acb8
parent5dcf11d17791b422336eed0ae0310fdbc109883e (diff)
downloadbcm5719-llvm-6ef66144f3e9512d11caeb46425c12a1e0d817f8.tar.gz
bcm5719-llvm-6ef66144f3e9512d11caeb46425c12a1e0d817f8.zip
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. llvm-svn: 221920
-rw-r--r--llvm/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp1
-rw-r--r--llvm/test/CodeGen/R600/empty-function.ll20
2 files changed, 20 insertions, 1 deletions
diff --git a/llvm/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp b/llvm/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp
index 5393504707c..3c2b889598a 100644
--- a/llvm/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp
+++ b/llvm/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp
@@ -14,7 +14,6 @@ using namespace llvm;
AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(StringRef &TT) : MCAsmInfoELF() {
HasSingleParameterDotFile = false;
//===------------------------------------------------------------------===//
- HasSubsectionsViaSymbols = true;
MaxInstLength = 16;
SeparatorString = "\n";
CommentString = ";";
diff --git a/llvm/test/CodeGen/R600/empty-function.ll b/llvm/test/CodeGen/R600/empty-function.ll
new file mode 100644
index 00000000000..d4ff803b563
--- /dev/null
+++ b/llvm/test/CodeGen/R600/empty-function.ll
@@ -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 }
OpenPOWER on IntegriCloud