| Issue |
209005
|
| Summary |
clang crashes on valid code at -O3 on x86_64-linux-gnu: Assertion `all_of(Bundles, [](const ScheduleBundle *Bundle) { return Bundle->isScheduled(); }) && "must be scheduled at this point"' failed
|
| Labels |
|
| Assignees |
|
| Reporter |
zhendongsu
|
Compiler Explorer: https://godbolt.org/z/sx1fb9Ysa
Note:
- fails: trunk
- works: 22.1.0 and earlier
```
[567] % clangtk -v
clang version 23.0.0git (https://github.com/llvm/llvm-project.git 184d97baded92622778a701b66e7f148903f3525)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/home/suz/suz-local/software/local/clang-trunk/bin
Build config: +assertions
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda, version 12.1
[568] %
[568] % clangtk -O3 -c -w small.c
clangtk: /local/suz-local/software/clangbuild/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:27004: void llvm::slpvectorizer::BoUpSLP::scheduleBlock(const llvm::slpvectorizer::BoUpSLP&, llvm::slpvectorizer::BoUpSLP::BlockScheduling*): Assertion `all_of(Bundles, [](const ScheduleBundle *Bundle) { return Bundle->isScheduled(); }) && "must be scheduled at this point"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0. Program arguments: clangtk -I/usr/local/include -I/local/suz-local/software/local/include -O3 -c -w small.c
1. <eof> parser at end of file
2. Optimizer
3. Running pass "function<eager-inv>(drop-unnecessary-assumes,float2int,lower-constant-intrinsics,chr,loop(loop-rotate<header-duplication;no-prepare-for-lto;check-exit-count>,loop-deletion),loop-distribute,inject-tli-mappings,loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,drop-unnecessary-assumes,infer-alignment,loop-load-elim,instcombine<max-iterations=1;no-verify-fixpoint>,simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,slp-vectorizer,vector-combine,instcombine<max-iterations=1;no-verify-fixpoint>,loop-unroll<O3>,transform-warning,sroa<preserve-cfg;aggregate-to-vector>,infer-alignment,instcombine<max-iterations=1;no-verify-fixpoint>,loop-mssa(licm<allowspeculation>),alignment-from-assumptions,loop-sink,instsimplify,div-rem-pairs,mergeicmps,expand-memcmp,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>)" on module "small.c"
4. Running pass "slp-vectorizer" on function "d"
#0 0x000055c936be6819 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x44cc819)
#1 0x000055c936be34ec llvm::sys::RunSignalHandlers() (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x44c94ec)
#2 0x000055c936be3d98 llvm::sys::CleanupOnSignal(unsigned long) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x44c9d98)
#3 0x000055c936b1d6d8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#4 0x00007f82364ef520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#5 0x00007f82365439fc __pthread_kill_implementation ./nptl/./nptl/pthread_kill.c:44:76
#6 0x00007f82365439fc __pthread_kill_internal ./nptl/./nptl/pthread_kill.c:78:10
#7 0x00007f82365439fc pthread_kill ./nptl/./nptl/pthread_kill.c:89:10
#8 0x00007f82364ef476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#9 0x00007f82364d57f3 abort ./stdlib/./stdlib/abort.c:81:7
#10 0x00007f82364d571b _nl_load_domain ./intl/./intl/loadmsgcat.c:1177:9
#11 0x00007f82364e6e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#12 0x000055c9389b0865 llvm::slpvectorizer::BoUpSLP::scheduleBlock(llvm::slpvectorizer::BoUpSLP const&, llvm::slpvectorizer::BoUpSLP::BlockScheduling*) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x6296865)
#13 0x000055c9389c67fb llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::SmallDenseSet<llvm::Value*, 4u, llvm::DenseMapInfo<llvm::Value*, void> > const&, llvm::Instruction*, llvm::ArrayRef<std::tuple<llvm::WeakTrackingVH, unsigned int, bool, bool> >) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x62ac7fb)
#14 0x000055c9389cabc1 llvm::slpvectorizer::BoUpSLP::vectorizeTree() (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x62b0bc1)
#15 0x000055c9389dee63 llvm::SLPVectorizerPass::tryToVectorizeList(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP&, bool, bool) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x62c4e63)
#16 0x000055c9389c56b9 bool tryToVectorizeSequence<llvm::Value>(llvm::SmallVectorImpl<llvm::Value*>&, llvm::function_ref<bool (llvm::Value*, llvm::Value*)>, llvm::function_ref<bool (llvm::ArrayRef<llvm::Value*>, llvm::Value*)>, llvm::function_ref<bool (llvm::ArrayRef<llvm::Value*>, bool)>, bool, llvm::slpvectorizer::BoUpSLP&) SLPVectorizer.cpp:0:0
#17 0x000055c9389e80cb llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x62ce0cb)
#18 0x000055c9389eec7a llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (.part.0) SLPVectorizer.cpp:0:0
#19 0x000055c9389efa11 llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x62d5a11)
#20 0x000055c937e935a6 llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x57795a6)
#21 0x000055c9364ebee1 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x3dd1ee1)
#22 0x000055c933a6cae6 llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x1352ae6)
#23 0x000055c9364ea0b1 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x3dd00b1)
#24 0x000055c933a6d1d6 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x13531d6)
#25 0x000055c9364eaad9 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x3dd0ad9)
#26 0x000055c93701955e (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile> >&, clang::BackendConsumer*) BackendUtil.cpp:0:0
#27 0x000055c93701bc94 (anonymous namespace)::EmitAssemblyHelper::emitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >, clang::BackendConsumer*) BackendUtil.cpp:0:0
#28 0x000055c93701dd08 clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >, clang::BackendConsumer*) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x4903d08)
#29 0x000055c937706b3a clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x4fecb3a)
#30 0x000055c93924186c clang::ParseAST(clang::Sema&, bool, bool) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x6b2786c)
#31 0x000055c937a617a1 clang::FrontendAction::Execute() (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x53477a1)
#32 0x000055c9379eb3b5 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x52d13b5)
#33 0x000055c937b3d463 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x5423463)
#34 0x000055c93355fd26 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0xe45d26)
#35 0x000055c93355582a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#36 0x000055c9335559bf int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)>(long, llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#37 0x000055c937783c5d void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#38 0x000055c936b1daf0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x4403af0)
#39 0x000055c937784ab3 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (.part.0) Job.cpp:0:0
#40 0x000055c93773a377 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x5020377)
#41 0x000055c93773ebd0 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&, bool) const (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x5024bd0)
#42 0x000055c93774c7e4 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x50327e4)
#43 0x000055c93355b193 clang_main(int, char**, llvm::ToolContext const&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0xe41193)
#44 0x000055c9334762e1 main (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0xd5c2e1)
#45 0x00007f82364d6d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#46 0x00007f82364d6e40 call_init ./csu/../csu/libc-start.c:128:20
#47 0x00007f82364d6e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#48 0x000055c933554e55 _start (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0xe3ae55)
clangtk: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 23.0.0git (https://github.com/llvm/llvm-project.git 184d97baded92622778a701b66e7f148903f3525)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/home/suz/suz-local/software/local/clang-trunk/bin
Build config: +assertions
clangtk: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING CRASH REPRODUCER FILES TO THE BUG REPORT:
clangtk: note: diagnostic msg: /tmp/small-706234.c
clangtk: note: diagnostic msg: /tmp/small-706234.sh
clangtk: note: diagnostic msg:
********************
Aborted
```
```
int a;
float b, *c;
void d() {
int e, *i = &e;
float f, g, h;
c = &b;
*i = 0;
j:
k:
b = 6 + (float)e;
h = 8.0f * b + 2.5f * b;
if (!h)
__builtin_abort();
if (!(2 ^ e))
goto j;
e = a - 1;
b = e + (float)e;
if (b)
__builtin_abort();
*c = e;
if (~e == 0)
goto m;
b = 3.75f + a;
if (__builtin_isfinite(b))
g = 0 + 0.25f * b;
if (g)
m:
f = b + 0.5f * b;
if (f)
__builtin_abort();
if (*i == 0)
return;
goto k;
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs