summaryrefslogtreecommitdiff
path: root/src/jit
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2018-10-22 13:14:57 -0700
committerGitHub <noreply@github.com>2018-10-22 13:14:57 -0700
commitc0aa74fe584a04f8c7c8e81882793a136ee074d9 (patch)
tree4d9ca2079a220e47f3ec385ff0a27a76cca72027 /src/jit
parent961f131758e510927676e13bc2f4533b3e0cb42a (diff)
downloadcoreclr-c0aa74fe584a04f8c7c8e81882793a136ee074d9.tar.gz
coreclr-c0aa74fe584a04f8c7c8e81882793a136ee074d9.tar.bz2
coreclr-c0aa74fe584a04f8c7c8e81882793a136ee074d9.zip
JIT: improve simplification of IND(ADDR(x)) (#20508)
Some `IND(ADDR(x))` trees were not being optimized to `x` by morph, particularly when `x` was the promoted pointer field of a `Span`. Instead they were creating local fields that blocked enregistration and lead to store-load pairs like: ```asm mov bword ptr [rsp+20H], rax mov rax, bword ptr [rsp+20H] ``` Add logic to `fgMorphSmpOp`'s `GT_IND` clause to recognize and simplify these cases.
Diffstat (limited to 'src/jit')
-rw-r--r--src/jit/morph.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index 022bf35152..1f6de01574 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -13066,6 +13066,12 @@ DONE_MORPHING_CHILDREN:
tree->gtType = typ = temp->TypeGet();
foldAndReturnTemp = true;
}
+ else if (!varTypeIsStruct(typ) && (lvaTable[lclNum].lvType == typ) &&
+ !lvaTable[lclNum].lvNormalizeOnLoad())
+ {
+ tree->gtType = typ = temp->TypeGet();
+ foldAndReturnTemp = true;
+ }
else
{
// Assumes that when Lookup returns "false" it will leave "fieldSeq" unmodified (i.e.