aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/unreachable.c
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-19 06:58:07 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-19 06:58:07 +0000
commitd286f05f1234bac289173f0eed88d7ecbaea0099 (patch)
tree5c3ce8caaaffe3b6b1e698e4346b372baaeaf84f /test/CodeGen/unreachable.c
parent75cc2c484873dfbc53a026f5cc50095fd67510ac (diff)
Avoid generation of dead code in a few more situations.
- Emit variable declarations as "simple", we want to avoid forcing the creation of a dummy basic block, but still need to make the variable available for later use. - With that, we can now skip IRgen for other unreachable statements (which don't define a label). - Anders, I added two fixmes on calls to EmitVLASize, can you check them? git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76361 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/unreachable.c')
-rw-r--r--test/CodeGen/unreachable.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/CodeGen/unreachable.c b/test/CodeGen/unreachable.c
new file mode 100644
index 0000000000..ab029b613d
--- /dev/null
+++ b/test/CodeGen/unreachable.c
@@ -0,0 +1,26 @@
+// RUN: clang-cc -emit-llvm -o %t %s &&
+// RUN: grep '@unreachable' %t | count 0
+
+extern int unreachable();
+
+int f0() {
+ return 0;
+ unreachable();
+}
+
+int f1(int i) {
+ goto L0;
+ int a = unreachable();
+ L0:
+ return 0;
+}
+
+int f2(int i) {
+ goto L0;
+ unreachable();
+ int a;
+ unreachable();
+ L0:
+ a = i + 1;
+ return a;
+}