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

    <tr>
        <th>Summary</th>
        <td>
            Instruction does not dominate all uses error after c80b503
        </td>
    </tr>

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

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

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

<pre>
    Recently one of our internal tests started failing with a crash in the compiler which I bisected back to commit c80b503. Consider the following code:
```c++
void alpha();
float bravo, charlie, delta;
void echo() {
  float foxtrot, gulf;
hotel:
 gulf = foxtrot;
india:
  foxtrot = gulf;
  gulf = charlie = delta / foxtrot;
  bravo = foxtrot / bravo * charlie;
  alpha();
  if (delta)
    goto hotel;
  goto india;
}
```
If that code is compiled with optimizations and AVX enabled using a compiler that contains the change in c80b503, it results in a crash in the compiler:
https://godbolt.org/z/3fP9cedd6
```
Instruction does not dominate all uses!
  %11 = insertelement <2 x float> %2, float %9, i64 0, !dbg !27
  %10 = shufflevector <2 x float> %11, <2 x float> %6, <2 x i32> <i32 0, i32 2>, !dbg !27
in function _Z4echov
fatal error: error in backend: Broken function found, compilation aborted!
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: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O2 -c -mavx <source>
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module '<source>'.
4.      Running pass 'Module Verifier' on function '@_Z4echov'
 #0 0x0000000003738928 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3738928)
 #1 0x00000000037365ec llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x37365ec)
 #2 0x000000000367f506 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x367f506)
 #3 0x000000000372d93e llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x372d93e)
 #4 0x0000000000beee0a LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
 #5 0x0000000003689ea3 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3689ea3)
 #6 0x000000000368a008 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x368a008)
 #7 0x0000000003156c12 (anonymous namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&) Verifier.cpp:0:0
 #8 0x00000000030babf9 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x30babf9)
 #9 0x00000000030bae31 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x30bae31)
#10 0x00000000030bb652 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x30bb652)
#11 0x00000000039ad592 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) BackendUtil.cpp:0:0
#12 0x00000000039ada39 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+++0x39ada39)
#13 0x00000000049a785f clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49a785f)
#14 0x0000000005eadc99 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5eadc99)
#15 0x00000000049a6a48 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49a6a48)
#16 0x00000000042093e9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x42093e9)
#17 0x000000000418a88e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x418a88e)
#18 0x00000000042e856e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x42e856e)
#19 0x0000000000bf1086 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbf1086)
#20 0x0000000000be894a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#21 0x0000000003fe67a9 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
#22 0x000000000367f444 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x367f444)
#23 0x0000000003fe6d9f 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
#24 0x0000000003faef65 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3faef65)
#25 0x0000000003faf9cd 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+++0x3faf9cd)
#26 0x0000000003fb78f5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3fb78f5)
#27 0x0000000000bee52c clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbee52c)
#28 0x0000000000ae8281 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xae8281)
#29 0x00007f1f3428d083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#30 0x0000000000be842e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbe842e)
clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Compiler returned: 70
```
@valerydmit this was your change that seems to have caused the issue, can you take a look?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWl9v2zj2_TTKC-FApmxZesiD68S_6aCDBk2n-GFfjCvpSuaWIrUklTjz6RckJVt0nGlnkcw-bJHCMv9cnnt4eHlFGrRmjUC8iZYfouXtFfRmL9VN9dyL5qqQ1fPNFyxRGP5MpEAiayJ7RZgwqARwYlAbTbQBZbAiNTDOREOemNkTIKUCvSdMELNHUsq2YxwVedqzck8-koJpLG2vAsrvxEjbomWGlFlcLOPkmmyk0KxC5brXknP5ZI2XssIoWUfxbRSvozT2f2VEP9g_V_ooWUWAd3uIaBbRPEqGippLMKRQ8CgjuiHlHhRnaB8r5AaO7ZwBLPfS9yfRaqggxJuo5cEoaWzPpuf1seNeGuRHdK6ORMntsf3YjomKwandWO_aBgbJycaA1j07uCS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