[llvm-commits] Fix PR1224 differently

Duncan Sands baldrick at free.fr
Sat Jun 9 07:21:23 PDT 2007

The fix that was applied for PR1224 stops the compiler
crashing but breaks exception handling.  The problem
described in PR1224 is that invoke is a terminator that
can produce a value.  The value may be needed in other
blocks.  The code that writes to registers values needed
in other blocks runs before terminators are lowered (in
this case invoke) so asserted because the value was not
yet available.  The fix that was applied was to do invoke
lowering earlier, before writing values to registers.

The problem this causes is that the code to copy values
to registers can be output after the invoke call.  If
an exception is raised and control is passed to the
landing pad then this copy-code will never execute.  If
the value is needed in some code path reached via the
landing pad then that code will get something bogus.

The attached patch reverts the original fix and simply
skips invoke values in the general copying to registers
code.  The invoke value is instead copied to a register
in the invoke lowering code.  I had a testcase but I
accidentally deleted it...


-------------- next part --------------
A non-text attachment was scrubbed...
Name: invoke_order.diff
Type: text/x-diff
Size: 3640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070609/8a446572/attachment.diff>

More information about the llvm-commits mailing list