[llvm-bugs] [Bug 35481] New: ARM Thumb1FrameLowering Assertion `PopReg && "Do not know how to get LR"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 30 08:38:41 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35481

            Bug ID: 35481
           Summary: ARM Thumb1FrameLowering Assertion `PopReg && "Do not
                    know how to get LR"' failed
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: ARM
          Assignee: unassignedbugs at nondot.org
          Reporter: superjoe30 at gmail.com
                CC: llvm-bugs at lists.llvm.org

This is LLVM master branch of
https://github.com/llvm-project/llvm-project-20170507

commit ff1009fa3858374e7ca5035faa9c85217e957ebb (HEAD -> master, origin/master,
origin/HEAD)
Author: Simon Pilgrim <llvm-dev at redking.me.uk>
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:
https://github.com/skyfex/zig-nrf-demo (sha1
3d9734d238e063492d8fee65c8f8ac6e05a86d8c)

zig (https://github.com/zig-lang/zig/) 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 at 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 at 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171130/2a9c45e0/attachment-0001.html>


More information about the llvm-bugs mailing list