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

    <tr>
        <th>Summary</th>
        <td>
            [clang][x86-64] Assertion failure in SelectionDAGBuilder::visitInlineAsm (“ConstraintID != InlineAsm::ConstraintCode::Unknown”)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    Compiler Explorer:  https://godbolt.org/z/jd8YKqYx6

Generated by fuzzer.

Console output:

```
clang-22: /root/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:10272: void llvm::SelectionDAGBuilder::visitInlineAsm(const llvm::CallBase&, const llvm::BasicBlock*): Assertion `ConstraintID != InlineAsm::ConstraintCode::Unknown && "Failed to convert memory constraint code to constraint id."' 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: /opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22 -cc1 -triple x86_64-unknown-linux-gnu -O2 -emit-obj -dumpdir /app/output.s- -disable-free -clear-ast-before-backend -main-file-name example.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -fno-verbose-asm -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fdebug-compilation-dir=/app -fcoverage-compilation-dir=/app -resource-dir /opt/compiler-explorer/clang-assertions-trunk-20250716/lib/clang/22 -internal-isystem /opt/compiler-explorer/clang-assertions-trunk-20250716/lib/clang/22/include -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/16.0.0/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/example-4a3ed9.o -x c <source>
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module '<source>'.
4.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@main'
 #0 0x0000000003fb2168 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x3fb2168)
 #1 0x0000000003faf014 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007a4538842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007a45388969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007a4538842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007a45388287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x00007a453882871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x00007a4538839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x000000000555ddb1 llvm::SelectionDAGBuilder::visitInlineAsm(llvm::CallBase const&, llvm::BasicBlock const*) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x555ddb1)
 #9 0x000000000557f48f llvm::SelectionDAGBuilder::visitCall(llvm::CallInst const&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x557f48f)
#10 0x0000000005592cb4 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x5592cb4)
#11 0x000000000562703d llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true, llvm::BasicBlock>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true, llvm::BasicBlock>, false, true>, bool&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x562703d)
#12 0x0000000005627fdd llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x5627fdd)
#13 0x0000000005629465 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x5629465)
#14 0x0000000005614e2f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x5614e2f)
#15 0x00000000032b46e3 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#16 0x00000000038dc70f llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x38dc70f)
#17 0x00000000038dcac1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x38dcac1)
#18 0x00000000038dd331 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x38dd331)
#19 0x000000000426b061 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*) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x426b061)
#20 0x0000000004966f83 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x4966f83)
#21 0x000000000665ca3c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x665ca3c)
#22 0x0000000004967388 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x4967388)
#23 0x0000000004c5ad75 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x4c5ad75)
#24 0x0000000004bd782e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x4bd782e)
#25 0x0000000004d4e821 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x4d4e821)
#26 0x0000000000d933bf cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0xd933bf)
#27 0x0000000000d89f9a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#28 0x0000000000d8e6b9 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0xd8e6b9)
#29 0x0000000000c44414 main (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0xc44414)
#30 0x00007a4538829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#31 0x00007a4538829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#32 0x0000000000d89a45 _start (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0xd89a45)
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Compiler returned: `254`
```


Code: 

```
#define XCR_XFEATURE_ENABLED_MASK 0x0
#define XSTATE_SSE               0x2
#define XSTATE_YMM               0x4

static int avx_os_support(void) {
    unsigned int eax, edx;
    unsigned int ecx = XCR_XFEATURE_ENABLED_MASK;
    
    __asm__("xgetbv" : "=a"(eax), "=d"(edx) : "\x03c"(ecx));
    return (eax & (XSTATE_SSE | XSTATE_YMM)) == (XSTATE_SSE | XSTATE_YMM);
}

int main(void) {
    avx_os_support();
    return 0;
}
```


</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzUWkuT4yi2_jXkhsAho4etRS6UftRUdNftinL23O6VAgmkpFMCDSCXq379DUBOSU7XI2fGE3cyuss2Oo_vg8PhCCBa81owdg_iBxBv70hvnqS6f_jl9wNe3hWSfrnfyLbjDVNwd-oaqZgCYQbhkzGdBmEG8B7gfS1pIRuzkKoGeP8V4P1fdP3nL__485SAIANB9o4JpohhFBZfYNV__crUwj_ZSKFlw6DsTdcba9E1gyQY_guysiGiRhhbxwDvlZQG4H3THFvUKfkXK88_7QcvAN5vJGXvmAB4f2ANKw2XYpu9u_j50POGMrUouw6E2TLAK-fhKDmFzlqYgTC7ouEfHLnm5r1ouGCZbgFel1JoM9HckKZ5IJoBnAC8gZePH4jm5UMjy2eAM4BT6zvTminrDIIksD1jFOHCvN9CgJcg3MLRn3fxImIZ-7bfxbOQnwV0bhMIMN4T3jAKjbQYjkwZ2LJWqi8eklOHpaRskDg3cboAGAO8gpUzYAfs46-77LCDui9abiCBRV9DxTqpjFW-CApunvpiUcp2MjzzQeNa90wDvIdEUMhF2fQWxhODpSL6CRakfDaKlMx2YKdYp2TJtGYUatkr32w1iday5C6-VC-gLhXvjMV7MKR8hrRvOx9ZwQIE6Ucla0VaSFTdt0wYPQSW7Cymcoh3xM7xjvc-Asl5dDQyqhfPCAc4DlbLBOB9wcWLHMYQleUSIqN41zB4Wid5EqHeDwxquOhPqBY9RL9hiFjLDZLFXxBZmJQrC4V0nQXk5sRCI4go16RoGKoUYxCVDSMKEW1QwSqpGLIdxQSFqCVcoIo3DAnSMshOpO0atighahVr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