-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
arch-arm64area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMItenet-performancePerformance related issuePerformance related issue
Milestone
Description
While debugging something on ARM64, I noticed that we end up leaving some of the dead code in place.
private static uint DivTest(uint xr)
{
return xr / 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.50
G_M26531_IG02:
53027C00 lsr w0, w0, #2
;; bbWeight=1 PerfScore 1.00
G_M26531_IG03:
A8C17BFD ldp fp, lr, [sp],#16
D65F03C0 ret lr
;; bbWeight=1 PerfScore 2.00
G_M26531_IG04:
97FF67A9 bl CORINFO_HELP_THROWDIVZERO
D43E0000 bkptFor 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.50
G_M26531_IG02:
131F7C01 asr w1, w0, #31
12000421 and w1, w1, #3
0B000020 add w0, w1, w0
13027C00 asr w0, w0, #2
;; bbWeight=1 PerfScore 3.00
G_M26531_IG03:
A8C17BFD ldp fp, lr, [sp],#16
D65F03C0 ret lr
;; bbWeight=1 PerfScore 2.00
G_M26531_IG04:
97FF67A2 bl CORINFO_HELP_OVERFLOW
;; bbWeight=0 PerfScore 0.00
G_M26531_IG05:
97FF67A5 bl CORINFO_HELP_THROWDIVZERO
D43E0000 bkptWe 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
Metadata
Metadata
Assignees
Labels
arch-arm64area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMItenet-performancePerformance related issuePerformance related issue