<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 - [InlineCost] Failure to Map a PHI to a Constant"
   href="https://bugs.llvm.org/show_bug.cgi?id=34223">34223</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[InlineCost] Failure to Map a PHI to a Constant
          </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>enhancement
          </td>
        </tr>

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

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

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

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

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>If a callee has IR like this

entry:
  switch i32 %arg, label %end.switch [
    i32 1, label %sw.bb1
    i32 2, label %sw.bb2
    ......
    i32 N, label %sw.bbN
  ]

sw.bb1:                                           ; preds = %entry
  ...

sw.bb2:                                           ; preds = %entry
  ...
  ...
sw.bbN:                                           ; preds = %entry
  ...

switch.end:                                       ; preds = %sw.1,
%sw.2,...,%sw.N
  %ph = phi i32 [ 1, %sw.bb1 ], [ 2, %sw.bb2 ], ..., [N, %sw.bbN]

The switch condition is a function argument which is a constant from all the
callsites.  Then, the phi in switch.end can be mapped to a constant since its
incoming block is known.  In my specific test case, the rest of the callee is
relied on %ph and can be proved to be free if %ph can be mapped to a constant.
Currently, InlineCost does not consider the possibility of phi-constant
mapping.</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>