<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - opt crashes with "opt -simplifycfg -instcombine -loop-rotate -licm -loop-vectorize": Assertion `Idx >= 0 && "Invalid basic block argument!"' failed"
   href="https://llvm.org/bugs/show_bug.cgi?id=31190">31190</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt crashes with "opt -simplifycfg -instcombine -loop-rotate -licm -loop-vectorize": Assertion `Idx >= 0 && "Invalid basic block argument!"' 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>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </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>su@cs.ucdavis.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ clang -v
clang version 4.0.0 (trunk 287994)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

$ clang -c -emit-llvm -o small.bc small.c
$ opt -simplifycfg -instcombine -loop-rotate -licm -loop-vectorize -o
small-opt.bc small.bc
opt: /tmp/llvm-builder/llvm-source-trunk/include/llvm/IR/Instructions.h:2640:
llvm::Value* llvm::PHINode::getIncomingValueForBlock(const llvm::BasicBlock*)
const: Assertion `Idx >= 0 && "Invalid basic block argument!"' failed.
#0 0x0000000001c45c65 (opt+0x1c45c65)
#1 0x0000000001c43d4e (opt+0x1c43d4e)
#2 0x0000000001c43eb0 (opt+0x1c43eb0)
#3 0x00007f3f1ea0a330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f3f1d7f6c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f3f1d7fa028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f3f1d7efbf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f3f1d7efca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000000747c1e (opt+0x747c1e)
#9 0x0000000001cc9214 (opt+0x1cc9214)
#10 0x0000000001d69446 (opt+0x1d69446)
#11 0x0000000001d6b35c (opt+0x1d6b35c)
#12 0x0000000001d6d7b5 (opt+0x1d6d7b5)
#13 0x0000000001d6de46 (opt+0x1d6de46)
#14 0x00000000017e0053 (opt+0x17e0053)
#15 0x00000000017e00fc (opt+0x17e00fc)
#16 0x00000000017e0daa (opt+0x17e0daa)
#17 0x000000000078cfc1 (opt+0x78cfc1)
#18 0x00007f3f1d7e1f45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#19 0x00000000007e756b (opt+0x7e756b)
Stack dump:
0.      Program arguments: opt -simplifycfg -instcombine -loop-rotate -licm
-loop-vectorize -o small-opt.bc small.bc 
1.      Running pass 'Function Pass Manager' on module 'small.bc'.
2.      Running pass 'Loop Vectorization' on function '@fn1'
Aborted (core dumped)



---------------------------------


int a, b[1], c;

void fn1 ()
{
  for (; c; c++)
    for (a = 0; a; a++)
      b[c] = 4;
}

int main ()
{
  fn1 (); 
  return 0; 
}</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>