llvm-mirror/test
Duncan Sands bbd03677ee Add a new codegen pass that normalizes dwarf exception handling
code in preparation for code generation.  The main thing it does
is handle the case when eh.exception calls (and, in a future
patch, eh.selector calls) are far away from landing pads.  Right
now in practice you only find eh.exception calls close to landing
pads: either in a landing pad (the common case) or in a landing
pad successor, due to loop passes shifting them about.  However
future exception handling improvements will result in calls far
from landing pads:
(1) Inlining of rewinds.  Consider the following case:
In function @f:
...
  invoke @g to label %normal unwind label %unwinds
...
unwinds:
  %ex = call i8* @llvm.eh.exception()
...

In function @g:
...
  invoke @something to label %continue unwind label %handler
...
handler:
  %ex = call i8* @llvm.eh.exception()
... perform cleanups ...
  "rethrow exception"

Now inline @g into @f.  Currently this is turned into:
In function @f:
...
  invoke @something to label %continue unwind label %handler
...
handler:
  %ex = call i8* @llvm.eh.exception()
... perform cleanups ...
  invoke "rethrow exception" to label %normal unwind label %unwinds
unwinds:
  %ex = call i8* @llvm.eh.exception()
...

However we would like to simplify invoke of "rethrow exception" into
a branch to the %unwinds label.  Then %unwinds is no longer a landing
pad, and the eh.exception call there is then far away from any landing
pads.

(2) Using the unwind instruction for cleanups.
It would be nice to have codegen handle the following case:
  invoke @something to label %continue unwind label %run_cleanups
...
handler:
... perform cleanups ...
  unwind

This requires turning "unwind" into a library call, which
necessarily takes a pointer to the exception as an argument
(this patch also does this unwind lowering).  But that means
you are using eh.exception again far from a landing pad.

(3) Bugpoint simplifications.  When bugpoint is simplifying
exception handling code it often generates eh.exception calls
far from a landing pad, which then causes codegen to assert.
Bugpoint then latches on to this assertion and loses sight
of the original problem.

Note that it is currently rare for this pass to actually do
anything.  And in fact it normally shouldn't do anything at
all given the code coming out of llvm-gcc!  But it does fire
a few times in the testsuite.  As far as I can see this is
almost always due to the LoopStrengthReduce codegen pass
introducing pointless loop preheader blocks which are landing
pads and only contain a branch to another block.  This other
block contains an eh.exception call.  So probably by tweaking
LoopStrengthReduce a bit this can be avoided.

llvm-svn: 72276
2009-05-22 20:36:31 +00:00
..
Analysis Teach ScalarEvolution to recognize x^-1 in the case where non-demanded 2009-05-18 16:29:04 +00:00
Archive sabre brings to my attention that the 'tr' suffix is also obsolete 2008-05-20 21:00:03 +00:00
Assembler Revert this. There's no way to verifiy indirect calls, and an optimizer can turn 2009-05-22 07:12:05 +00:00
Bindings/Ocaml Nounwind is not valid for function return values. 2009-05-06 13:51:18 +00:00
Bitcode fix a bitcode reader bug where it can't handle extractelement correctly: 2009-02-03 02:11:28 +00:00
BugPoint Re-commit r67334 and r67349 with fix. 2009-03-21 18:12:24 +00:00
CodeGen Add a new codegen pass that normalizes dwarf exception handling 2009-05-22 20:36:31 +00:00
DebugInfo Fix broken logic in DominatorTreeBase::Split. Part of PR4238. 2009-05-21 21:47:54 +00:00
ExecutionEngine remove a testcase that depends on -debug existing. 2009-03-13 20:31:25 +00:00
Feature Make MDNode use CallbackVH. Also change MDNode to store Value* instead of 2009-05-10 20:57:05 +00:00
FrontendAda Adjust this test for recent sroa improvements. 2009-03-12 11:56:12 +00:00
FrontendC Commands beginning with '--' are converted to '-f' by gcc. Blech! 2009-05-18 18:09:36 +00:00
FrontendC++ Check that pure/const functions are marked nounwind. 2009-05-04 16:47:11 +00:00
FrontendFortran These tests are x86 specific. 2009-04-22 10:39:51 +00:00
FrontendObjC Test for llvm-gcc bug fixed by 70301. 2009-04-28 17:16:30 +00:00
FrontendObjC++ This is an objective-c test, not an objective-c++ one. 2008-10-06 18:42:48 +00:00
Integer Converted a1.ll to unittests. 2009-03-24 21:36:09 +00:00
lib Re-commit r67334 and r67349 with fix. 2009-03-21 18:12:24 +00:00
Linker Reimplement the old and horrible bison parser for .ll files with a nice 2009-01-02 07:01:27 +00:00
LLVMC The 'forward_as' property did not use its second argument. 2009-05-06 01:41:19 +00:00
Other Update call graph after inlining invoke. 2009-03-31 17:36:12 +00:00
Scripts simplify shell syntax to work better on solaris, patch by 2008-06-25 16:03:42 +00:00
TableGen Implement !if, analogous to $(if) in GNU make. 2009-05-14 23:26:46 +00:00
Transforms Teach IndVarSimplify's FixUsesBeforeDefs to handle InvokeInsts by 2009-05-22 16:47:11 +00:00
Verifier Revert this. There's no way to verifiy indirect calls, and an optimizer can turn 2009-05-22 07:12:05 +00:00
Makefile Add more ulimit limits, to catch more kinds of runaway behavior. 2009-04-23 00:28:31 +00:00
Makefile.tests Failure.sh is dead, remove it. 2007-04-21 20:46:55 +00:00
TestRunner.sh Fix a bashism in TestRunner.sh. 2008-07-28 18:41:03 +00:00