<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ARM Thumb1FrameLowering Assertion `PopReg && "Do not know how to get LR"' failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=35481">35481</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ARM Thumb1FrameLowering Assertion `PopReg && "Do not know how to get LR"' failed
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: ARM
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>superjoe30@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is LLVM master branch of
<a href="https://github.com/llvm-project/llvm-project-20170507">https://github.com/llvm-project/llvm-project-20170507</a>

commit ff1009fa3858374e7ca5035faa9c85217e957ebb (HEAD -> master, origin/master,
origin/HEAD)
Author: Simon Pilgrim <<a href="mailto:llvm-dev@redking.me.uk">llvm-dev@redking.me.uk</a>>
Date:   Wed Nov 29 18:52:20 2017 +0000

    [X86][AVX512] Tag 3OP (shuffles, double-shifts and GFNI) instructions
scheduler classes



zig:
/home/andy/Downloads/llvm-project/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp:645:
bool llvm::Thumb1FrameLowering::emitPopSpecialFixUp(llvm::MachineBasicBlock&,
bool) const: Assertion `PopReg && "Do not know how to get LR"' failed.


(gdb) bt
#0  0x00007ffff6938274 in raise () from
/nix/store/mjx71lmnlf4psm9942djjcd8b56hyk8b-glibc-2.26-75/lib/libc.so.6
#1  0x00007ffff6939675 in abort () from
/nix/store/mjx71lmnlf4psm9942djjcd8b56hyk8b-glibc-2.26-75/lib/libc.so.6
#2  0x00007ffff6930cf7 in __assert_fail_base () from
/nix/store/mjx71lmnlf4psm9942djjcd8b56hyk8b-glibc-2.26-75/lib/libc.so.6
#3  0x00007ffff6930da2 in __assert_fail () from
/nix/store/mjx71lmnlf4psm9942djjcd8b56hyk8b-glibc-2.26-75/lib/libc.so.6
#4  0x0000000003fe7516 in llvm::Thumb1FrameLowering::emitPopSpecialFixUp
(this=0xb5cf500, MBB=..., DoIt=true)
    at
/home/andy/Downloads/llvm-project/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp:645
#5  0x0000000003fe695a in llvm::Thumb1FrameLowering::emitEpilogue
(this=0xb5cf500, MF=..., MBB=...)
    at
/home/andy/Downloads/llvm-project/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp:487
#6  0x0000000004ec01b0 in (anonymous namespace)::PEI::insertPrologEpilogCode
(this=0xad821e0, Fn=...)
    at
/home/andy/Downloads/llvm-project/llvm/lib/CodeGen/PrologEpilogInserter.cpp:973
#7  0x0000000004ebcfbe in (anonymous namespace)::PEI::runOnMachineFunction
(this=0xad821e0, Fn=...)
    at
/home/andy/Downloads/llvm-project/llvm/lib/CodeGen/PrologEpilogInserter.cpp:210
#8  0x0000000004dd5f84 in llvm::MachineFunctionPass::runOnFunction
(this=0xad821e0, F=...)
    at
/home/andy/Downloads/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:62
#9  0x0000000005e7ce9d in llvm::FPPassManager::runOnFunction (this=0xad99bf0,
F=...)
    at /home/andy/Downloads/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1514
#10 0x0000000005e7d014 in llvm::FPPassManager::runOnModule (this=0xad99bf0,
M=...)
    at /home/andy/Downloads/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1535
#11 0x0000000005e7d361 in (anonymous namespace)::MPPassManager::runOnModule
(this=0xa944e80, M=...)
    at /home/andy/Downloads/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1591
#12 0x0000000005e7da15 in llvm::legacy::PassManagerImpl::run (this=0xb5a7640,
M=...)
    at /home/andy/Downloads/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1694
#13 0x0000000005e7dc0d in llvm::legacy::PassManager::run (this=0x7fffffffcc00,
M=...)
    at /home/andy/Downloads/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1725
#14 0x0000000001bb841d in ZigLLVMTargetMachineEmitToFile
(targ_machine_ref=0xa98e5c0, module_ref=0xa98d4f0, filename=0xb503cd0
"./zig-cache/compiler_rt.o", 
    output_type=ZigLLVM_EmitBinary, error_message=0x7fffffffcef8,
is_debug=true) at /home/andy/dev/zig/src/zig_llvm.cpp:165
#15 0x0000000001b3fa01 in do_code_gen (g=0xace38b0) at
/home/andy/dev/zig/src/codegen.cpp:4684
#16 0x0000000001b43f63 in codegen_build (g=0xace38b0) at
/home/andy/dev/zig/src/codegen.cpp:5841
#17 0x0000000001b89ce3 in build_o_raw (parent_gen=0xa8c1010, oname=0x606a7a4
"compiler_rt", full_path=0xad35590) at /home/andy/dev/zig/src/link.cpp:65
#18 0x0000000001b89e52 in build_compiler_rt (parent_gen=0xa8c1010) at
/home/andy/dev/zig/src/link.cpp:91
#19 0x0000000001b8a824 in construct_linker_job_elf (lj=0x7fffffffd2b0) at
/home/andy/dev/zig/src/link.cpp:284
#20 0x0000000001b8c41b in construct_linker_job (lj=0x7fffffffd2b0) at
/home/andy/dev/zig/src/link.cpp:854
#21 0x0000000001b8c780 in codegen_link (g=0xa8c1010, out_file=0x0) at
/home/andy/dev/zig/src/link.cpp:919
#22 0x0000000001b90309 in main (argc=15, argv=0x7fffffffd8d8) at
/home/andy/dev/zig/src/main.cpp:840

The use case comes from:
<a href="https://github.com/skyfex/zig-nrf-demo">https://github.com/skyfex/zig-nrf-demo</a> (sha1
3d9734d238e063492d8fee65c8f8ac6e05a86d8c)

zig (<a href="https://github.com/zig-lang/zig/">https://github.com/zig-lang/zig/</a>) llvm6 branch with cmake option
-DZIG_FORCE_EXTERNAL_LLD=ON 

zig build-exe --static --target-os freestanding --target-arch thumb
--target-environ eabihf --assembly gcc_startup_nrf51.S --linker-script
nrf51_xxaa.ld --verbose-link --verbose-llvm-ir test.zig

when I run the IR through clang directly, it produces an .o file:
andy@xps ~/D/zig-nrf-demo> ~/llvm-master-debug/bin/clang -c compiler_rt.ll
-target thumb-unknown-unknown-eabihf
warning: overriding the module target triple with
armv6kz-unknown-unknown-eabihf [-Woverride-module]
1 warning generated.
andy@xps ~/D/zig-nrf-demo> file compiler_rt.o 
compiler_rt.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), with
debug_info, not stripped


I'm not sure why running clang directly does not trigger the same crash.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>