aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-07-15 23:32:40 +0000
committerBill Wendling <isanbard@gmail.com>2010-07-15 23:32:40 +0000
commite9bf7e692e56656ef13b33af86624d0fdcd578fb (patch)
tree2cb585a3c4d0fbf8bb51f00db689241d03af0ad0 /test/CodeGen
parent60108e96bbc5432f4fe06ba313e64448e97a0e15 (diff)
Handle code gen for the unreachable instruction if it's the only instruction in
the function. We'll just turn it into a "trap" instruction instead. The problem with not handling this is that it might generate a prologue without the equivalent epilogue to go with it: $ cat t.ll define void @foo() { entry: unreachable } $ llc -o - t.ll -relocation-model=pic -disable-fp-elim -unwind-tables .section __TEXT,__text,regular,pure_instructions .globl _foo .align 4, 0x90 _foo: ## @foo Leh_func_begin0: ## BB#0: ## %entry pushq %rbp Ltmp0: movq %rsp, %rbp Ltmp1: Leh_func_end0: ... The unwind tables then have bad data in them causing all sorts of problems. Fixes <rdar://problem/8096481>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108473 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/PowerPC/2008-01-25-EmptyFunction.ll2
-rw-r--r--test/CodeGen/X86/2008-01-25-EmptyFunction.ll13
2 files changed, 12 insertions, 3 deletions
diff --git a/test/CodeGen/PowerPC/2008-01-25-EmptyFunction.ll b/test/CodeGen/PowerPC/2008-01-25-EmptyFunction.ll
index db2ab877ff..ba59309ec2 100644
--- a/test/CodeGen/PowerPC/2008-01-25-EmptyFunction.ll
+++ b/test/CodeGen/PowerPC/2008-01-25-EmptyFunction.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=ppc32 | grep nop
+; RUN: llc < %s -march=ppc32 | grep trap
target triple = "powerpc-apple-darwin8"
diff --git a/test/CodeGen/X86/2008-01-25-EmptyFunction.ll b/test/CodeGen/X86/2008-01-25-EmptyFunction.ll
index b936686798..4baa294fb8 100644
--- a/test/CodeGen/X86/2008-01-25-EmptyFunction.ll
+++ b/test/CodeGen/X86/2008-01-25-EmptyFunction.ll
@@ -1,8 +1,17 @@
-; RUN: llc < %s -march=x86 | grep nop
+; RUN: llc < %s -march=x86 | FileCheck -check-prefix=NO-FP %s
+; RUN: llc < %s -march=x86 -disable-fp-elim | FileCheck -check-prefix=FP %s
target triple = "i686-apple-darwin8"
+define void @func1() noreturn nounwind {
+entry:
+; NO-FP: ud2
+ unreachable
+}
-define void @bork() noreturn nounwind {
+define void @func2() noreturn nounwind {
entry:
+; FP: pushl %ebp
+; FP: movl %esp, %ebp
+; FP: ud2
unreachable
}