Skip to content

Missing GTF_ASG and GTF_ALL_EFFECT on GenTree nodes. #13758

Closed

Description

@sandreenko

Sometimes we are missing GTF_ASG flag for calls when create a setup argument node in fgArgInfo::EvalArgsToTemps(). It creates an unwanted effect that call to gtUpdateSideEffects(tree, stmt) could change flags when the trees are unchanged:

before calling gtUpdateSideEffects(000055, stmt):


N019 ( 51, 40) [000068] --CXG-------              *  JTRUE     void
N018 ( 49, 38) [000067] J-CXG--N----              \--*  LT        int    $148
N016 ( 47, 36) [000065] --CXG------- HERE            +--*  CALLV stub int    System.Collections.IComparer.Compare $383
N010 ( 18, 11) [000131] -ACXG---R-L- arg2 SETUP      |  +--*  ASG       ref    $346
N009 (  1,  1) [000130] D------N----                 |  |  +--*  LCL_VAR   ref    V12 tmp5         d:2 $346
N008 ( 18, 11) [000059] --CXG-------                 |  |  \--*  CALL r2r_ind ref    System.Array.GetValue $346
N006 (  3,  2) [000049] *--XG------- this in rcx     |  |     +--*  IND       ref    <l:$286, c:$285>
N005 (  1,  1) [000048] ------------                 |  |     |  \--*  LCL_VAR   byref  V00 this         u:1 Zero Fseq[keys] $80
N007 (  1,  1) [000055] ------------ arg1 in rdx     |  |     \--*  LCL_VAR   int    V05 loc2         u:5 (last use) $147
N012 (  1,  1) [000132] ------------ arg2 in rdx     |  +--*  LCL_VAR   ref    V12 tmp5         u:2 (last use) $346
N013 (  1,  1) [000064] ------------ arg3 in r8      |  +--*  LCL_VAR   ref    V04 loc1         u:2 $205
N014 (  1,  1) [000062] ------------ this in rcx     |  +--*  LCL_VAR   ref    V09 tmp2         u:2 (last use) <l:$241, c:$341>
N015 (  3, 10) [000127] ------------ arg1 in r11     |  \--*  CNS_INT(h) long   0xd1ffab1e ftn REG r11 $480
N017 (  1,  1) [000066] ------------                 \--*  CNS_INT   int    0 $40

after:

N019 ( 51, 40) [000068] -ACXG-------              *  JTRUE     void
N018 ( 49, 38) [000067] JACXG--N----              \--*  LT        int    $148
N016 ( 47, 36) [000065] -ACXG------- HERE                        +--*  CALLV stub int    System.Collections.IComparer.Compare $383
N010 ( 18, 11) [000131] -ACXG---R-L- arg2 SETUP      |  +--*  ASG       ref    $346
N009 (  1,  1) [000130] D------N----                 |  |  +--*  LCL_VAR   ref    V12 tmp5         d:2 $346
N008 ( 18, 11) [000059] --CXG-------                 |  |  \--*  CALL r2r_ind ref    System.Array.GetValue $346
N006 (  3,  2) [000049] *--XG------- this in rcx     |  |     +--*  IND       ref    <l:$286, c:$285>
N005 (  1,  1) [000048] ------------                 |  |     |  \--*  LCL_VAR   byref  V00 this         u:1 Zero Fseq[keys] $80
N007 (  1,  1) [000055] ------------ arg1 in rdx     |  |     \--*  LCL_VAR   int    V05 loc2         u:5 (last use) $147
N012 (  1,  1) [000132] ------------ arg2 in rdx     |  +--*  LCL_VAR   ref    V12 tmp5         u:2 (last use) $346
N013 (  1,  1) [000064] ------------ arg3 in r8      |  +--*  LCL_VAR   ref    V04 loc1         u:2 $205
N014 (  1,  1) [000062] ------------ this in rcx     |  +--*  LCL_VAR   ref    V09 tmp2         u:2 (last use) <l:$241, c:$341>
N015 (  3, 10) [000127] ------------ arg1 in r11     |  \--*  CNS_INT(h) long   0xd1ffab1e ftn REG r11 $480
N017 (  1,  1) [000066] ------------                 \--*  CNS_INT   int    0 $40

see that flags on [000065] have changed, but they should not.

The same happens with GTF_ALL_EFFECT on addr modes.

The fix for it is simple and published in dotnet/coreclr#27732, however, the fix create 0.1% size regression because of another issue. So I will postpone it until another issue is fixed.

Along the way fix that we don't print fgMorphTree block, stmt(after) if only the flags were changed.

category:correctness
theme:ir
skill-level:intermediate
cost:medium

Activity

  1. self-assigned this
    on Nov 8, 2019
  2. changed the title [-]Missing flags on GenTree nodes.[/-] [+]Missing `GTF_ASG` and `GTF_ALL_EFFECT` on GenTree nodes.[/+] on Nov 8, 2019
  3. transferred this issue fromdotnet/coreclron Jan 31, 2020
  4. added this to the 5.0 milestone on Jan 31, 2020
  5. AndyAyersMS commented on May 1, 2020

    @AndyAyersMS
    Member

    Moving this to future.

  6. modified the milestones: 5.0, Future on May 1, 2020
  7. modified the milestones: Future, 6.0.0 on Jan 4, 2021
  8. modified the milestones: 6.0.0, Future on Apr 5, 2021
  9. modified the milestones: Future, 9.0.0 on Jan 23, 2024
  10. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Jan 23, 2024
  11. added a commit that references this issue on Jan 25, 2024
    2558ff9
  12. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Jan 25, 2024
  13. locked and limited conversation to collaborators on Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Priority:3Work that is nice to havearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIbug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions