Closed asl closed 14 years ago
Testing a fix.
It's a livevariables bug:
BL <ga:@bbb>, %R0<kill>, %R1<kill>, %R2<kill>, %R0<imp-def,dead>, %R1<imp-def,dead>, %R2<imp-def,dead>, %R3<imp-def,dead>, %R12<imp-def,dead>, %LR<imp-def,dead>, %D0<imp-def,dead>, %D1<imp-def,\
dead>, %D2<imp-def,dead>, %D3<imp-def,dead>, %D4<imp-def,dead>, %D5<imp-def,dead>, %D6<imp-def,dead>, %D7<imp-def,dead>, %D16<imp-def,dead>, %D17<imp-def,dead>, %D18<imp-def,dead>, %D19<imp-def,dead>, \
%D20<imp-def,dead>, %D21<imp-def,dead>, %D22<imp-def,dead>, %D23<imp-def,dead>, %D24<imp-def,dead>, %D25<imp-def,dead>, %D26<imp-def,dead>, %D27<imp-def,dead>, %D28<imp-def,dead>, %D29<imp-def,dead>, %\
D30<imp-def,dead>, %D31<imp-def,dead>, %CPSR<imp-def,dead>, %FPSCR<imp-def,dead>, %S1
Note D0 def on the call instruction is marked dead. But its subreg S0 is used below.
It looks like getLiveRangeContaining is returning NULL.
Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000010 0x000000010096c639 in llvm::SimpleRegisterCoalescing::JoinIntervals (this=0x10251dd80, LHS=@0x10252c4d0, RHS=@0x10252bf30, Swapped=@0x7fff5fbff1c8) at /Users/jolesen/g/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp:2233 2233 RHS.getLiveRangeContaining(VNI->def.getPrevSlot())->valno; (gdb) p VNI $1 = (llvm::VNInfo *) 0x102845dd0 (gdb) bt
Extended Description
Consider the attached bytecode (both original & bugpoint-reduced). Running llc yields a crash in coalescer:
$ ./llc -mcpu=cortex-a8 bugpoint-reduced-simplified.bc 0 llc 0x0000000000cb28d6 1 llc 0x0000000000cb2e72 2 libpthread.so.0 0x00007f0e3041b6f0 3 llc 0x0000000000a3306f llvm::SimpleRegisterCoalescing::JoinIntervals(llvm::LiveInterval&, llvm::LiveInterval&, bool&) + 2527 4 llc 0x0000000000a3931e llvm::SimpleRegisterCoalescing::JoinCopy(llvm::CopyRec&, bool&) + 7898 5 llc 0x0000000000a39f9a llvm::SimpleRegisterCoalescing::CopyCoalesceInMBB(llvm::MachineBasicBlock*, std::vector<llvm::CopyRec, std::allocator >&) + 1142
6 llc 0x0000000000a3a14e llvm::SimpleRegisterCoalescing::joinIntervals() + 232
7 llc 0x0000000000a3a66f llvm::SimpleRegisterCoalescing::runOnMachineFunction(llvm::MachineFunction&) + 735
8 llc 0x00000000009b8cb5 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 83
9 llc 0x0000000000c3595f llvm::FPPassManager::runOnFunction(llvm::Function&) + 329
10 llc 0x0000000000c375ef llvm::FunctionPassManagerImpl::run(llvm::Function&) + 111
11 llc 0x0000000000c37796 llvm::FunctionPassManager::run(llvm::Function&) + 112
12 llc 0x0000000000401ec0 main + 3064
13 libc.so.6 0x00007f0e2f744a44 __libc_start_main + 244
14 llc 0x0000000000400249
Stack dump:
valgrind is not quite as well:
$ valgrind ./llc -mcpu=cortex-a8 bugpoint-reduced-simplified.bc ==19537== Memcheck, a memory error detector. ==19537== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al. ==19537== Using LibVEX rev 1884, a library for dynamic binary translation. ==19537== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP. ==19537== Using valgrind-3.4.1, a dynamic binary instrumentation framework. ==19537== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al. ==19537== For more details, rerun with: -v ==19537== ==19537== Invalid read of size 8 ==19537== at 0xA3306F: llvm::SimpleRegisterCoalescing::JoinIntervals(llvm::LiveInterval&, llvm::LiveInterval&, bool&) (SimpleRegisterCoalescing.cpp:2233) ==19537== by 0xA3931D: llvm::SimpleRegisterCoalescing::JoinCopy(llvm::CopyRec&, bool&) (SimpleRegisterCoalescing.cpp:1652) ==19537== by 0xA39F99: llvm::SimpleRegisterCoalescing::CopyCoalesceInMBB(llvm::MachineBasicBlock*, std::vector<llvm::CopyRec, std::allocator >&) (SimpleRegisterCoalescing.cpp:2427)
==19537== by 0xA3A14D: llvm::SimpleRegisterCoalescing::joinIntervals() (SimpleRegisterCoalescing.cpp:2448)
==19537== by 0xA3A66E: llvm::SimpleRegisterCoalescing::runOnMachineFunction(llvm::MachineFunction&) (SimpleRegisterCoalescing.cpp:2717)
==19537== by 0x9B8CB4: llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (MachineFunctionPass.cpp:27)
==19537== by 0xC3595E: llvm::FPPassManager::runOnFunction(llvm::Function&) (PassManager.cpp:1330)
==19537== by 0xC375EE: llvm::FunctionPassManagerImpl::run(llvm::Function&) (PassManager.cpp:1282)
==19537== by 0xC37795: llvm::FunctionPassManager::run(llvm::Function&) (PassManager.cpp:1212)
==19537== by 0x401EBF: main (llc.cpp:392)
==19537== Address 0x10 is not stack'd, malloc'd or (recently) free'd