Skip to content

Jit doesn't always eliminate identical checks #11909

@benaadams

Description

@benaadams

Double check is via outer method (first) and then inlined method (second, Span .ctor)

Seen in dotnet/coreclr#22207 (comment)

; Assembly listing for method String:EndsWith(ref,int):bool:this
...
G_M23680_IG10:
       mov      ecx, dword ptr [rsi+8]
       sub      ecx, r8d
       cmp      dword ptr [rsi+8], ecx   ; should eliminate one below?
       jb       SHORT G_M23680_IG15
       cmp      dword ptr [rsi+8], ecx   ; should be eliminated?
       jb       G_M23680_IG22
G_M23680_IG11:

/cc @AndyAyersMS

category:cq
theme:basic-cq
skill-level:expert
cost:medium

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsoptimization

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions