Closed llvmbot closed 6 years ago
Fix committed in r332309. Thanks for the report.
Fixed by https://reviews.llvm.org/D46445
This triggers a "isTooComplex(PWACtx PWAC)" heuristic, setting an isl object to NULL. A later call wants to know whether the set "NULL" is_empty and therefore causes this assertion failure.
Before we aborted on such an assertion, "NULL".is_empty() followed the code path of an empty set.
And the hash tag of my polly version is: 783cce8f9cbfde.
Extended Description
It happens at -O3 only and requires both "newgvn" and "polly".
$ clang-trunk -v clang version 7.0.0 (trunk 331692) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/bin
$ clang-trunk -mllvm -enable-newgvn -mllvm -polly -O3 abc.c Assertion "!is_error()" failed at /home/absozero/trunk/llvm/tools/polly/lib/External/isl/include/isl/isl-noexceptions.h:66 IMPLEMENTATION ERROR: Unhandled error state Stack dump:
0 0x000000000228988a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/absozero/trunk/root-clang/bin/clang-7+0x228988a)
1 0x000000000228772e llvm::sys::RunSignalHandlers() (/home/absozero/trunk/root-clang/bin/clang-7+0x228772e)
2 0x0000000002287882 SignalHandler(int) (/home/absozero/trunk/root-clang/bin/clang-7+0x2287882)
3 0x00007fa985352330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
4 0x00007fa983ecfc37 gsignal /build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
5 0x00007fa983ed3028 abort /build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
6 0x00000000029c0f15 polly::SCEVAffinator::checkForWrapping(llvm::SCEV const*, std::pair<isl::noexceptions::pw_aff, isl::noexceptions::set>) const (/home/absozero/trunk/root-clang/bin/clang-7+0x29c0f15)
7 0x00000000029c2cd3 polly::SCEVAffinator::visit(llvm::SCEV const*) (/home/absozero/trunk/root-clang/bin/clang-7+0x29c2cd3)
8 0x00000000029c34d0 polly::SCEVAffinator::getPwAff(llvm::SCEV const, llvm::BasicBlock) (/home/absozero/trunk/root-clang/bin/clang-7+0x29c34d0)
9 0x0000000002968cb6 polly::Scop::getPwAff(llvm::SCEV const, llvm::BasicBlock, bool) (/home/absozero/trunk/root-clang/bin/clang-7+0x2968cb6)
10 0x000000000297be2a getPwAff(polly::Scop&, llvm::BasicBlock, llvm::DenseMap<llvm::BasicBlock, isl::noexceptions::set, llvm::DenseMapInfo<llvm::BasicBlock>, llvm::detail::DenseMapPair<llvm::BasicBlock, isl::noexceptions::set> >&, llvm::SCEV const*, bool) (/home/absozero/trunk/root-clang/bin/clang-7+0x297be2a)
11 0x000000000297c9ff buildConditionSets(polly::Scop&, llvm::BasicBlock, llvm::Value, llvm::TerminatorInst, llvm::Loop, isl_set, llvm::DenseMap<llvm::BasicBlock, isl::noexceptions::set, llvm::DenseMapInfo<llvm::BasicBlock>, llvm::detail::DenseMapPair<llvm::BasicBlock, isl::noexceptions::set> >&, llvm::SmallVectorImpl<isl_set*>&) (/home/absozero/trunk/root-clang/bin/clang-7+0x297c9ff)
12 0x000000000297cb9c buildConditionSets(polly::Scop&, llvm::BasicBlock, llvm::TerminatorInst, llvm::Loop, isl_set, llvm::DenseMap<llvm::BasicBlock, isl::noexceptions::set, llvm::DenseMapInfo<llvm::BasicBlock>, llvm::detail::DenseMapPair<llvm::BasicBlock, isl::noexceptions::set> >&, llvm::SmallVectorImpl<isl_set>&) (/home/absozero/trunk/root-clang/bin/clang-7+0x297cb9c)
13 0x0000000002986696 polly::Scop::buildDomainsWithBranchConstraints(llvm::Region, llvm::DominatorTree&, llvm::LoopInfo&, llvm::DenseMap<llvm::BasicBlock, isl::noexceptions::set, llvm::DenseMapInfo<llvm::BasicBlock>, llvm::detail::DenseMapPair<llvm::BasicBlock, isl::noexceptions::set> >&) (/home/absozero/trunk/root-clang/bin/clang-7+0x2986696)
14 0x0000000002985b92 polly::Scop::buildDomainsWithBranchConstraints(llvm::Region, llvm::DominatorTree&, llvm::LoopInfo&, llvm::DenseMap<llvm::BasicBlock, isl::noexceptions::set, llvm::DenseMapInfo<llvm::BasicBlock>, llvm::detail::DenseMapPair<llvm::BasicBlock, isl::noexceptions::set> >&) (/home/absozero/trunk/root-clang/bin/clang-7+0x2985b92)
15 0x0000000002986f3f polly::Scop::buildDomains(llvm::Region, llvm::DominatorTree&, llvm::LoopInfo&, llvm::DenseMap<llvm::BasicBlock, isl::noexceptions::set, llvm::DenseMapInfo<llvm::BasicBlock>, llvm::detail::DenseMapPair<llvm::BasicBlock, isl::noexceptions::set> >&) (/home/absozero/trunk/root-clang/bin/clang-7+0x2986f3f)
16 0x0000000002992c0a polly::ScopBuilder::buildScop(llvm::Region&, llvm::AssumptionCache&, llvm::OptimizationRemarkEmitter&) (/home/absozero/trunk/root-clang/bin/clang-7+0x2992c0a)
17 0x000000000299381a polly::ScopBuilder::ScopBuilder(llvm::Region*, llvm::AssumptionCache&, llvm::AAResults&, llvm::DataLayout const&, llvm::DominatorTree&, llvm::LoopInfo&, polly::ScopDetection&, llvm::ScalarEvolution&, llvm::OptimizationRemarkEmitter&) (/home/absozero/trunk/root-clang/bin/clang-7+0x299381a)
18 0x000000000297759a polly::ScopInfoRegionPass::runOnRegion(llvm::Region*, llvm::RGPassManager&) (/home/absozero/trunk/root-clang/bin/clang-7+0x297759a)
19 0x000000000189e463 llvm::RGPassManager::runOnFunction(llvm::Function&) (/home/absozero/trunk/root-clang/bin/clang-7+0x189e463)
20 0x0000000001d88c83 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/absozero/trunk/root-clang/bin/clang-7+0x1d88c83)
21 0x0000000001d88d4c llvm::FPPassManager::runOnModule(llvm::Module&) (/home/absozero/trunk/root-clang/bin/clang-7+0x1d88d4c)
22 0x0000000001d8881d llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/absozero/trunk/root-clang/bin/clang-7+0x1d8881d)
23 0x000000000245c500 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete >) (/home/absozero/trunk/root-clang/bin/clang-7+0x245c500)
24 0x000000000245ddb1 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete >) (/home/absozero/trunk/root-clang/bin/clang-7+0x245ddb1)
25 0x0000000002cd0297 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/absozero/trunk/root-clang/bin/clang-7+0x2cd0297)
26 0x00000000031ff780 clang::ParseAST(clang::Sema&, bool, bool) (/home/absozero/trunk/root-clang/bin/clang-7+0x31ff780)
27 0x0000000002ccf64c clang::CodeGenAction::ExecuteAction() (/home/absozero/trunk/root-clang/bin/clang-7+0x2ccf64c)
28 0x00000000028674be clang::FrontendAction::Execute() (/home/absozero/trunk/root-clang/bin/clang-7+0x28674be)
29 0x0000000002832a76 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/absozero/trunk/root-clang/bin/clang-7+0x2832a76)
30 0x00000000028fbf90 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/absozero/trunk/root-clang/bin/clang-7+0x28fbf90)
31 0x0000000000aaba88 cc1_main(llvm::ArrayRef<char const>, char const, void*) (/home/absozero/trunk/root-clang/bin/clang-7+0xaaba88)
32 0x0000000000a1b69c main (/home/absozero/trunk/root-clang/bin/clang-7+0xa1b69c)
33 0x00007fa983ebaf45 __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
34 0x0000000000aa7b49 _start (/home/absozero/trunk/root-clang/bin/clang-7+0xaa7b49)
clang-7: error: unable to execute command: Aborted (core dumped) clang-7: error: clang frontend command failed due to signal (use -v to see invocation) clang version 7.0.0 (trunk 331692) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/bin clang-7: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script. clang-7: 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: note: diagnostic msg: /tmp/abc-e41e58.c clang-7: note: diagnostic msg: /tmp/abc-e41e58.sh clang-7: note: diagnostic msg:
$ cat abc.c int a; short b, c; long d, e, h, i; char f, g; void fn1() { d = 0; for (; d <= 40; d++) b -= b > 0; for (; c;) { for (; i; i++) { a = (f ? b : h) ? 0 : g; f = 0; } for (; e;) ; } }