<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 `isa<Argument>(Val) && "Unknown live-in to the entry block"' failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=33364">33364</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion `isa<Argument>(Val) && "Unknown live-in to the entry block"' 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>Global Analyses
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>warren_ristow@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>anna@azul.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Our internal testing hit a compile-time assertion failure with optimization
on trunk:

Using:
clang version 5.0.0 (trunk 304995)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ cat test.cpp
// ======================================================
typedef char char2 __attribute__((ext_vector_type(2)));
char2 a, b;
int c;
int foo() {
  char2 d = {1};
  char2 f = a;
  for (int g = 0; g < c; ++g)
    d = b;
  char2 h = d <= 0;
  char2 i = f & h;
  return i[0] + i[1];
}
// ======================================================
$

It fails at -O1 or higher:

$ clang++ -c -O1 -c test.cpp
clang++: /home/warren/Upstream/llvm/lib/Analysis/LazyValueInfo.cpp:890: bool
{anonymous}::LazyValueInfoImpl::solveBlockValueNonLocal({anonymous}::LVILatticeVal&,
llvm::Value*, llvm::BasicBlock*): Assertion `isa<Argument>(Val) && "Unknown
live-in to the entry block"' failed.
  ...
$

We've bisected it to r298845
( <a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=298845">http://llvm.org/viewvc/llvm-project?view=revision&revision=298845</a> ):

~~
[InstCombine] Avoid incorrect folding of select into phi nodes when incoming
  element is a vector type

Summary:
We are incorrectly folding selects into phi nodes when the incoming value of a
phi node is a constant vector. This optimization is done in `FoldOpIntoPhi`
when the select condition is a phi node with constant incoming values.
Without the fix, we are miscompiling (i.e. incorrectly folding the select into
the phi node) when the vector contains non-zero elements.
This patch fixes the miscompile and we will correctly fold based on the
select vector operand (see added test cases).

Reviewers: majnemer, sanjoy, spatel

Subscribers: llvm-commits

Differential Revision: <a href="https://reviews.llvm.org/D31189">https://reviews.llvm.org/D31189</a>
~~</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>