[llvm-bugs] [Bug 33364] New: Assertion `isa<Argument>(Val) && "Unknown live-in to the entry block"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 8 11:56:04 PDT 2017


            Bug ID: 33364
           Summary: Assertion `isa<Argument>(Val) && "Unknown live-in to
                    the entry block"' failed
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Global Analyses
          Assignee: unassignedbugs at nondot.org
          Reporter: warren_ristow at playstation.sony.com
                CC: anna at azul.com, llvm-bugs at lists.llvm.org

Our internal testing hit a compile-time assertion failure with optimization
on trunk:

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
llvm::Value*, llvm::BasicBlock*): Assertion `isa<Argument>(Val) && "Unknown
live-in to the entry block"' failed.

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

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

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: https://reviews.llvm.org/D31189

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170608/a01ad2c5/attachment.html>

More information about the llvm-bugs mailing list