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

            Bug ID: 41881
           Summary: [DebugInfo@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: unassignedb...@nondot.org
          Reporter: jeremy.morse.l...@gmail.com
                CC: chackz0...@gmail.com, greg.bedw...@sony.com,
                    llvm-bugs@lists.llvm.org, orlando.hy...@sony.com,
                    paul.robin...@am.sony.com, stephen.to...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to