<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - SROA Assertion `isAllocaPromotable(AI) && "Cannot promote non-promotable alloca!"' failed. 3.7+"
   href="https://llvm.org/bugs/show_bug.cgi?id=27999">27999</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SROA Assertion `isAllocaPromotable(AI) && "Cannot promote non-promotable alloca!"' failed. 3.7+
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>adrake@adrake.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16469" name="attach_16469" title="Source code for test case">attachment 16469</a> <a href="attachment.cgi?id=16469&action=edit" title="Source code for test case">[details]</a></span>
Source code for test case

I encountered this crash first in rustc, I was able to reduce the output to a
seven instruction testcase isolating the bug to the SROA pass. This test
command:

opt -sroa to_submit.ll

Crashes with:

/home/adrake/osrc/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:531:
void {anonymous}::PromoteMem2Reg::run(): Assertion `isAllocaPromotable(AI) &&
"Cannot promote non-promotable alloca!"' failed

Both on LLVM trunk@271371 and on rustc's fork of 3.8. That same test case
crashes Fedora's 3.7 build with:

Instruction does not dominate all uses!
  <badref> = bitcast #0 0x7f221dec8327
llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib64/llvm/libLLVM-3.7.so+0x510327)

That is not a debug build, so it is possible it would hit a similar assertion
before producing non-validating bitcode output.

I've attached bitcode files produced by my trunk build (to_submit39.bc) as well
as Fedora's 3.7 build (to_submit37.bc) for reference. I've also attached the
debug log from the trunk run (to_submit39.log). I am running on and targeting
x86_64

Please let me know if you need any more information! I am happy to run any
additional tests or provide additional data if needed.</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>