<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [debugify] fails from Combine redundant instructions and SROA"
   href="https://bugs.llvm.org/show_bug.cgi?id=37942">37942</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[debugify] fails from Combine redundant instructions and SROA
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>greg.bedwell@sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>anastasis.gramm2@gmail.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com, sontuan.vu119@gmail.com, vsk@apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20469" name="attach_20469" title="1.ll">attachment 20469</a> <a href="attachment.cgi?id=20469&action=edit" title="1.ll">[details]</a></span>
1.ll

We've been looking at cases where debugify currently fails.  Here is an example
(courtesy of Stephen Wilks) of a test-case that was reduced at source-level
using the condition of "[SROA]: FAIL" being present in the debugify output. 
The reduced output is obviously somewhat silly with the assignment to qaz on
the last line being completely redundant. I sadly don't have time to look more
deeply at the moment, but before going further and reporting more failures I'd
like to verify whether the presence of debugify fails should always be
considered a bug, or whether in some cases a debugify fail could be expected in
the presence of things like completely redundant operations or do we need to
enforce some sanity checking on the testcases before and during reduction
first?  

$ clang --version
clang version 7.0.0 (trunk 335577) (llvm/trunk 335591)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: e:\work\upstream-llvm\build-vs2015-native-ninja\bin

$ cat 1.cpp
int foo(int);
void bar() {
  int baz[6] = {};
  foo(baz[2]);
  long qaz = (long)baz;
}

$ clang -O0 -Xclang -disable-O0-optnone -S -emit-llvm 1.cpp -o 1.ll

$ opt 1.ll -instcombine -sroa -disable-output -debugify-each
WARNING: Missing line 2
WARNING: Missing line 8
WARNING: Missing line 9
WARNING: Missing line 10
ERROR: Missing variable 2
ERROR: Missing variable 8
CheckFunctionDebugify [Combine redundant instructions]: FAIL
ERROR: Instruction with empty DebugLoc in function ?bar@@YAXXZ --  %baz.sroa.2
= alloca [3 x i32]
WARNING: Missing line 1
WARNING: Missing line 2
WARNING: Missing line 4
WARNING: Missing line 5
CheckFunctionDebugify [SROA]: FAIL
CheckFunctionDebugify [Module Verifier]: PASS</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>