<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">This looks like a bug related to the subregister liveness updating in the RegisterCoalescer.</div><div class="">As this is always hard to debug without having the actual target at hand:</div><div class="">- Make sure the testcase (or rather all testcases) passes `llc -verify-machineinstrs`</div><div class="">- It would be good to see the full `llc -debug-only=regalloc` dump (looking below I would at least see which slotindexes belong to which instructions). Best to file a PR with the information.</div><div class="">- There is one open PR about coalescing subregister liveness right now:  <a href="http://llvm.org/PR32688" class="">http://llvm.org/PR32688</a> (but it's hard to say without investigation whether it is the same).</div><div class=""><br class=""></div><div class="">- Matthias</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Apr 24, 2017, at 9:10 AM, Johnson, Nicholas Paul via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hello,<br class=""><br class="">I have a minimal testcase which crashes RegisterCoalescer in my out-of-tree target.  It only crashes in Debug builds of llc---not in Release builds.  Also, interesting to note that the x86 backend lowers this same testcase successfully.  I did a quick search of <a href="http://bugs.llvm.org" class="">bugs.llvm.org</a> and found no matches.<br class=""><br class="">This implies that the problem is in my backend and/or how my backend interacts with RegisterCoalescer.   I'm not too familiar with RegisterCoalescer.   Can anyone give me a hint on where I should start looking for the problem in my backend?  <br class=""><br class="">Thank you,<br class="">Nick Johnson<br class="">D. E. Shaw Research<br class=""><br class=""><br class="">Here's my minimal testcase:<br class=""><br class="">$ llvm-dis -o - bugpoint.reduced.simplified.bc<br class="">; ModuleID = 'bugpoint.reduced.simplified.bc'<br class="">source_filename = "bugpoint-output-7eb0c3b.bc"<br class="">target datalayout = "e-m:e-p:32:32-i8:8:32-i16:16:32-i32:32:32-i64:64:64-v64:64:64-v128:128:128-n32-S128"<br class="">target triple = "desgcv3-unknown-elf"<br class=""><br class="">; Function Attrs: noreturn nounwind<br class="">define void @wobble() local_unnamed_addr #0 {<br class="">  %1 = extractelement <4 x i32> <i32 0, i32 2, i32 3, i32 4>, i32 undef<br class="">  %2 = sub nsw i32 0, %1<br class="">  %3 = icmp sgt i32 %2, 0<br class="">  br i1 %3, label %4, label %5<br class=""><br class="">; <label>:4:                                      ; preds = %5, %0<br class="">  unreachable<br class=""><br class="">; <label>:5:                                      ; preds = %0<br class="">  %6 = extractelement <4 x i32> <i32 0, i32 2, i32 3, i32 4>, i32 undef<br class="">  %7 = sub nsw i32 0, %6<br class="">  %8 = icmp sgt i32 %7, 0<br class="">  br i1 %8, label %9, label %4<br class=""><br class="">; <label>:9:                                      ; preds = %5<br class="">  unreachable<br class="">}<br class=""><br class="">attributes #0 = { noreturn nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }<br class=""><br class=""><br class="">Here's the tail-end of the log, with debugging turned on:<br class=""><br class="">$llc bugpoint.reduced.simplified.bc -debug<br class="">...<br class="">208B    %vreg13:sub_64_1<def> = COPY %vreg34:sub_64_1; VecRegs:%vreg13,%vreg34<br class="">        Considering merging to VecRegs with %vreg34 in %vreg13<br class="">                RHS = %vreg34 [160r,240r:0)[240r,384B:1)[400B,480r:1)[480r,496r:2)[496r,672r:3)  0@160r 1@240r 2@480r 3@496r L00000020 [240r,384B:1)[400B,672r:1)  0@x 1@240r L00000010 [160r,384B:1)[400B,672r:1)  0@x 1@160r L00000002 [480r,480d:1)[496r,672r:0)  0@496r 1@480r L00000001 [480r,672r:0)  0@480r<br class="">                LHS = %vreg13 [96r,112r:0)[112r,208r:1)[208r,288r:2)  0@96r 1@112r 2@208r L00000002 [96r,96d:1)[112r,288r:0)  0@112r 1@96r L00000030 [208r,288r:1)  0@x 1@208r L00000001 [96r,288r:0)  0@96r<br class="">                merge %vreg13:2@208r into %vreg34:0@160r --> @160r<br class="">                LHST = %vreg13 %vreg13 [96r,112r:0)[112r,208r:1)[208r,288r:2)  0@96r 1@112r 2@208r L00000002 [96r,96d:1)[112r,288r:0)  0@112r 1@96r L00000030 [208r,288r:1)  0@x 1@208r L00000001 [96r,288r:0)  0@96r<br class="">                Copy+Merge 00000030 into 00000020<br class="">                Reduce Lane to 00000010<br class="">                conflict at %vreg34:1@240r<br class="">*** Couldn't join subrange!<br class=""><br class="">UNREACHABLE executed at /d/en/johnsoni-0/gctools/llvm/lib/CodeGen/RegisterCoalescer.cpp:2693!<br class="">#0 0x00000000027395af llvm::sys::PrintStackTrace(llvm::raw_ostream&) /d/en/johnsoni-0/gctools/llvm/lib/Support/Unix/Signals.inc:402:0<br class="">#1 0x0000000002739971 PrintStackTraceSignalHandler(void*) /d/en/johnsoni-0/gctools/llvm/lib/Support/Unix/Signals.inc:466:0<br class="">#2 0x0000000002737bce llvm::sys::RunSignalHandlers() /d/en/johnsoni-0/gctools/llvm/lib/Support/Signals.cpp:44:0<br class="">#3 0x0000000002738f41 SignalHandler(int) /d/en/johnsoni-0/gctools/llvm/lib/Support/Unix/Signals.inc:256:0<br class="">#4 0x000000396140f7e0 __restore_rt (/lib64/libpthread.so.0+0x396140f7e0)<br class="">#5 0x0000003960c325e5 __GI_raise (/lib64/libc.so.6+0x3960c325e5)<br class="">#6 0x0000003960c33dc5 __GI_abort (/lib64/libc.so.6+0x3960c33dc5)<br class="">#7 0x00000000026d4c42 bindingsErrorHandler(void*, std::string const&, bool) /d/en/johnsoni-0/gctools/llvm/lib/Support/ErrorHandling.cpp:127:0<br class="">#8 0x0000000001fdbc85 (anonymous namespace)::RegisterCoalescer::joinSubRegRanges(llvm::LiveRange&, llvm::LiveRange&, llvm::LaneBitmask, llvm::CoalescerPair const&) /d/en/johnsoni-0/gctools/llvm/lib/CodeGen/RegisterCoalescer.cpp:2695:0<br class="">#9 0x0000000001fdc3df (anonymous namespace)::RegisterCoalescer::mergeSubRangeInto(llvm::LiveInterval&, llvm::LiveRange const&, llvm::LaneBitmask, llvm::CoalescerPair&) /d/en/johnsoni-0/gctools/llvm/lib/CodeGen/RegisterCoalescer.cpp:2769:0<br class="">#10 0x0000000001fdcbd5 (anonymous namespace)::RegisterCoalescer::joinVirtRegs(llvm::CoalescerPair&) /d/en/johnsoni-0/gctools/llvm/lib/CodeGen/RegisterCoalescer.cpp:2832:0<br class="">#11 0x0000000001fdd174 (anonymous namespace)::RegisterCoalescer::joinIntervals(llvm::CoalescerPair&) /d/en/johnsoni-0/gctools/llvm/lib/CodeGen/RegisterCoalescer.cpp:2892:0<br class="">#12 0x0000000001fd5fc3 (anonymous namespace)::RegisterCoalescer::joinCopy(llvm::MachineInstr*, bool&) /d/en/johnsoni-0/gctools/llvm/lib/CodeGen/RegisterCoalescer.cpp:1468:0<br class="">#13 0x0000000001fdd4b6 (anonymous namespace)::RegisterCoalescer::copyCoalesceWorkList(llvm::MutableArrayRef<llvm::MachineInstr*>) /d/en/johnsoni-0/gctools/llvm/lib/CodeGen/RegisterCoalescer.cpp:2962:0<br class="">#14 0x0000000001fddf32 (anonymous namespace)::RegisterCoalescer::coalesceLocals() /d/en/johnsoni-0/gctools/llvm/lib/CodeGen/RegisterCoalescer.cpp:3087:0<br class="">#15 0x0000000001fde3a1 (anonymous namespace)::RegisterCoalescer::joinAllIntervals() /d/en/johnsoni-0/gctools/llvm/lib/CodeGen/RegisterCoalescer.cpp:3121:0<br class="">#16 0x0000000001fde6e2 (anonymous namespace)::RegisterCoalescer::runOnMachineFunction(llvm::MachineFunction&) /d/en/johnsoni-0/gctools/llvm/lib/CodeGen/RegisterCoalescer.cpp:3167:0<br class="">#17 0x0000000001d28d87 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /d/en/johnsoni-0/gctools/llvm/lib/CodeGen/MachineFunctionPass.cpp:62:0<br class="">...<br class=""><br class=""><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></div></blockquote></div><br class=""></body></html>