-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
This code drops the old edge and weight on it:
runtime/src/coreclr/jit/fgbasic.cpp
Line 5375 in 21b4a85
| fgRemoveRefPred(succBlock, block); |
If we have blocks A -> B -> C, with an empty B, then we should end up with the same result whether we compact B into C or whether we just remove B. However, currently we drop the A -> B weight if we remove B:
BB02 [0085] 2 BB01,BB36 1 211 0 [???..???)-> BB13 ( cond ) IBC internal Loop loopheader
BB03 [0087] 1 BB02 0.42 88 0 [01D..???)-> BB04 (always) IBC internal LoopPH q
BB04 [0002] 2 BB03,BB12 0.55 117 1 [01D..02D)-> BB41 ( cond ) i IBC Loop bwd bwd-target loopheader
...
Setting edge weights for BB02 -> BB03 to [88.48387 .. 88.48387]
...
fgRemoveBlock BB03, unreachable=false
Removing empty BB03
Setting edge weights for BB02 -> BB04 to [0 .. 117] // not the right weightWhen removing B, should the weight on A -> C be inherited from A -> B?
There's probably a ton of these in the JIT, but I figured I would open an issue since I saw it be the cause of diffs. (Also, maybe the fact that B -> C is not already the same as A -> B is a problem in maintenance in and of itself, so maybe the issue exists elsewhere.)
out_base.txt (jitdump with fgRemoveBlock)
out.txt (jitdump with compaction)