Skip to content

Conversation

BruceForstall
Copy link
Contributor

In strict mode, consider GTF_ORDER_SIDEEFF to interfere with another GTF_ORDER_SIDEEFF and not just with GTF_GLOB_REF.

This matches the semantics implemented in a few other places in the JIT, where GTF_ORDER_SIDEEFF is considered a more general barrier to code motion.

In `strict` mode, consider `GTF_ORDER_SIDEEFF` to interfere with
another `GTF_ORDER_SIDEEFF` and not just with `GTF_GLOB_REF`.
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 26, 2024
@BruceForstall
Copy link
Contributor Author

BruceForstall commented Mar 26, 2024

There are a few diffs:

In one case:

Microsoft.FSharp.Core.FSharpRef`1[System.__Canon]:Equals(System.Object,System.Collections.IEqualityComparer):ubyte:this (MethodHash=c0d8df1f)

containment is prevented because there is an intervening CSE definition with the ORDER bit:

N001 (  1,  1) [000014] ------?----                   t14 =    LCL_VAR   ref    V01 arg1         u:1 $81
                                                            /--*  t14    ref    
N002 (  3,  2) [000015] #----O?----                   t15 = *  IND       long   $1c0       <----------- Previously, this node was contained.
N003 (  1,  1) [000011] !-----?----                   t11 =    LCL_VAR   ref    V00 this         u:1 $80
                                                            /--*  t11    ref    
N004 (  3,  2) [000012] #----O?----                   t12 = *  IND       long   $c2
                                                            /--*  t12    long   
N005 (  7,  5) [000085] DA---O-----                         *  STORE_LCL_VAR long   V10 cse0         d:1 $VN.Void
N006 (  3,  2) [000086] -----------                   t86 =    LCL_VAR   long   V10 cse0         u:1 $c2
                                                            /--*  t15    long   
                                                            +--*  t86    long   
N008 ( 14, 10) [000016] JA---O?N---                   t16 = *  EQ        int    $144
                                                            /--*  t16    int    
N009 ( 16, 12) [000069] -A---O-----                         *  JTRUE     void   $181

Several other cases look the same.

@BruceForstall
Copy link
Contributor Author

Noticed here: #100160 (comment)

@BruceForstall
Copy link
Contributor Author

@jakobbotsch PTAL
cc @dotnet/jit-contrib

Copy link
Member

@jakobbotsch jakobbotsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

There are a few diffs:

In one case:

Microsoft.FSharp.Core.FSharpRef`1[System.__Canon]:Equals(System.Object,System.Collections.IEqualityComparer):ubyte:this (MethodHash=c0d8df1f)

containment is prevented because there is an intervening CSE definition with the ORDER bit:

N001 (  1,  1) [000014] ------?----                   t14 =    LCL_VAR   ref    V01 arg1         u:1 $81
                                                            /--*  t14    ref    
N002 (  3,  2) [000015] #----O?----                   t15 = *  IND       long   $1c0       <----------- Previously, this node was contained.
N003 (  1,  1) [000011] !-----?----                   t11 =    LCL_VAR   ref    V00 this         u:1 $80
                                                            /--*  t11    ref    
N004 (  3,  2) [000012] #----O?----                   t12 = *  IND       long   $c2
                                                            /--*  t12    long   
N005 (  7,  5) [000085] DA---O-----                         *  STORE_LCL_VAR long   V10 cse0         d:1 $VN.Void
N006 (  3,  2) [000086] -----------                   t86 =    LCL_VAR   long   V10 cse0         u:1 $c2
                                                            /--*  t15    long   
                                                            +--*  t86    long   
N008 ( 14, 10) [000016] JA---O?N---                   t16 = *  EQ        int    $144
                                                            /--*  t16    int    
N009 ( 16, 12) [000069] -A---O-----                         *  JTRUE     void   $181

Several other cases look the same.

Any idea why these indirs aren't marked with GTF_GLOB_REF?

@SingleAccretion
Copy link
Contributor

Any idea why these indirs aren't marked with GTF_GLOB_REF?

These look to be invariant indirections.

@BruceForstall
Copy link
Contributor Author

Diffs A very small number of regressions.

@BruceForstall BruceForstall merged commit 8c68710 into dotnet:main Mar 26, 2024
@BruceForstall BruceForstall deleted the TightenSideEffectSetInterferesWith branch March 26, 2024 23:38
@github-actions github-actions bot locked and limited conversation to collaborators Apr 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants