<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 - instcombine folds branchs on constant conditions to undef"
   href="https://bugs.llvm.org/show_bug.cgi?id=33409">33409</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>instcombine folds branchs on constant conditions to undef
          </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>All
          </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>davide@freebsd.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dberlin@dberlin.org, llvm-bugs@lists.llvm.org, nunoplopes@sapo.pt, regehr@cs.utah.edu, sanjoy@playingwithpointers.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is something I found out while debugging another MemSSA problem. Not a
proper bug, but something I found surprising.

Given: 

@b = external global i32

define void @patatino() {
for.cond:
  br i1 true, label %if.end, label %for.inc

if.end:                                           ; preds = %for.cond
  %tinkywinky = load i32, i32* @b
  br i1 true, label %for.inc, label %for.inc

for.inc:                                          ; preds = %if.end, %if.end,
%for.cond
  ret void
}

The terminator in `if.end`  after instcombine becomes:
`  br i1 undef, label %for.inc, label %for.inc `

IC: Visiting:   br i1 true, label %for.inc, label %for.inc
IC: Mod =   br i1 true, label %for.inc, label %for.inc
    New =   br i1 undef, label %for.inc, label %for.inc


This transformation is not useful. Replacing true with undef doesn't really
help anything (SimplifyCFG should be able to fold branches when the condition
is constant).</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>