<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 - Assertion failure with GVNHoist: Assertion `MSSA->dominates(NewDef, FirstDef) && "Should have dominated the new access"' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=36484">36484</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failure with GVNHoist: Assertion `MSSA->dominates(NewDef, FirstDef) && "Should have dominated the new access"' failed.
          </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>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>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>efriedma@codeaurora.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dberlin@dberlin.org, hiraditya@msn.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Testcase (crashes with "opt -gvn-hoist"):

target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"

define void @f(i8* %p) {
entry:
  switch i4 undef, label %if.then30 [
    i4 4, label %if.end
    i4 0, label %if.end
  ]

if.end:
  br label %if.end19

if.end19:
  br i1 undef, label %e, label %e.thread

e.thread:
  store i8 0, i8* %p, align 4
  br label %if.then30

if.then30:
  call void @g()
  unreachable

e:
  store i8 0, i8* %p, align 4
  unreachable
}

declare void @g()



--------------------------------------------------------------------

The issue is related to the MemoryPhi in the block if.then30. 
MemorySSAUpdater::moveTo erases the store in the block e.thread, then erases
the MemoryPHI in if.then30 because it's trivial (temporarily), then tries to
insert a def in if.end19.  fixupDefs then asserts that if.end19 dominates
if.then30, which is not true.

Not sure what the right fix is here.</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>