diff options
author | John McCall <rjmccall@apple.com> | 2011-08-06 06:53:52 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-08-06 06:53:52 +0000 |
commit | f82bdf6dd1397604d209e7d4bc17896a686573ec (patch) | |
tree | 312b749c5c85e5a8377f1c746c0b475e6f2ff13b /clang/test | |
parent | f7bb3e5bd0f1fef67f786e1c23114aa3fc1068f8 (diff) | |
download | bcm5719-llvm-f82bdf6dd1397604d209e7d4bc17896a686573ec.tar.gz bcm5719-llvm-f82bdf6dd1397604d209e7d4bc17896a686573ec.zip |
Be sure to destroy the normal entry block of a cleanup that we
aren't actually going to make a normal cleanup for. Sometimes
we optimistically create branches to such blocks for fixups,
and then we resolve the fixup to somewhere within the cleanup's
scope, and then the cleanup is actually not reachable for some
reason. The process of resolving the fixup leaves us with
switches whose default edge leads to the cleanup; we can
replace that with unreachable, then (in many cases) turn
the switch into an unconditional branch.
Fixes PR10467.
llvm-svn: 137011
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGenCXX/destructors.cpp | 25 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/eh.cpp | 5 |
2 files changed, 26 insertions, 4 deletions
diff --git a/clang/test/CodeGenCXX/destructors.cpp b/clang/test/CodeGenCXX/destructors.cpp index 33819858149..bfdf93c5a29 100644 --- a/clang/test/CodeGenCXX/destructors.cpp +++ b/clang/test/CodeGenCXX/destructors.cpp @@ -323,7 +323,32 @@ namespace test7 { // CHECK: invoke void @_ZN5test71DD1Ev( // CHECK: call void @_ZN5test71AD2Ev( B::~B() {} +} + +// PR10467 +namespace test8 { + struct A { A(); ~A(); }; + void die() __attribute__((noreturn)); + void test() { + A x; + while (1) { + A y; + goto l; + } + l: die(); + } + + // CHECK: define void @_ZN5test84testEv() + // CHECK: [[X:%.*]] = alloca [[A:%.*]], align 1 + // CHECK-NEXT: [[Y:%.*]] = alloca [[A:%.*]], align 1 + // CHECK: call void @_ZN5test81AC1Ev([[A]]* [[X]]) + // CHECK-NEXT: br label + // CHECK: invoke void @_ZN5test81AC1Ev([[A]]* [[Y]]) + // CHECK: invoke void @_ZN5test81AD1Ev([[A]]* [[Y]]) + // CHECK-NOT: switch + // CHECK: invoke void @_ZN5test83dieEv() + // CHECK: unreachable } // Checks from test3: diff --git a/clang/test/CodeGenCXX/eh.cpp b/clang/test/CodeGenCXX/eh.cpp index 58cb44515dd..736b124ab48 100644 --- a/clang/test/CodeGenCXX/eh.cpp +++ b/clang/test/CodeGenCXX/eh.cpp @@ -296,10 +296,7 @@ namespace test12 { // CHECK: invoke void @_ZN6test121AD1Ev([[A]]* [[Z]]) // CHECK: invoke void @_ZN6test121AD1Ev([[A]]* [[Y]]) - - // It'd be great if something eliminated this switch. - // CHECK: load i32* [[CLEANUPDEST]] - // CHECK-NEXT: switch i32 + // CHECK-NOT: switch goto success; } |