While debugging something on ARM64, I noticed that we end up leaving some of the dead code in place.
privatestaticuintDivTest(uintxr){returnxr/4;}Generates the following where IG04 block is dead:
G_M26531_IG01: A9BF7BFD stp fp, lr,[sp,#-16]! 910003FD mov fp,sp ;; bbWeight=1 PerfScore 1.50G_M26531_IG02: 53027C00 lsr w0, w0, #2 ;; bbWeight=1 PerfScore 1.00G_M26531_IG03: A8C17BFD ldp fp, lr,[sp],#16 D65F03C0 ret lr ;; bbWeight=1 PerfScore 2.00G_M26531_IG04: 97FF67A9 bl CORINFO_HELP_THROWDIVZERO D43E0000 bkpt
For int parameter, we have 2 blocks that are dead:
G_M26531_IG01: A9BF7BFD stp fp, lr,[sp,#-16]! 910003FD mov fp,sp ;; bbWeight=1 PerfScore 1.50G_M26531_IG02: 131F7C01 asr w1, w0, #3112000421and w1, w1, #3 0B000020 add w0, w1, w0 13027C00 asr w0, w0, #2 ;; bbWeight=1 PerfScore 3.00G_M26531_IG03: A8C17BFD ldp fp, lr,[sp],#16 D65F03C0 ret lr ;; bbWeight=1 PerfScore 2.00G_M26531_IG04: 97FF67A2 bl CORINFO_HELP_OVERFLOW ;; bbWeight=0 PerfScore 0.00G_M26531_IG05: 97FF67A5 bl CORINFO_HELP_THROWDIVZERO D43E0000 bkpt
We don't produce dead BB if I change from division to bit-shift like xr >> 2. I was assuming there be some dead code elimination phase, but looking at dumps I didn't see anything like that happening.
category:cq
theme:dead-code
skill-level:intermediate
cost:medium
While debugging something on ARM64, I noticed that we end up leaving some of the dead code in place.
Generates the following where
IG04block is dead:For
intparameter, we have 2 blocks that are dead:We don't produce dead BB if I change from division to bit-shift like
xr >> 2. I was assuming there be some dead code elimination phase, but looking at dumps I didn't see anything like that happening.category:cq
theme:dead-code
skill-level:intermediate
cost:medium