<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 - [X86] error in backend: "Cannot select: t203: v8i32 = BUILD_VECTOR MOV32r0:i32,i32" after r327898"
   href="https://bugs.llvm.org/show_bug.cgi?id=36865">36865</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[X86] error in backend: "Cannot select: t203: v8i32 = BUILD_VECTOR MOV32r0:i32,i32" after r327898
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ilia.taraban@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This test fails at compilation with "Cannot select: t203: v8i32 = BUILD_VECTOR
MOV32r0:i32,i32" in "X86 DAG->DAG Instruction Selection" on haswell:

================= nice.c ==============
unsigned int l, k;
int main () {
  unsigned int i, j, m;
  unsigned int a [40] = {0};
  unsigned int * pl = & l;
  scanf("%u", & m);
  for (i = 1; i < 20; ++i) 
    k += a[i];
  for (j = 38; j > 1; --j) {
    * pl += l;
    a[j] = m - (m * m);
  }
  return 0;
}

=======================================

<span class="quote">>>> clang -v</span >
clang version 7.0.0 (trunk 328186)
Target: x86_64-unknown-linux-gnu
Thread model: posix
...

<span class="quote">>>> clang nice.c -O2 -march=haswell</span >
fatal error: error in backend: Cannot select: t203: v8i32 = BUILD_VECTOR
MOV32r0:i32,i32, MOV32r0:i32,i32, MOV32r0:i32,i32, MOV32r0:i32,i32,
MOV32r0:i32,i32, MOV32r0:i32,i32,
      MOV32r0:i32,i32, MOV32r0:i32,i32
  t202: i32,i32 = MOV32r0
  t202: i32,i32 = MOV32r0
  t202: i32,i32 = MOV32r0
  t202: i32,i32 = MOV32r0
  t202: i32,i32 = MOV32r0
  t202: i32,i32 = MOV32r0
  t202: i32,i32 = MOV32r0
  t202: i32,i32 = MOV32r0
In function: main
clang-7.0: error: clang frontend command failed with exit code 70 (use -v to
see invocation)
clang version 7.0.0 (trunk 328186)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: .../last_debug/bin
clang-7.0: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
clang-7.0: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-7.0: note: diagnostic msg: /tmp/nice-e7c2be.c
clang-7.0: note: diagnostic msg: /tmp/nice-e7c2be.sh
clang-7.0: note: diagnostic msg:

********************


<span class="quote">>>> clang nice.c -O2 -march=haswell -mllvm -opt-bisect-limit=-1</span >
BISECT: running pass (102) CodeGen Prepare on function (main)
BISECT: running pass (103) X86 DAG->DAG Instruction Selection on function
(main)
fatal error: error in backend: Cannot select: t203: v8i32 = BUILD_VECTOR
MOV32r0:i32,i32, MOV32r0:i32,i32, MOV32r0:i32,i32, MOV32r0:i32,i32,
MOV32r0:i32,i32, MOV32r0:i32,i32,
      MOV32r0:i32,i32, MOV32r0:i32,i32
  t202: i32,i32 = MOV32r0
...

Here is "small" reproducer for llc:
================= fine.ll =============
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind uwtable
define void @main() #0 {
entry:
  %k = alloca i32, align 4
  %m = alloca i32, align 4
  %a = alloca [100 x i32], align 16
  %0 = bitcast [100 x i32]* %a to i8*
  call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %0, i8 0, i64 400, i1
false)
  %arrayidx = getelementptr inbounds [100 x i32], [100 x i32]* %a, i64 0, i64
34
  %add = load i32, i32* %k
  %1 = load i32, i32* null
  %2 = load i32, i32* undef
  %3 = load i32, i32* undef
  %4 = load i32, i32* %arrayidx
  %5 = load i32, i32* undef
  %6 = load i32, i32* undef
  %7 = load i32, i32* undef
  %8 = load i32, i32* undef
  %9 = load i32, i32* undef
  %10 = load i32, i32* undef
  %11 = load i32, i32* undef
  %12 = load i32, i32* undef
  %13 = load i32, i32* undef
  %14 = load i32, i32* undef
  %15 = load i32, i32* undef
  %16 = load i32, i32* undef
  %add.1 = add i32 %add, %1
  %add.2 = add i32 %add.1, %2
  %add.3 = add i32 %add.2, %3
  %add.4 = add i32 %add.3, %4
  store i32 %add.4, i32* %k
  %17 = load i32, i32* %m
  %mul = mul i32 %17, %17
  %sub = sub i32 %17, %mul
  store i32 %sub, i32* undef
  unreachable
}

; Function Attrs: argmemonly nounwind
declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1) #1

attributes #0 = { nounwind uwtable "target-features"="+avx" }
attributes #1 = { argmemonly nounwind }
=======================================

<span class="quote">>>> llc fine.ll</span >
LLVM ERROR: Cannot select: t75: v8i32 = BUILD_VECTOR MOV32r0:i32,i32,
MOV32r0:i32,i32, MOV32r0:i32,i32, MOV32r0:i32,i32, MOV32r0:i32,i32,
MOV32r0:i32,i32, MOV32r0:i32,i32, MOV32r0:i32,i32
  t74: i32,i32 = MOV32r0
  t74: i32,i32 = MOV32r0
  t74: i32,i32 = MOV32r0
  t74: i32,i32 = MOV32r0
  t74: i32,i32 = MOV32r0
  t74: i32,i32 = MOV32r0
  t74: i32,i32 = MOV32r0
  t74: i32,i32 = MOV32r0
In function: main

This error appears after r327898:
------------------------------------------------------------------------
r327898 | niravd | 2018-03-19 21:19:46 +0100 (Mon, 19 Mar 2018) | 4 lines

[DAG, X86] Revert r327197 "Revert r327170, r327171, r327172"

Reland ISel cycle checking improvements after simplifying node id
invariant traversal and correcting typo.
------------------------------------------------------------------------</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>