[cfe-commits] r54078 - in /cfe/trunk: lib/CodeGen/CodeGenFunction.cpp test/CodeGen/dostmt.c
Chris Lattner
sabre at nondot.org
Fri Jul 25 16:40:10 PDT 2008
Author: lattner
Date: Fri Jul 25 18:40:10 2008
New Revision: 54078
URL: http://llvm.org/viewvc/llvm-project?rev=54078&view=rev
Log:
Fix rdar://6103124, the only dummy blocks are ones without names. Named blocks
are important part of control flow structures.
Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/test/CodeGen/dostmt.c
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=54078&r1=54077&r2=54078&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Fri Jul 25 18:40:10 2008
@@ -148,7 +148,7 @@
/// isDummyBlock - Return true if BB is an empty basic block
/// with no predecessors.
bool CodeGenFunction::isDummyBlock(const llvm::BasicBlock *BB) {
- if (BB->empty() && pred_begin(BB) == pred_end(BB))
+ if (BB->empty() && pred_begin(BB) == pred_end(BB) && !BB->hasName())
return true;
return false;
}
Modified: cfe/trunk/test/CodeGen/dostmt.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/dostmt.c?rev=54078&r1=54077&r2=54078&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/dostmt.c (original)
+++ cfe/trunk/test/CodeGen/dostmt.c Fri Jul 25 18:40:10 2008
@@ -1,7 +1,7 @@
-// RUN: clang %s -emit-llvm
+// RUN: clang %s -emit-llvm -o -
int bar();
-int foo() {
+int test0() {
int i;
i = 1 + 2;
do {
@@ -12,7 +12,7 @@
}
-int foo1() {
+int test1() {
int i;
i = 1 + 2;
do {
@@ -25,7 +25,7 @@
}
-int foo2() {
+int test2() {
int i;
i = 1 + 2;
do {
@@ -38,7 +38,7 @@
}
-int foo3() {
+int test3() {
int i;
i = 1 + 2;
do {
@@ -50,7 +50,7 @@
}
-int foo4() {
+int test4() {
int i;
i = 1 + 2;
do {
@@ -60,3 +60,11 @@
} while(0);
return i;
}
+
+// rdar://6103124
+void test5() {
+ do { break; } while(0);
+}
+
+
+
More information about the cfe-commits
mailing list