aboutsummaryrefslogtreecommitdiffstats
path: root/test/CFrontend
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2008-01-26 01:43:44 +0000
committerBill Wendling <isanbard@gmail.com>2008-01-26 01:43:44 +0000
commit17e6f1aecb9037995f9bad30a288b1c8794fd86f (patch)
treeb37318e4866a40a2737fee80ddff4275919762d5 /test/CFrontend
parent3c947fc485cd1b53fc64cd36f14a38b6e7615c2f (diff)
downloadexternal_llvm-17e6f1aecb9037995f9bad30a288b1c8794fd86f.zip
external_llvm-17e6f1aecb9037995f9bad30a288b1c8794fd86f.tar.gz
external_llvm-17e6f1aecb9037995f9bad30a288b1c8794fd86f.tar.bz2
If we have a function like this:
void bork() { int *address = 0; *address = 0; } It's compiled into LLVM code that looks like this: define void @bork() noreturn nounwind { entry: unreachable } This is bad on some platforms (like PPC) because it will generate the label for the function but no body. The label could end up being associated with some non-code related stuff, like a section. This places a "trap" instruction if the SimplifyCFG pass removed all code from the function leaving only one "unreachable" instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46387 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CFrontend')
-rw-r--r--test/CFrontend/2008-01-25-EmptyFunction.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/CFrontend/2008-01-25-EmptyFunction.c b/test/CFrontend/2008-01-25-EmptyFunction.c
new file mode 100644
index 0000000..896738e
--- /dev/null
+++ b/test/CFrontend/2008-01-25-EmptyFunction.c
@@ -0,0 +1,7 @@
+// RUN: %llvmgcc -O2 -S -o - -emit-llvm %s | grep llvm.trap
+// RUN: %llvmgcc -O2 -S -o - -emit-llvm %s | grep unreachable
+
+void bork() {
+ int *address = 0;
+ *address = 0;
+}