-
Notifications
You must be signed in to change notification settings - Fork 5.4k
RyuJIT generates unnecessary null check #4324
Copy link
Copy link
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 SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionsoptimizationtenet-performancePerformance related issuePerformance related issue
Milestone
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 SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionsoptimizationtenet-performancePerformance related issuePerformance related issue
Type
Fields
Give feedbackNo fields configured for issues without a type.
An unnecessary null check of
thisis generated even if it is known to be non-null due to a previous explicit check:Generated code for the relevant block in the
Testmethod:This does not happen if
infois copied into a local variable and used for both the null check and theContainscall. The null check optimization behaves as if theslicefield is loaded twice and in that case the null check would be required to avoid a race condition. Probably there's another part of the optimizer which later decides to (correctly) eliminate the second load but it's too late for the null check to be removed.category:cq
theme:cse
skill-level:intermediate
cost:small
impact:small