DebugInfo: Missing non-trivially-copyable parameters in SelectionDAG

This is a bit premature to be considered a code review, but given how
unfamiliar I am with SelectionDAG (& that I'm seeing somewhat more
'interesting' results compared to my change to FastISel) I wanted to
get a bit of feedback to see if I was on the right track or had missed
any obvious cases.

I've attached my patch in progress (including a modification to the
existing test case to demonstrate the missing parameter problem on
i386 (though it also turns up in x86-64 in cases where the
SelectionDAG kicks in, the simplest of which was "foo func(foo f, foo
g) { return f; }" and 'g' goes missing)) and a log of the output of
failing tests.

Several of them seem to be (to my eye) minor perturbations of
instruction selection or register allocation. Do these look like
they're within the realm of reasonable changes in behavior from my
change or is something really broken? (there's one test that seems
more problematic & is giving "Bad machine code: Non-terminator
instruction after the first terminator" errors - but it /looks/ like
that could be reproduced without the unused parameters & without my
change, but that's just my own naive guess.

output.txt (65.9 KB)

debug_missing_param_selectiondag.diff (5.48 KB)

I ran into this problem about 4 years ago while working on the AMDIL backend. I don't think I ever got around to solving it, but I did have some hacky work-arounds that would look at the IR itself and processes the arguments instead of looking at the MachineFunction/DAG code. As far as I can tell, this has not been fixed and is still a warning in the AMD SDK release notes.