Incorrect DebugInfo in MCJIT

Hi all,

In some cases, the debug info of function calls are set incorrectly by Virtual
Register Rewriting Pass.

While lowering the mov instruction that storing the callee's address,
if we have multiple calls to the same function then LLVM will duplicate that
mov instructions including the same DebugInfo. That will generate wrong
DwarfDebufInfo to make gdb confused while stepping in to a function.

The following are experiments with gdb.

Environment:

    clang/llvm executables are built under `cmake -DCMAKE_DEBUG_TYPE=Debug`

The experiment: Use lli/mcjit with debug-info, try to step-in on certain lines
with gdb.

After the Virtual Register Rewriter Pass, in some more complex cases,
during the Machine Instruction level, we can find that on the debug info of
a mov instruction of a function call will be incorrect. That mov instruction
prepares callee address in a X64 register.

When gdb try to step-in to that call, it will stop on the wrong place.

The details of my test cases and MachineInstruction level dumps are as attached.

Steps:

    1. There are two test cases written in C, fib.c and b.c

    2. Compile them with the latest Clang/LLVM (r217182) and LLVM 3.4.2,
       use -g with -O0 optimization level

    3. Record all IR with `-print-after-all` in lli

    4. Use gdb to step in a function call

      clang lli/mcjit

log0.txt (15.7 KB)

fib.c (1.87 KB)

b.c (1.11 KB)

log0_34.txt (15.6 KB)