<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63668>63668</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang crash: Assertion `(!ExtendingManyInputs || SubMask.size() > Mask.size()) && "SubMask with many inputs support must be larger than the mask."' failed.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          shao-hua-li
      </td>
    </tr>
</table>

<pre>
    ```console
% cat a.c
short a, c, e, j;
int b, f, h, i, k, l;
unsigned d[];
short *const g = &e;
void m() {
  short n;
  int o;
  for (; j; j++) {
    f = 0;
 for (; f <= 8; f++) {
      k = 0;
      for (; k <= 6; k++) {
 n = k == 0 ?: a / d[k];
        o |= n;
        char p = 0;
 char q[] = {p, 5, p, 2, 4, 6, 0, p, p, p, p, 5, p};
        int r, s = b;
        l = 0;
        for (; l < c; l++)
          r = r + q[l];
        while (r = r >> 8)
          ;
        *g ^= d[(9 << i) + i + 21 + k] < (0 == h);
        while (s)
          s &= s - 1;
      }
    }
  }
}
void main() { m(); }
%
% clang-tk -O3 -w a.c
clang-17: /zdata/shaoli/compilers/ccbuilder-repos/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:955: void addMask(llvm::SmallVectorImpl<int>&, llvm::ArrayRef<int>, bool): Assertion `(!ExtendingManyInputs || SubMask.size() > Mask.size()) && "SubMask with many inputs support must be larger than the mask."' 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: /zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name crash_0_reduced_evalord.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/zdata/shaoli/realsmith -resource-dir /zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/lib/clang/17 -internal-isystem /zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir=/zdata/shaoli/realsmith -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/crash_0_reduced_evalord-471c81.o -x c work76/work/wrong/crash_0_reduced_evalord.c
1.      <eof> parser at end of file
2.      Optimizer
 #0 0x000055708516949f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x3b6849f)
 #1 0x0000557085166bf4 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f129ef3d420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007f129e98e00b raise /build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #4 0x00007f129e96d859 abort /build/glibc-SzIz7B/glibc-2.31/stdlib/abort.c:81:7
 #5 0x00007f129e96d729 get_sysdep_segment_value /build/glibc-SzIz7B/glibc-2.31/intl/loadmsgcat.c:509:8
 #6 0x00007f129e96d729 _nl_load_domain /build/glibc-SzIz7B/glibc-2.31/intl/loadmsgcat.c:970:34
 #7 0x00007f129e97efd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x000055708687cc9d llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::finalize(llvm::ArrayRef<int>, unsigned int, llvm::function_ref<void (llvm::Value*&, llvm::SmallVectorImpl<int>&)>) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x527bc9d)
 #9 0x00005570868ac8d3 llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>, llvm::SmallPtrSetImpl<llvm::Value*>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x52ab8d3)
#10 0x00005570868cbde4 llvm::slpvectorizer::BoUpSLP::getTreeCost(llvm::ArrayRef<llvm::Value*>) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x52cade4)
#11 0x00005570868cfb82 (anonymous namespace)::HorizontalReduction::tryToReduce(llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo const&) SLPVectorizer.cpp:0:0
#12 0x00005570868d273e llvm::SLPVectorizerPass::vectorizeHorReduction(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*, llvm::SmallVectorImpl<llvm::WeakTrackingVH>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x52d173e)
#13 0x00005570868d7026 llvm::SLPVectorizerPass::vectorizeRootInstruction(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*) (.constprop.0) SLPVectorizer.cpp:0:0
#14 0x00005570868d9d20 llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x52d8d20)
#15 0x00005570868dd2ea 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
#16 0x00005570868ddcba llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x52dccba)
#17 0x000055708644f6b6 llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4e4e6b6)
#18 0x0000557082a0a08d 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>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x140908d)
#19 0x0000557084b195ed llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x35185ed)
#20 0x00005570829edb26 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x13ecb26)
#21 0x0000557084b1756d llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x351656d)
#22 0x00005570853e6186 (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>>&) BackendUtil.cpp:0:0
#23 0x00005570853e91f9 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, 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>>) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x3de81f9)
#24 0x00005570863ed8ed clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4dec8ed)
#25 0x000055708756d789 clang::ParseAST(clang::Sema&, bool, bool) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x5f6c789)
#26 0x00005570863ec0a8 clang::CodeGenAction::ExecuteAction() (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4deb0a8)
#27 0x0000557085c2f879 clang::FrontendAction::Execute() (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x462e879)
#28 0x0000557085bb51c6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x45b41c6)
#29 0x0000557085d14b46 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4713b46)
#30 0x000055708265a204 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x1059204)
#31 0x0000557082655f2a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#32 0x00005570826574fc clang_main(int, char**, llvm::ToolContext const&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x10564fc)
#33 0x000055708256c1a5 main (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0xf6b1a5)
#34 0x00007f129e96f083 __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:342:3
#35 0x0000557082650d0e _start (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x104fd0e)
clang-tk: error: unable to execute command: Aborted
clang-tk: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4314f4ceb5c8a95835b50d3b93f82e0f11f587f1)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /zdata/shaoli/compilers/ccbuilder-compilers
%
% clang-tk -v
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4314f4ceb5c8a95835b50d3b93f82e0f11f587f1)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /zdata/shaoli/compilers/ccbuilder-compilers
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Selected multilib: .;@m64
%
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsW9tz4yiz_2uUF0ouCV39kAfHiXdSNXM2lWT3e3QhaNlsEOgDlMv-9adA8kW2M5PMmaS-79ROZRQJaLr71xcaiRBj-EoCnAfZRZBdnpHOrpU-N2uiwnVHQsHPKsVezoM86n-okkYJCKLLIJoFOEOUWEQmtG8wa6UtIgGeI-ou4C5_BclF382lRZVrqt1l7S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