[PATCH] R600: Fix assert on empty function
Tom Stellard
tom at stellard.net
Thu Nov 13 07:59:57 PST 2014
On Wed, Oct 22, 2014 at 04:08:05AM +0000, Matt Arsenault wrote:
> If a function is just an unreachable, this would hit a
> "this is not a MachO target" assertion because of setting
> HasSubsectionViaSymbols.
>
LGTM.
> http://reviews.llvm.org/D5903
>
> Files:
> lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp
> test/CodeGen/R600/empty-function.ll
> Index: lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp
> ===================================================================
> --- lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp
> +++ lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp
> @@ -14,7 +14,6 @@
> AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(StringRef &TT) : MCAsmInfoELF() {
> HasSingleParameterDotFile = false;
> //===------------------------------------------------------------------===//
> - HasSubsectionsViaSymbols = true;
> MaxInstLength = 16;
> SeparatorString = "\n";
> CommentString = ";";
> Index: test/CodeGen/R600/empty-function.ll
> ===================================================================
> --- /dev/null
> +++ 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 }
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list