<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54465>54465</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang crashes at -Os and above on x86_64-linux-gnu: Assertion `DepDest && "must be in schedule window"' failed
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zhendongsu
</td>
</tr>
</table>
<pre>
This appears to be a recent regression from 13.0.1.
```
[507] % clangtk -v
clang version 15.0.0 (https://github.com/llvm/llvm-project.git 973183612ea26bdc2394863f38a46514c33dc026)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/opfuzz/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
[508] %
[508] % clangtk -O1 small.c; ./a.out
[509] %
[509] % clangtk -Os small.c
clang-15: /local/suz-local/software/clangbuild/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:8074: void llvm::slpvectorizer::BoUpSLP::BlockScheduling::calculateDependencies(llvm::slpvectorizer::BoUpSLP::ScheduleData*, bool, llvm::slpvectorizer::BoUpSLP*): Assertion `DepDest && "must be in schedule window"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /local/suz-local/software/local/clang-trunk/bin/clang-15 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj --mrelax-relocations -disable-free -clear-ast-before-backend -main-file-name small.c -mrelocation-model static -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -fcoverage-compilation-dir=/local/suz-local/software/emitesting/bugs/20220320-clangtk-m64-O3-mllvm-enable-constraint-elimination-build-142423/delta -resource-dir /local/suz-local/software/local/clang-trunk/lib/clang/15.0.0 -I /usr/local/include/csmith -I /local/suz-local/software/local/include -internal-isystem /local/suz-local/software/local/clang-trunk/lib/clang/15.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Os -fdebug-compilation-dir=/local/suz-local/software/emitesting/bugs/20220320-clangtk-m64-O3-mllvm-enable-constraint-elimination-build-142423/delta -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/small-ef3c77.o -x c small.c
1. <eof> parser at end of file
2. Optimizer
#0 0x0000563502e2a04f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x0000563502e27abc SignalHandler(int) Signals.cpp:0:0
#2 0x00007fc006be38a0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
#3 0x00007fc005894f47 raise /build/glibc-2ORdQG/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#4 0x00007fc0058968b1 abort /build/glibc-2ORdQG/glibc-2.27/stdlib/abort.c:81:0
#5 0x00007fc00588642a __assert_fail_base /build/glibc-2ORdQG/glibc-2.27/assert/assert.c:89:0
#6 0x00007fc0058864a2 (/lib/x86_64-linux-gnu/libc.so.6+0x304a2)
#7 0x000056350309c5ef llvm::slpvectorizer::BoUpSLP::BlockScheduling::calculateDependencies(llvm::slpvectorizer::BoUpSLP::ScheduleData*, bool, llvm::slpvectorizer::BoUpSLP*) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x3d495ef)
#8 0x00005635005deeab llvm::slpvectorizer::BoUpSLP::BlockScheduling::tryScheduleBundle(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP*, (anonymous namespace)::InstructionsState const&)::'lambda'(bool, llvm::slpvectorizer::BoUpSLP::ScheduleData*)::operator()(bool, llvm::slpvectorizer::BoUpSLP::ScheduleData*) const SLPVectorizer.cpp:0:0
#9 0x00005635030a201b llvm::slpvectorizer::BoUpSLP::buildTree_rec(llvm::ArrayRef<llvm::Value*>, unsigned int, llvm::slpvectorizer::BoUpSLP::EdgeInfo const&) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x3d4f01b)
#10 0x00005635030a5b95 llvm::slpvectorizer::BoUpSLP::buildTree(llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::Value*>) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x3d52b95)
#11 0x00005635030afaf0 llvm::SLPVectorizerPass::tryToVectorizeList(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP&, bool) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x3d5caf0)
#12 0x00005635030b5646 llvm::SLPVectorizerPass::vectorizeSimpleInstructions(llvm::SmallVectorImpl<llvm::Instruction*>&, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, bool) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x3d62646)
#13 0x00005635030b7399 llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x3d64399)
#14 0x00005635030b9d7d llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (.part.2440) SLPVectorizer.cpp:0:0
#15 0x00005635030badab llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x3d67dab)
#16 0x0000563504064301 llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x4d11301)
#17 0x00005635025879bc llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x32349bc)
#18 0x0000563500a1e121 llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x16cb121)
#19 0x00005635025873da llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x32343da)
#20 0x0000563500a1ea81 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x16cba81)
#21 0x0000563502585b94 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x3232b94)
#22 0x000056350316aac0 (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> >&) (.constprop.836) BackendUtil.cpp:0:0
#23 0x000056350316da92 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x3e1aa92)
#24 0x0000563503e84c4b clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x4b31c4b)
#25 0x0000563504dbeb29 clang::ParseAST(clang::Sema&, bool, bool) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x5a6bb29)
#26 0x0000563503e837e0 clang::CodeGenAction::ExecuteAction() (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x4b307e0)
#27 0x0000563503815651 clang::FrontendAction::Execute() (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x44c2651)
#28 0x00005635037afc4a clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x445cc4a)
#29 0x00005635038e3353 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x4590353)
#30 0x000056350075a981 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x1407981)
#31 0x0000563500756819 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#32 0x000056350069e129 main (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x134b129)
#33 0x00007fc005877b97 __libc_start_main /build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
#34 0x000056350075638a _start (/local/suz-local/software/local/clang-trunk/bin/clang-15+0x140338a)
clang-15: error: unable to execute command: Aborted
clang-15: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 15.0.0 (https://github.com/llvm/llvm-project.git 973183612ea26bdc2394863f38a46514c33dc026)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/opfuzz/bin
clang-15: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-15: note: diagnostic msg: /tmp/small-db69c2.c
clang-15: note: diagnostic msg: /tmp/small-db69c2.sh
clang-15: note: diagnostic msg:
********************
[510] %
[510] % cat small.c
int a, f;
volatile int b, c, d, e;
int main() {
if (e > f) {
int g = d;
b = (c || d) | (f && f);
a = f / g | (d && c);
}
return 0;
}
```
Compiler Explorer: https://godbolt.org/z/q4eEd6da6
@fhahn
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztW1tz4rgS_jXkRWXKd-yHPBBIZlKVPckJzO4jJdsyeMdYXknOJPPrt1s2xCIkITNQNWf3bGXB6NLq_vqibkuT8OzpfL4qJKF1zaiQRHGSMEKJYCmrFHwtBZOy4BXJBV8TxxvaQ2dIBvZ0YI-7z9Du_tqfwUVgjwbBlAzcgKQlrZbqK7Ee2l79mzwwoWk6AZCzYWC0UqqWA288cK_gb1moVZMMU76GH2X5sPmyasH_ZKkawgASjzwn8kLHZdQNkyx1vdiPQi_3IuqHgeOnnpelthsO3Lhde07FkilYhDxG4SL0rab6WvFvlVUWVfNoLaumG7cSjGZkzTNW4uiay-Kx7bqupKJlybJpIbAL-eIpLeFbNt-tzTOv8-b7d3hIiqqdeMWbKiMprbIio4qRT5MJKVpiVAEUHbFGCiRZJAhCmsJnEUZhj0H3KvpJgp3sfZLhCUgOQbXHJzs6AcnTcNqpacZKsFeWHYvFyZa5dVO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