[LLVMbugs] [Bug 1914] New: Should turn invoke of a resume into a branch

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Jan 14 10:24:17 PST 2008


           Summary: Should turn invoke of a resume into a branch
           Product: new-bugs
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: baldrick at free.fr
                CC: llvmbugs at cs.uiuc.edu
        Depends on: 1508

Due to inlining, we can end up with an invoke of _Unwind_Resume.
This should be lowered to a branch.  However there is the problem
of identifying the resume libcall: gcc generates four different ones:

_Unwind_Resume (most platforms)
_Unwind_Resume_or_Rethrow (LLVM hack for darwin)
_Unwind_SjLj_Resume (when doing sj/lj style eh)
__cxa_end_cleanup (LLVM hack for ARM)

Since these are target dependent but language independent,
we could output a special rewind instruction or intrinsic
and have it lowered to the right one in the code generators,
rather than trying to recognize all these different variants.
On the other hand, since both _Unwind_Resume and _Unwind_Resume_or_Rethrow
act the same (the first is an optimized version of the second that can only
be used in special circumstances), and the second one presumably underlies
cxa_throw, it might be better to just recognize these libcalls.

There is also the problem that turning the invoke into a branch
can leave eh.exception and eh.selector calls floating in space,
see PR1508.

Here's an example: compile to bitcode at -O0, then use opt -std-compile-opts
to optimize.  You end up with an invoke of _Unwind_Resume.

#include <cstdio>
class A {
  A() {}
  ~A() {}
void f() {
  A a;
  throw 5.0;
main() {
  try {
   } catch(...) { printf("caught\n"); }

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list