The fix that was applied for PR1224 stops the compiler
authorDuncan Sands <baldrick@free.fr>
Wed, 13 Jun 2007 05:51:31 +0000 (05:51 +0000)
committerDuncan Sands <baldrick@free.fr>
Wed, 13 Jun 2007 05:51:31 +0000 (05:51 +0000)
commitf19f6bb31e45c5fc34b17d89d80ed938f61ff047
tree53f4f2fecd534ab4920b96e1bcd65faf90d89cae
parent93a8e5ea0ccb6fab5cd1a155e62ae73e7dca7d47
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.

So revert the original fix and simply skip invoke values
in the general copying to registers code.  Instead copy
the invoke value to a register in the invoke lowering code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37567 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp