[llvm-bugs] [Bug 41881] New: [DebugInfo at O2] SimplifyCFG sink splitting drops a variable location

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 15 03:12:55 PDT 2019


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

            Bug ID: 41881
           Summary: [DebugInfo at O2] SimplifyCFG sink splitting drops a
                    variable location
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: wrong-debug
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: jeremy.morse.llvm at gmail.com
                CC: chackz0x12 at gmail.com, greg.bedwell at sony.com,
                    llvm-bugs at lists.llvm.org, orlando.hyams at sony.com,
                    paul.robinson at am.sony.com, stephen.tozer at sony.com
            Blocks: 38768

With llvm/clang r359863, running "clang -emit-llvm -O2 -g -S" on the code
below, the dbg.value representing the assignment of "local = q" is dropped by
SimplifyCFG. From the names of the basic blocks, it would appear to be the
SinkCommonCodeFromPredecessors function that does the dropping.

--------8<--------
volatile int g, *x;

int baz(int p, int q) {
  int local;

  local = p;
  switch (g) {
  case 1:
    x[1] = local;
    g += p;
    break; 
  case 2:
    x[1] += p;
    break;
  case 3:
    local = q;
    g++;
    break;
  }

  return 4 + q;
}
-------->8--------

In this particular test case the impact of dropping the "local=q" assignment is
that the "local=p" assignment dominates all blocks, and an incorrect location
for "local" is produce in the "case 3" and exit block. (Didn't test this as far
as a debugger because I believe the error is fairly clear).


Referenced Bugs:

https://bugs.llvm.org/show_bug.cgi?id=38768
[Bug 38768] [meta][DebugInfo] Umbrella bug for poor debug experiences
-- 
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/20190515/9ff8355b/attachment-0001.html>


More information about the llvm-bugs mailing list