[llvm-bugs] [Bug 37741] New: variable information lost from debug info after combine redundant instructions

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 7 14:52:31 PDT 2018


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

            Bug ID: 37741
           Summary: variable information lost from debug info after
                    combine redundant instructions
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: greg.bedwell at sony.com
                CC: anastasis.gramm2 at gmail.com, ftee at flametop.co.uk,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com, vsk at apple.com

Created attachment 20402
  --> https://bugs.llvm.org/attachment.cgi?id=20402&action=edit
output from clang

I didn't spot this already reported, but as there's been a bit of churn in this
area recently, it's possible I missed it.

Versions:

~~~~~~~~~~~~~
$ clang -v
clang version 7.0.0 (trunk 334224) (llvm/trunk 334232)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: e:\build-yy\Release\bin

$ lldb -v
lldb version 7.0.0 (https://git.llvm.org/git/lldb.git/ revision
e719823776f7d6c645598845be4ea28c5ddfdd70)
  clang revision 334224
  llvm revision 334232
~~~~~~~~~~~~~

source level reproducible
~~~~~~~~~~~~~
$ cat tests\simple_loop_iterator\test.cpp
  struct iterator {

    int index_;
    iterator(int index) : index_(index) {}

    bool operator!=(iterator const &rhs) const { return index_ != rhs.index_; }

    int operator*() { return index_; }

    int operator++() {
      int ret = index_;
      ++index_;
      return ret;
    }
  };

struct item {
  iterator begin() { return iterator(0); }
  iterator end() { return iterator(5); }
};

int main(int argc, char**) {
  item list;
  int total = 0;
  for (volatile auto elem : list)
    total += elem * argc;  // DexWatch('total', 'elem', 'argc')
  return total;
}

// DexExpectWatchValue('elem', '0', '1', '2', '3', '4', on_line=26)
// DexExpectWatchValue('total', '0', '1', '3', '6', on_line=26)
// DexExpectWatchValue('argc', '1', on_line=26)

// DexExpectStepKind('FUNC_EXTERNAL', 0)
// DexExpectStepKind('FUNC_UNKNOWN', 0)
// DexExpectStepKind('UNKNOWN', 0)

~~~~~~~~~~~~~

DExTer observes that pass 237 affects the debugability:

~~~~~~~~~~~~~
pass 236/316 = 0/52 (0.0000, 0.0000) [Bit-Tracking Dead Code Elimination on
function (main)]
pass 237/316 = 18/52 (0.3462, 0.3462) [Combine redundant instructions on
function (main)]
pass 238/316 = 18/52 (0.3462, 0.0000) [Jump Threading on function (main)]‚Äč
~~~~~~~~~~~~~

which comes from the result of evaluating the expression 'total' in the
debugger on line 26 always showing a value of 0.

~~~~~~~~~~~~~
  test.cpp:26 [total] [18/21]
    expected encountered values:
      0

    missing values:
      1 [+6]
      3 [+6]
      6 [+6]
~~~~~~~~~~~~~

We can observe that debugify-each also sees errors from combine redundant
instructions in this case:

~~~~~~~~~~~~~
$ clang -O2 -mllvm -opt-bisect-limit=236 -emit-llvm
tests\simple_loop_iterator\test.cpp -S -o - 2>nul | opt -debugify-each
-disable-output -instcombine
WARNING: Missing line 6
WARNING: Missing line 11
WARNING: Missing line 17
WARNING: Missing line 23
WARNING: Missing line 29
ERROR: Missing variable 4
ERROR: Missing variable 6
ERROR: Missing variable 7
ERROR: Missing variable 9
ERROR: Missing variable 10
ERROR: Missing variable 12
ERROR: Missing variable 13
ERROR: Missing variable 15
CheckFunctionDebugify [Combine redundant instructions]: FAIL
CheckFunctionDebugify [Module Verifier]: PASS
~~~~~~~~~~~~~

I've attached the output from clang in the above command line.  My hope is that
by fixing the errors reported from debugify we'll be able to verify that the
DExTer score improves at the same time.

-- 
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/20180607/75a79b6c/attachment-0001.html>


More information about the llvm-bugs mailing list