<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 --- - O3 pass pipeline does not remove trivial LCSSA node"
   href="https://llvm.org/bugs/show_bug.cgi?id=27620">27620</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>O3 pass pipeline does not remove trivial LCSSA node
          </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>Loop Optimizer
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>me@manueljacob.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>Given this IR:

define i64 @test() {
entry:
  br label %loop

loop:
  %i = phi i64 [ 0, %entry ], [ %inc, %loop ]
  %inc = add i64 %i, 1
  %cond = tail call i1 @check()
  br i1 %cond, label %loop, label %exit

exit:
  ret i64 %i
}

declare i1 @check()


Running opt -S -O3 on it gives the following output:

define i64 @test() {
entry:
  br label %loop

loop:                                             ; preds = %loop, %entry
  %i = phi i64 [ 0, %entry ], [ %inc, %loop ]
  %inc = add i64 %i, 1
  %cond = tail call i1 @check()
  br i1 %cond, label %loop, label %exit

exit:                                             ; preds = %loop
  %i.lcssa = phi i64 [ %i, %loop ]
  ret i64 %i.lcssa
}

declare i1 @check()


Here, the LCSSA pass introduces a trivially removable PHI node in the exit
block.  However, InstCombine (or a similar pass) isn't run after LCSSA in the
pass pipeline.</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>