[llvm-bugs] [Bug 41801] New: [ISel] Unused instructions referenced in debug data removed at O0

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 8 09:35:46 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41801

            Bug ID: 41801
           Summary: [ISel] Unused instructions referenced in debug data
                    removed at O0
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: stephen.tozer at sony.com
                CC: llvm-bugs at lists.llvm.org

Using LLVM/clang r360138 and the command line "-c -O0 -x ir" on the IR file
produced by the commands below, the debug data corresponding to "nose.b" and
"boot" is not present in the output object file. The issue appears to occur
during instruction selection, where the following register (which is only used
in debug expressions)is not present in the first pass to output MIR, either
"X86 DAG->DAG Instruction Selection" or "Expand ISel Pseudo-instructions"
depending on platform. This causes debug information to be lost due to an
optimization when -O0 is enabled.

To reproduce:

$ clang -v
clang version 9.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\dev\llvm-project\build\Debug\bin

$ cat reproduce.cpp
struct chin {
        int a;
        int b;
};

int foo(struct chin nose, int more) {
        int shoe = nose.a;
        int boot = nose.b;
        return more;
}

$ clang reproduce.cpp -o - -S -emit-llvm -g -O0 -Xclang -disable-O0-optnone |
opt -sroa -early-cse -S > reproduce.ll


The point at which the debug information for "boot" is lost can then be seen in
the output of the command:

$ clang reproduce.ll -o - -c -g -O0 -x ir -mllvm -print-after-all 2>&1
>/dev/null

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190508/79a79d1a/attachment-0001.html>


More information about the llvm-bugs mailing list