llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.92k stars 11.52k forks source link

polly crashes with "opt -polly-canonicalize -polly-codegen -adce -polly-codegen" while running pass 'Polly - Detect static control parts (SCoPs)' #33791

Open zhendongsu opened 7 years ago

zhendongsu commented 7 years ago
Bugzilla Link 34443
Version unspecified
OS All
CC @tobiasgrosser

Extended Description

$ clangpolly -v clang version 6.0.0 (http://llvm.org/git/clang.git fc6ac77722c6bdc2508229af6f8aebfebe02f0fa) (http://llvm.org/git/llvm.git 1ee1fb604621025bd2b1a681a09ab54ff69623d1) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /home/su/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 $ $ clangpolly -O3 -mllvm -disable-llvm-optzns -c -emit-llvm -o small.bc small.c $ optpolly -polly-canonicalize -polly-codegen -adce -polly-codegen -o small-opt.bc small.bc optpolly: /home/su/software/tmp/polly/llvm/include/llvm/Analysis/RegionInfoImpl.h:353: typename Tr::RegionNodeT llvm::RegionBase::getNode(llvm::RegionBase::BlockT) const [with Tr = llvm::RegionTraits; typename Tr::RegionNodeT = llvm::RegionNode; llvm::RegionBase::BlockT = llvm::BasicBlock]: Assertion `contains(BB) && "Can get BB node out of this region!"' failed.

​0 0x00000000038af81a (optpolly+0x38af81a)

​1 0x00000000038af8ab (optpolly+0x38af8ab)

​2 0x00000000038adcc0 (optpolly+0x38adcc0)

​3 0x00000000038af19d (optpolly+0x38af19d)

​4 0x00007f9b5bb10330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)

​5 0x00007f9b5a8f8c37 gsignal /build/eglibc-SvCtMH/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0

​6 0x00007f9b5a8fc028 abort /build/eglibc-SvCtMH/eglibc-2.19/stdlib/abort.c:91:0

​7 0x00007f9b5a8f1bf6 __assert_fail_base /build/eglibc-SvCtMH/eglibc-2.19/assert/assert.c:92:0

​8 0x00007f9b5a8f1ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)

​9 0x0000000002aaf967 (optpolly+0x2aaf967)

​10 0x0000000002abe1ea (optpolly+0x2abe1ea)

​11 0x0000000002abb0f7 (optpolly+0x2abb0f7)

​12 0x0000000002ab7a07 (optpolly+0x2ab7a07)

​13 0x0000000002ab4952 (optpolly+0x2ab4952)

​14 0x0000000002aafd91 (optpolly+0x2aafd91)

​15 0x0000000003bf0c0f (optpolly+0x3bf0c0f)

​16 0x0000000003bf0a1a (optpolly+0x3bf0a1a)

​17 0x0000000003bf0a1a (optpolly+0x3bf0a1a)

​18 0x0000000003bf0a1a (optpolly+0x3bf0a1a)

​19 0x0000000003bf0a1a (optpolly+0x3bf0a1a)

​20 0x0000000003bebabf (optpolly+0x3bebabf)

​21 0x0000000003bf2a39 (optpolly+0x3bf2a39)

​22 0x0000000003193bcc (optpolly+0x3193bcc)

​23 0x0000000003193d5f (optpolly+0x3193d5f)

​24 0x00000000031940fa (optpolly+0x31940fa)

​25 0x0000000003194851 (optpolly+0x3194851)

​26 0x0000000003194a91 (optpolly+0x3194a91)

​27 0x00000000017fe118 (optpolly+0x17fe118)

​28 0x00007f9b5a8e3f45 __libc_start_main /build/eglibc-SvCtMH/eglibc-2.19/csu/libc-start.c:321:0

​29 0x00000000017d7a29 (optpolly+0x17d7a29)

Stack dump:

  1. Program arguments: optpolly -polly-canonicalize -polly-codegen -adce -polly-codegen -o small-opt.bc small.bc
  2. Running pass 'Function Pass Manager' on module 'small.bc'.
  3. Running pass 'Polly - Detect static control parts (SCoPs)' on function '@foo' Aborted (core dumped) $

int a, b, c, d, e;

void foo () { for (d = 0; d; d++) { int g; if (c) while (a) return; else { if (b) continue; while (e) ; } } }

int main () { foo (); return 0; }

tobiasgrosser commented 7 years ago

That's perfect. Thanks a lot!

zhendongsu commented 7 years ago

Thank you. This one is useful, but not urgent as this pass order will never happen in practice.

Understood, Tobias. I just report whatever I can find, and you may decide their relative importance.

tobiasgrosser commented 7 years ago

Thank you. This one is useful, but not urgent as this pass order will never happen in practice.