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?
llvm-svn: 76361
diff --git a/clang/test/CodeGen/unreachable.c b/clang/test/CodeGen/unreachable.c
new file mode 100644
index 0000000..ab029b6
--- /dev/null
+++ b/clang/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;
+}