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

    <tr>
        <th>Summary</th>
        <td>
            Clang++ with -O3 failed: Assertion `!verifyFunction(*L->getHeader()->getParent(), &dbgs())' failed.
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          TatyanaDoubts
      </td>
    </tr>
</table>

<pre>
    Run clang++ with -O3 on the following test:
[Test.cpp.zip](https://github.com/llvm/llvm-project/files/11450577/Test.cpp.zip)

Godbolt repro: https://godbolt.org/z/q13PseoP3

Stack dump:
```console
0.      Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O3 <source>
1.      <eof> parser at end of file
2.      Optimizer
 #0 0x0000564351b4822f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b8822f)
 #1 0x0000564351b45f6c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b85f6c)
 #2 0x0000564351a92c98 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f77da00e420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f77d9adb00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007f77d9aba859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007f77d9aba729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007f77d9acbfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x000056435334c0cd llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x538c0cd)
 #9 0x000056435334c319 llvm::LoopVectorizePass::runImpl(llvm::Function&, llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo*, llvm::TargetLibraryInfo*, llvm::DemandedBits&, llvm::AssumptionCache&, llvm::LoopAccessInfoManager&, llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x538c319)
#10 0x000056435334d540 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x538d540)
#11 0x0000564352f5f1f6 llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f9f1f6)
#12 0x000056434f3ca99d 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>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x140a99d)
#13 0x00005643514f8afd llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3538afd)
#14 0x000056434f3ae9a6 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x13ee9a6)
#15 0x00005643514f6a8d llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3536a8d)
#16 0x0000564351dc36f1 (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
#17 0x0000564351dc6859 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>>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e06859)
#18 0x0000564352d86432 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4dc6432)
#19 0x0000564354278549 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62b8549)
#20 0x0000564352d84c98 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4dc4c98)
#21 0x00005643525de609 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x461e609)
#22 0x0000564352562246 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45a2246)
#23 0x00005643526c2637 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4702637)
#24 0x000056434f0276ad cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x10676ad)
#25 0x000056434f02320a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#26 0x00005643523c7c2d 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
#27 0x0000564351a93180 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ad3180)
#28 0x00005643523c84ef 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
#29 0x000056435239003c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43d003c)
#30 0x0000564352390add clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43d0add)
#31 0x00005643523989ad clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43d89ad)
#32 0x000056434f0258a0 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x10658a0)
#33 0x000056434ef2d505 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xf6d505)
#34 0x00007f77d9abc083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#35 0x000056434f01df1e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x105df1e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWt1u27gSfhrlhrAhkZIsXeTCceLdLrpo0GTPrUGRI4enFKklqTTp0x9Qkm3Rcdp0ES_OH5DdpOJw5ptvhuQMJWqt2CqAyyi7irLrC9q5B20u76l7pope665y9qLS_Pnyc6cQk1RtI3wV4Sv0VbgHNPtEkFbIPQCqtZT6q1Bb5MC6iCyj-DqKl1F2dQ_WzVnbzr-JNsquI1w8ONdaL4LXEV5vhXvoqjnTTYTXUj7ufs1ao_8JzEV4XQsJNsLrJEmzOFssIrwOtOJytNb__xfNKy0dMtAaHZElOrI3DM-12UZ4_S3C6z8TcmtB35KpljtH2RfEu6Y9OJPHww_TymoJw9N4HsXlrdFbQxtEzbZrQDlvDkV4rVuPn-mmFRLMDJ5aqQ0Y_8yTOaPWgnFCKztzplNfIryuhNoNj1zPtvwrNfUsRbMtmmmvl7at1965tnNzi2Z3aDbbMjZzWkv2QIWKyPV3zXthq2hrH7RDs5ppqc2MC7pV2jrBLJrVSs-YofYhfPyJoIisrO4Mg4jcDBwknoOIrEDXEblBLTUWDKIOgeJI18gHcJDEXvJT60QjvoEZnqEIkxjFT3Ecx1mekiyp0gLjGvXZQJYRWdpnO_xxa4RyfWzuDWUQ4eIgZOjXjbbOAG0inEd4hYRyES5RhIt3ikWEr-InUhUe3j7tPP7kCH9W5-wU_pUEqrr2k7oTW0VlhItO9WuQI6m9lXOg9WACtDhAS0vMygKtfLA_A9OPYJ4HeL9SxaU3WoxMBjIrrRw89cswIsu4_29vgowmFvViwWkcQ4pjtNkYsE4b2Bg3-ilFFeH1U5Fv8nQmheqeZlvVDQOtezBA-dzqedz7kqQpjgNP0qmZkvIqjitkqLDwBv3Ma857zSmJ4yrQnIWaK1pkJaKVfhPyiWaMi6wMNOfHmhf7qL9Z5wKHOhehTlbVPP85nYTUPA90FtMsISRlMeOTnP6odfsPYE4b8Q1uqR0zvDWagbV-NFidw4PlGTI8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