-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-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 SuperPMI
Milestone
Description
[MethodImpl(MethodImplOptions.NoInlining)]
private static int Foo(bool cond)
{
int x;
if (cond)
{
x = 2;
}
else
{
x = 23;
}
int y;
if (cond)
{
y = 2;
}
else
{
y = 23;
}
return x + y;
}Output:
G_M7860_IG02: ;; offset=0000H
test cl, cl
je SHORT G_M7860_IG04
;; size=4 bbWeight=1 PerfScore 1.25
G_M7860_IG03: ;; offset=0004H
mov eax, 2
jmp SHORT G_M7860_IG05
;; size=7 bbWeight=0.50 PerfScore 1.12
G_M7860_IG04: ;; offset=000BH
mov eax, 23
jmp SHORT G_M7860_IG06
;; size=7 bbWeight=1 PerfScore 2.25
G_M7860_IG05: ;; offset=0012H
mov edx, 2
jmp SHORT G_M7860_IG07
;; size=7 bbWeight=0.50 PerfScore 1.12
G_M7860_IG06: ;; offset=0019H
mov edx, 23
;; size=5 bbWeight=0.50 PerfScore 0.12
G_M7860_IG07: ;; offset=001EH
add eax, edx
;; size=2 bbWeight=1 PerfScore 0.25
G_M7860_IG08: ;; offset=0020H
retThe blocks resulting in IG03/IG05 and IG04/IG06 should have been merged at some point to avoid those unnecessary unconditional jumps.
Metadata
Metadata
Assignees
Labels
area-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 SuperPMI