LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 28083 - Couldn't join subrange crash in OpenCV Arithm/Log test
Summary: Couldn't join subrange crash in OpenCV Arithm/Log test
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Register Allocator (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Matthias Braun
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-10 14:36 PDT by Matt Arsenault
Modified: 2016-06-10 19:32 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments
Semi-reduced crashing testcase (19.42 KB, application/octet-stream)
2016-06-10 14:36 PDT, Matt Arsenault
Details
Further reduced testcase (1.23 KB, application/octet-stream)
2016-06-10 14:36 PDT, Matt Arsenault
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Arsenault 2016-06-10 14:36:18 PDT
Created attachment 16511 [details]
Semi-reduced crashing testcase

RegisterCoalescer crashes on this. -verify-machineinstrs catches an error before this.

*** Couldn't join subrange!

UNREACHABLE executed at /home/matt/src/llvm/lib/CodeGen/RegisterCoalescer.cpp:2567!
#0 0x00000000025c88b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/matt/src/llvm/lib/Support/Unix/Signals.inc:402:0
#1 0x00000000025c8c76 PrintStackTraceSignalHandler(void*) /home/matt/src/llvm/lib/Support/Unix/Signals.inc:470:0
#2 0x00000000025c6f98 llvm::sys::RunSignalHandlers() /home/matt/src/llvm/lib/Support/Signals.cpp:44:0
#3 0x00000000025c820a SignalHandler(int) /home/matt/src/llvm/lib/Support/Unix/Signals.inc:256:0
#4 0x00007fd34769cef0 __restore_rt (/usr/lib/libpthread.so.0+0x10ef0)
#5 0x00007fd346867295 __GI_raise (/usr/lib/libc.so.6+0x33295)
#6 0x00007fd3468686da __GI_abort (/usr/lib/libc.so.6+0x346da)
#7 0x0000000002562655 bindingsErrorHandler(void*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) /home/matt/src/llvm/lib/Support/ErrorHandling.cpp:127:0
#8 0x0000000001ebd6ff (anonymous namespace)::RegisterCoalescer::joinSubRegRanges(llvm::LiveRange&, llvm::LiveRange&, unsigned int, llvm::CoalescerPair const&) /home/matt/src/llvm/lib/CodeGen/RegisterCoalescer.cpp:2574:0
#9 0x0000000001ebdcb0 (anonymous namespace)::RegisterCoalescer::mergeSubRangeInto(llvm::LiveInterval&, llvm::LiveRange const&, unsigned int, llvm::CoalescerPair&) /home/matt/src/llvm/lib/CodeGen/RegisterCoalescer.cpp:2630:0
#10 0x0000000001ebe43a (anonymous namespace)::RegisterCoalescer::joinVirtRegs(llvm::CoalescerPair&) /home/matt/src/llvm/lib/CodeGen/RegisterCoalescer.cpp:2693:0
#11 0x0000000001ebe84c (anonymous namespace)::RegisterCoalescer::joinIntervals(llvm::CoalescerPair&) /home/matt/src/llvm/lib/CodeGen/RegisterCoalescer.cpp:2742:0
#12 0x0000000001eb8461 (anonymous namespace)::RegisterCoalescer::joinCopy(llvm::MachineInstr*, bool&) /home/matt/src/llvm/lib/CodeGen/RegisterCoalescer.cpp:1456:0
#13 0x0000000001ebeb9c (anonymous namespace)::RegisterCoalescer::copyCoalesceWorkList(llvm::MutableArrayRef<llvm::MachineInstr*>) /home/matt/src/llvm/lib/CodeGen/RegisterCoalescer.cpp:2812:0
#14 0x0000000001ebf614 (anonymous namespace)::RegisterCoalescer::coalesceLocals() /home/matt/src/llvm/lib/CodeGen/RegisterCoalescer.cpp:2938:0
#15 0x0000000001ebfa7e (anonymous namespace)::RegisterCoalescer::joinAllIntervals() /home/matt/src/llvm/lib/CodeGen/RegisterCoalescer.cpp:2972:0
#16 0x0000000001ebfdd9 (anonymous namespace)::RegisterCoalescer::runOnMachineFunction(llvm::MachineFunction&) /home/matt/src/llvm/lib/CodeGen/RegisterCoalescer.cpp:3018:0
#17 0x0000000001de26ba llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/matt/src/llvm/lib/CodeGen/MachineFunctionPass.cpp:60:0
Comment 1 Matt Arsenault 2016-06-10 14:36:48 PDT
Created attachment 16512 [details]
Further reduced testcase

This exhibits the verifier error but doesn't crash
Comment 2 Quentin Colombet 2016-06-10 15:00:44 PDT
The verifier issue comes out of the Machine Scheduler, right?

I.e., the bug is in the scheduler (fall-out of the subreg scheduling?), I believe, not the coalescer.
Comment 3 Quentin Colombet 2016-06-10 15:01:40 PDT
Here is what I am seeing:
# After Machine Instruction Scheduler
[...]
*** Bad machine code: Instruction ending live segment doesn't read the register ***
- function:    opencv_arithm_log_live_segment
- basic block: BB#1 bb7 (0x7fd52c062a88) [496B;864B)
- instruction: 588B	%vreg74<def,dead> = COPY
- liverange:   [400r,544r:0)[544r,568r:1)[568r,588r:2)  0@400r 1@544r 2@568r
- register:    %vreg79
- segment:     [568r,588r:2)

*** Bad machine code: Instruction ending live segment doesn't read the register ***
- function:    opencv_arithm_log_live_segment
- basic block: BB#1 bb7 (0x7fd52c062a88) [496B;864B)
- instruction: 588B	%vreg74<def,dead> = COPY
- liverange:   [544r,588r:0)  0@544r
- register:    %vreg79
- lanemask:    00000008
- segment:     [544r,588r:0)
Comment 4 Matt Arsenault 2016-06-10 16:53:45 PDT
(In reply to comment #3)
> Here is what I am seeing:
> # After Machine Instruction Scheduler
> [...]
> *** Bad machine code: Instruction ending live segment doesn't read the
> register ***
> - function:    opencv_arithm_log_live_segment
> - basic block: BB#1 bb7 (0x7fd52c062a88) [496B;864B)
> - instruction: 588B	%vreg74<def,dead> = COPY
> - liverange:   [400r,544r:0)[544r,568r:1)[568r,588r:2)  0@400r 1@544r 2@568r
> - register:    %vreg79
> - segment:     [568r,588r:2)
> 
> *** Bad machine code: Instruction ending live segment doesn't read the
> register ***
> - function:    opencv_arithm_log_live_segment
> - basic block: BB#1 bb7 (0x7fd52c062a88) [496B;864B)
> - instruction: 588B	%vreg74<def,dead> = COPY
> - liverange:   [544r,588r:0)  0@544r
> - register:    %vreg79
> - lanemask:    00000008
> - segment:     [544r,588r:0)


Yes, the verifier error is after the scheduler.
Comment 5 Matthias Braun 2016-06-10 19:32:40 PDT
Thanks for the testcase. Fixed in r272446