-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Reg-alloc] Bad machine code: Live segment doesn't end at a valid instruction #34922
Comments
This might be totally unrelated, but I ran into something similar 1.5 years ago after the When I debugged the problem then I saw printouts like: %vreg29 [880r,896r:0) 0@880r And then the verifier says: *** Bad machine code: Live segment doesn't end at a valid instruction ***
Notice the "Shrunk" printout above. The new range is the same as the old one! After some discussion with Wei Mi I solved that problem locally for our target by doing: // Somewhat brute solution to #10204. Always shrink live ranges for instead of if (ShrinkMainRange) { in RegisterCoalescer::joinCopy(). Again, I have no idea if this is the issue you're seeing now but I thought I'd share |
Thank you, Mikael. It does however not seem to be the same problem: 192B %8:gr64bit = SRLG %5, %noreg, 24; GR64Bit:%8,%5 -> 224B %1:gr64bit = COPY %8; GR64Bit:%1,%8 The 240r dead COPY is erased, but the resulting live range includes it, which seems strange. Anyone knows what could be going wrong? |
*** Bug llvm/llvm-bugzilla-archive#36425 has been marked as a duplicate of this bug. *** |
reduced mir testcase This was unfortunately not helped by Krzysztofs recent fixes for subregliveness... llc -mcpu=z13 ./tc_simpleregcoal.mir -verify-machineinstrs -start-before=simple-register-coalescing -o - |
reduced testcase llc ./tc_liveseg.mir -mtriple=s390x-linux-gnu -mcpu=z13 -o - -verify-machineinstrs -systemz-subreg-liveness -misched=shuffle -start-before=simple-register-coalescing *** Bad machine code: Live segment doesn't end at a valid instruction ***
|
This seems to as well have been handled by 2ec71ea, so closing this. See llvm/llvm-bugzilla-archive#41372 . |
reduced testcase llc -mcpu=z13 -O3 -o out.s -systemz-subreg-liveness ./tc_livesegend.ll -verify-misched -disable-lsr It may be worth noting that this is a reduced csmith random test case which was compiled originally with clang including the options -jump-threading-across-loop-headers and -enable-simple-loop-unswitch, both of which seem to have problems currently. |
mentioned in issue llvm/llvm-bugzilla-archive#36425 |
mentioned in issue llvm/llvm-bugzilla-archive#41372 |
Extended Description
Machine verifier complains after coalescing. Small reduced program attached.
bin/llc -mtriple=s390x-linux-gnu -mcpu=z13 tc_liveseg.ll -disable-machine-dce -verify-machineinstrs
After Simple Register Coalescing
********** INTERVALS **********
%0 [336r,336d:0) 0@336r
%1 [192r,240d:0) 0@192r
%3 [96r,128r:0) 0@96r
%5 [128r,192r:0) 0@128r
%13 [16r,32r:0) 0@16r
RegMasks:
********** MACHINEINSTRS **********
Machine code for function main: NoPHIs, TracksLiveness
0B %bb.0: derived from LLVM BB %0
16B %13:grx32bit = LHIMux 0; GRX32Bit:%13
32B CHIMux %13, 0, implicit-def %cc; GRX32Bit:%13
48B BRC 14, 6, %bb.2, implicit killed %cc
64B J %bb.1
Successors according to CFG: %bb.1(0x00000001 / 0x80000000 = 0.00%) %bb.2(0x7fffffff / 0x80000000 = 100.00%)
80B %bb.1: derived from LLVM BB %3
Predecessors according to CFG: %bb.0
96B %3:addr64bit = LARL ga:@g_979; ADDR64Bit:%3
128B %5:gr64bit = LG %3, 3, %noreg; mem:LD8bitcast (i8* getelementptr inbounds ({ i8, i8, i8, { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 } }, { i8, i8, i8, { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 } }* @g_979, i64 0, i32 3, i32 0) to i136*)(dereferenceable) GR64Bit:%5 ADDR64Bit:%3
192B %1:gr64bit = SRLG %5, %noreg, 24; GR64Bit:%1,%5
336B dead %0:gr64bit = LGHI 0; GR64Bit:%0
352B %bb.2: derived from LLVM BB %4
Predecessors according to CFG: %bb.0
368B Return
End machine code for function main.
*** Bad machine code: Live segment doesn't end at a valid instruction ***
LLVM ERROR: Found 1 machine code errors.
The text was updated successfully, but these errors were encountered: