<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 --- - Invariant load still in parameter list even if optimized away"
   href="https://llvm.org/bugs/show_bug.cgi?id=25469">25469</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Invariant load still in parameter list even if optimized away
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Projects
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>Polly
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>polly-dev@googlegroups.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>llvm@meinersbur.de
          </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>In the test case there is a invariant load in while.body and therefore added in
into the scop's parameter list. The loop however, is never executed due to a
constant branch condition and therefor is optimized away in simplifyScop
including the invariant MemoryAccess. Because there is not more MemoryAccess,
hoistInvariantLoad() will never add it to InvariantEquivClasses.

CodeGeneration will still generate code for the (now unused) parameter,
including the load. Because there is no entry in InvariantEquivClasses, it will
use the original value from inside the scop, which causes a domination
verication fail.

I can think of 4 solutions:
- Never remove statements that have accesses before hoistInvariantLoad()
- Remove parameters again that are not used anywhere
- Do not expand SCEVs in CodeGen that uses unkowns from inside the scop
- Do not expand SCEVS in CodeGen that have no use</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>