<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/119818>119818</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LLParser] Constant blockaddress with non-number block id is not supported
</td>
</tr>
<tr>
<th>Labels</th>
<td>
crash-on-valid,
llvm:ir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
dtcxzyw
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dtcxzyw
</td>
</tr>
</table>
<pre>
Reproducer extracted from ruby: https://godbolt.org/z/hxTWbj9nW
```
; bin/opt test.ll
@vm_exec_core.insns_address_table = internal constant [2 x ptr] [ptr blockaddress(@vm_exec_core, %2), ptr blockaddress(@vm_exec_core, %.lr.ph.i2526)], align 16
define void @vm_exec_core() {
entry:
br label %.lr.ph.i2526
.lr.ph.i2526:
br label %2
2:
ret void
}
```
```
opt: /root/llvm-project/llvm/include/llvm/AsmParser/LLParser.h:94: bool llvm::ValID::operator<(const llvm::ValID&) const: Assertion `Kind == RHS.Kind && "Comparing ValIDs of different kinds"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S <source>
#0 0x00000000051d0a58 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x51d0a58)
#1 0x00000000051ce45c SignalHandler(int) Signals.cpp:0:0
#2 0x000071d60b642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x000071d60b6969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x000071d60b642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x000071d60b6287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x000071d60b62871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x000071d60b639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x0000000004c13d39 std::map<llvm::ValID, llvm::GlobalValue*, std::less<llvm::ValID>, std::allocator<std::pair<llvm::ValID const, llvm::GlobalValue*>>>::operator[](llvm::ValID&&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4c13d39)
#9 0x0000000004c1428b llvm::LLParser::parseValID(llvm::ValID&, llvm::LLParser::PerFunctionState*, llvm::Type*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4c1428b)
#10 0x0000000004c16df7 llvm::LLParser::parseGlobalValue(llvm::Type*, llvm::Constant*&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4c16df7)
#11 0x0000000004c17020 llvm::LLParser::parseGlobalTypeAndValue(llvm::Constant*&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4c17020)
#12 0x0000000004c17066 llvm::LLParser::parseGlobalValueVector(llvm::SmallVectorImpl<llvm::Constant*>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4c17066)
#13 0x0000000004c14ee0 llvm::LLParser::parseValID(llvm::ValID&, llvm::LLParser::PerFunctionState*, llvm::Type*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4c14ee0)
#14 0x0000000004c16df7 llvm::LLParser::parseGlobalValue(llvm::Type*, llvm::Constant*&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4c16df7)
#15 0x0000000004c2937f llvm::LLParser::parseGlobal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned int, llvm::SMLoc, unsigned int, bool, unsigned int, unsigned int, bool, llvm::GlobalValue::ThreadLocalMode, llvm::GlobalValue::UnnamedAddr) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4c2937f)
#16 0x0000000004c2c0ce llvm::LLParser::parseNamedGlobal() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4c2c0ce)
#17 0x0000000004c39276 llvm::LLParser::parseTopLevelEntities() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4c39276)
#18 0x0000000004c393cd llvm::LLParser::Run(bool, llvm::function_ref<std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>> (llvm::StringRef, llvm::StringRef)>) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4c393cd)
#19 0x0000000004be4152 parseAssemblyInto(llvm::MemoryBufferRef, llvm::Module*, llvm::ModuleSummaryIndex*, llvm::SMDiagnostic&, llvm::SlotMapping*, bool, llvm::function_ref<std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>> (llvm::StringRef, llvm::StringRef)>) Parser.cpp:0:0
#20 0x0000000004be4359 llvm::parseAssembly(llvm::MemoryBufferRef, llvm::SMDiagnostic&, llvm::LLVMContext&, llvm::SlotMapping*, llvm::function_ref<std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>> (llvm::StringRef, llvm::StringRef)>) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4be4359)
#21 0x0000000004bde8dc llvm::parseIR(llvm::MemoryBufferRef, llvm::SMDiagnostic&, llvm::LLVMContext&, llvm::ParserCallbacks) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4bde8dc)
#22 0x0000000004be0aac llvm::parseIRFile(llvm::StringRef, llvm::SMDiagnostic&, llvm::LLVMContext&, llvm::ParserCallbacks) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4be0aac)
#23 0x0000000000908b42 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x908b42)
#24 0x000071d60b629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#25 0x000071d60b629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#26 0x00000000009019e5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9019e5)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/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