You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Assertion failed 'block->bbNatLoopNum == loopNum' during 'Optimize Valnum CSEs' #74739
// Generated by Fuzzlyn v1.6 on 2022-08-28 15:37:22// Run on Arm64 Linux// Seed: 12944707798274443197// Reduced from 38.4 KiB to 0.5 KiB in 00:01:30// Hits JIT assert in Release:// Assertion failed 'block->bbNatLoopNum == loopNum' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Optimize Valnum CSEs' (IL size 58; hash 0xade6b36b; FullOpts)// // File: /__w/1/s/src/coreclr/jit/fgdiagnostic.cpp Line: 3935// publicclassProgram{publicstaticushort[]s_4;publicstaticshorts_23;publicstaticvoidMain(){try{for(intvr0=0;vr0<2;vr0++){for(intvr1=0;vr1<1;vr1++){s_23=(short)(s_4[0]%-3635746572523657308L);}}}finally{M19();}}publicstaticboolM19(){returndefault(bool);}}
CSE invokes morph, and on ARM64 this can introduce references to throw blocks. These blocks may be placed within the span of an existing loop but not marked as loop blocks. Hence the assert.
Since these blocks contain only throw helper calls, the fact that they're not marked as loop blocks should not cause any actual problems.
fgFindInsertPoint is given the try region with desired "after" of BB04 and ends up splicing the block right there. A second block also gets added. And the result is:
Activity
jakobbotsch commentedon Aug 29, 2022
Exposed by checks added in #74308 maybe? cc @AndyAyersMS
AndyAyersMS commentedon Aug 29, 2022
Yeah, likely so. The implication is that CSE is introducing or altering control flow, which is surprising.
AndyAyersMS commentedon Aug 30, 2022
Probably not a 7.0 issue but will need to drill in to confirm.
AndyAyersMS commentedon Aug 30, 2022
CSE invokes morph, and on ARM64 this can introduce references to throw blocks. These blocks may be placed within the span of an existing loop but not marked as loop blocks. Hence the assert.
Since these blocks contain only throw helper calls, the fact that they're not marked as loop blocks should not cause any actual problems.
Moving this out of 7.0.
AndyAyersMS commentedon Aug 31, 2022
More specifically, we have a loop within a try where the try ends in a conditional branch:
fgFindInsertPointis given the try region with desired "after" ofBB04and ends up splicing the block right there. A second block also gets added. And the result is:where the new
BB11andBB10are the troublemakers.AndyAyersMS commentedon Sep 1, 2022
Seems like the least disruptive fix is to mark the blocks as if they're in the loop, even though technically they're not in any loop.
Something like:
bbPrevandbbNextare in the same loop, the block can be marked as being in that loop.bbPrevorbbNextare not in any loop, the block doesn't need to be in any loop.bbPrevandbbNextare in different loops that are siblings, the block needs to go into their parent loop (which may be no loop)bbPrevandbbNextare different and one is the parent of the other, the block can be marked as being in the parent loop.The idea here is not to impact the loop table. We don't want this new block to be the first or last block in the loop.
JIT: assign plausible loop number to new throw helper blocks
JIT: assign plausible loop number to new throw helper blocks (dotnet#…