Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: remove GTF_INX_REFARR_LAYOUT #33098

Merged
merged 6 commits into from
Mar 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/coreclr/src/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8648,10 +8648,6 @@ void cTreeFlags(Compiler* comp, GenTree* tree)

case GT_INDEX:

if (tree->gtFlags & GTF_INX_REFARR_LAYOUT)
{
chars += printf("[INX_REFARR_LAYOUT]");
}
if (tree->gtFlags & GTF_INX_STRING_LAYOUT)
{
chars += printf("[INX_STRING_LAYOUT]");
Expand Down
12 changes: 0 additions & 12 deletions src/coreclr/src/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9773,18 +9773,6 @@ void Compiler::gtDispNode(GenTree* tree, IndentStack* indentStack, __in __in_z _

case GT_INDEX:
case GT_INDEX_ADDR:

if ((tree->gtFlags & (GTF_IND_VOLATILE | GTF_IND_UNALIGNED)) == 0) // We prefer printing V or U over R
{
if (tree->gtFlags & GTF_INX_REFARR_LAYOUT)
{
printf("R");
--msgLength;
break;
} // R means RefArray
}
__fallthrough;

case GT_FIELD:
case GT_CLS_VAR:
if (tree->gtFlags & GTF_IND_VOLATILE)
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/src/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,6 @@ struct GenTree
#define GTF_FLD_INITCLASS 0x20000000 // GT_FIELD/GT_CLS_VAR -- field access requires preceding class/static init helper

#define GTF_INX_RNGCHK 0x80000000 // GT_INDEX/GT_INDEX_ADDR -- the array reference should be range-checked.
#define GTF_INX_REFARR_LAYOUT 0x20000000 // GT_INDEX -- TODO: Delete, no longer necessary (https://github.com/dotnet/runtime/issues/32647)
#define GTF_INX_STRING_LAYOUT 0x40000000 // GT_INDEX -- this uses the special string array layout

#define GTF_IND_TGT_NOT_HEAP 0x80000000 // GT_IND -- the target is not on the heap
Expand Down Expand Up @@ -4632,11 +4631,6 @@ struct GenTreeIndex : public GenTreeOp
gtFlags |= GTF_INX_RNGCHK;
}

if (type == TYP_REF)
{
gtFlags |= GTF_INX_REFARR_LAYOUT;
}

gtFlags |= GTF_EXCEPT | GTF_GLOB_REF;
}
#if DEBUGGABLE_GENTREE
Expand Down
10 changes: 1 addition & 9 deletions src/coreclr/src/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9099,15 +9099,7 @@ GenTree* Compiler::impFixupStructReturnType(GenTree* op, CORINFO_CLASS_HANDLE re
GenTree* op1 = op->AsObj()->Addr();

// We will fold away OBJ/ADDR
// except for OBJ/ADDR/INDEX
// as the array type influences the array element's offset
// Later in this method we change op->gtType to info.compRetNativeType
// This is not correct when op is a GT_INDEX as the starting offset
// for the array elements 'elemOffs' is different for an array of
// TYP_REF than an array of TYP_STRUCT (which simply wraps a TYP_REF)
// Also refer to the GTF_INX_REFARR_LAYOUT flag
//
if ((op1->gtOper == GT_ADDR) && (op1->AsOp()->gtOp1->gtOper != GT_INDEX))
if (op1->gtOper == GT_ADDR)
{
// Change '*(&X)' to 'X' and see if we can do better
op = op1->AsOp()->gtOp1;
Expand Down
11 changes: 9 additions & 2 deletions src/coreclr/src/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5552,8 +5552,15 @@ GenTree* Compiler::fgMorphArrayIndex(GenTree* tree)
// This is an array index expression.
tree->gtFlags |= GTF_IND_ARR_INDEX;

/* An indirection will cause a GPF if the address is null */
tree->gtFlags |= GTF_EXCEPT;
// If there's a bounds check, the the indir won't fault.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// If there's a bounds check, the the indir won't fault.
// If there's a bounds check, then the indir won't fault.

if (bndsChk)
{
tree->gtFlags |= GTF_IND_NONFAULTING;
}
else
{
tree->gtFlags |= GTF_EXCEPT;
}

if (nCSE)
{
Expand Down