diff options
-rw-r--r-- | src/coreclr/jit/gentree.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index afa6c78d308..0a90ce3e143 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -5821,19 +5821,6 @@ GenTree* Compiler::gtNewIndOfIconHandleNode(var_types indType, size_t addr, GenT // indNode->gtFlags |= GTF_IND_NONFAULTING; - // String Literal handles are indirections that return a TYP_REF, and - // these are pointers into the GC heap. We don't currently have any - // TYP_BYREF pointers, but if we did they also must be pointers into the GC heap. - // - // Also every GTF_ICON_STATIC_HDL also must be a pointer into the GC heap - // we will set GTF_GLOB_REF for these kinds of references. - // - if ((varTypeIsGC(indType)) || (iconFlags == GTF_ICON_STATIC_HDL)) - { - // This indirection also points into the gloabal heap - indNode->gtFlags |= GTF_GLOB_REF; - } - if (isInvariant) { assert(iconFlags != GTF_ICON_STATIC_HDL); // Pointer to a mutable class Static variable @@ -5849,6 +5836,13 @@ GenTree* Compiler::gtNewIndOfIconHandleNode(var_types indType, size_t addr, GenT indNode->gtFlags |= GTF_IND_NONNULL; } } + else + { + // GLOB_REF needs to be set for indirections returning values from mutable + // locations, so that e. g. args sorting does not reorder them with calls. + indNode->gtFlags |= GTF_GLOB_REF; + } + return indNode; } |