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

    <tr>
        <th>Summary</th>
        <td>
            aarch64: Invalid register name passed to __arm_rsr64 causes an ICE
        </td>
    </tr>

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

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

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

<pre>
    Take:
```
#include <arm_acle.h>
void f()
{
        __arm_rsr64 ("iadr_el1"); // incorrect spelling
        __arm_rsr64 ("aidr_el1"); // correct spelling
}
```

This causes an internal compiler error instead of a friendly error message:
```
fatal error: error in backend: Invalid register name "iadr_el1".
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-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -fverbose-asm -S -target aarch64-linux-gnu --gcc-toolchain=/opt/compiler-explorer/arm64/gcc-12.2.0/aarch64-unknown-linux-gnu --sysroot=/opt/compiler-explorer/arm64/gcc-12.2.0/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot -fcolor-diagnostics -fno-crash-diagnostics -xc -O3 -fno-unroll-loops -fno-verbose-asm -g0 -march=armv9-a <source>
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module '<source>'.
4.      Running pass 'AArch64 Instruction Selection' on function '@f'
 #0 0x000000000384b7d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x384b7d8)
 #1 0x0000000003849944 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3849944)
 #2 0x0000000003794553 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3794553)
 #3 0x000000000384111e llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x384111e)
 #4 0x0000000000c9dac6 (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc9dac6)
 #5 0x000000000379e5b3 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x379e5b3)
 #6 0x0000000000e534af llvm::AArch64TargetLowering::getRegisterByName(char const*, llvm::LLT, llvm::MachineFunction const&) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0xe534af)
 #7 0x0000000004a38275 llvm::SelectionDAGISel::Select_READ_REGISTER(llvm::SDNode*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a38275)
 #8 0x0000000004a3deb2 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a3deb2)
 #9 0x0000000000e237ed (anonymous namespace)::AArch64DAGToDAGISel::Select(llvm::SDNode*) AArch64ISelDAGToDAG.cpp:0:0
#10 0x0000000004a36e44 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a36e44)
#11 0x0000000004a460b1 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a460b1)
#12 0x0000000004a48a95 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a48a95)
#13 0x0000000004a4a580 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a4a580)
#14 0x0000000004a369d1 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a369d1)
#15 0x0000000002c9326b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#16 0x00000000031deb72 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x31deb72)
#17 0x00000000031dee31 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x31dee31)
#18 0x00000000031de0cb llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x31de0cb)
#19 0x0000000003ae3f56 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>>, clang::BackendConsumer*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3ae3f56)
#20 0x0000000004121c3c clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4121c3c)
#21 0x00000000060cf04c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x60cf04c)
#22 0x00000000041223d5 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x41223d5)
#23 0x00000000043c8be1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x43c8be1)
#24 0x000000000434bb4b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x434bb4b)
#25 0x00000000044b01e3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x44b01e3)
#26 0x0000000000c9fa0c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc9fa0c)
#27 0x0000000000c9994d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#28 0x000000000416b899 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
#29 0x0000000003794453 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3794453)
#30 0x000000000416bab9 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
#31 0x0000000004131457 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4131457)
#32 0x0000000004131e0d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4131e0d)
#33 0x000000000413b8ec clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x413b8ec)
#34 0x0000000000c9ccf1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc9ccf1)
#35 0x0000000000b72924 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xb72924)
#36 0x00007521d6a29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#37 0x00007521d6a29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#38 0x0000000000c993ee _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc993ee)
clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Compiler returned: 70
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWl1zozjW_jXkRmUXCGzMRS6Ik_RkKj2divO-ty4hDlgbIbGScJJ_vyXANiJ2p2eW2dqqTc10HH0cPefR0fmQRbRmpQC49hY33uL2ijRmJ9V1zYR-ZeQqk_nH9Qt5BS9MPf_W81Nv6ff_dX_ikAnKmxyQF66JqraEcpjvvPCuG7CXLEeFh1ceTvop8U33AfU_262dp7RaRqgdiBnJ1RZ44GFsp4U3yMP3Hr5HTFCpFFCDdA2cM1F-JYqwC6LOC_Li2_N6tv--7JhGlDQaNCICMWFACcIRlVXNOCgESkmFmNAGSI5kgQgqFAOR84--rwKtSXmRz4IYwruhXpge5aGM0FcQuW17EHvCWY4UlEwbUEiQCpDL2ryT9vR4l27ukG6yihlEUNaUSEEtlUFGop0xtbZAWkJKZnZNNqey8vA95_vDr1mt5D-AGg_fM60b0JY8InJ02HezA0QV0bsWpFGEgofXqFZQK0lBa8iRlo3qmu1MorWkjBjIkWoE0lSx2vSQN4bQV5Q3VX2kyJ97fvKkZKlIhYgqmwqEscDtVsraIjtswAzeay4VKNvGiShnRjXi1cP3GROHNg_fePgGzcr8jahiFqFZiWbSCiN1bUU2pm7MXKNZsQeVSQ0zois026CZIaoEgwhRdLeMZpyJ5n1WigbNZiWlMyMlpzvChBfe_hQbUdUysqRTOgvwHM9929hLbcSrkG_Cka4_tJLSTCv3i75-TTQrqORSzXJGSiG1YdRSI-Ss3XW3-Z2i2Y-w626EkpzPuJR1P8Ghs_TRrLLLe-EtUdU-mRHrQ3pTOfiPwG6-F65BFl54h2qiNChEDALRHrCCcehGWqNP1jIHVIIARQyTousJbc9zIwQTJaqJ1sjD8X0jqB2CnmzDdyJIaSmMkRSoknnD7ZmKHUA47o00OicwTVsq0YPQRjWd7A1waD_1govDolZ05Bf2V-fAPBz6yH_3Dz_hKsrifIXakximXpjqD919eFJMmPacvHSHbXUapMjbVmqjgFQeXtoDx4TxcNJ5w79-Wjx847_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