From 9c1eb272745c451762de08da1832bb34cfc2a176 Mon Sep 17 00:00:00 2001 From: SingleAccretion Date: Thu, 4 Nov 2021 16:43:15 +0300 Subject: [PATCH] Enable global constant propagation for GT_LCL_FLD These are leaf nodes without side effects, and we can sometimes evaluate them in VN, so it does not seem like there is any reason not to enable propagation for them. --- src/coreclr/jit/assertionprop.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coreclr/jit/assertionprop.cpp b/src/coreclr/jit/assertionprop.cpp index 2c286ab4bcc85..75286febdc44e 100644 --- a/src/coreclr/jit/assertionprop.cpp +++ b/src/coreclr/jit/assertionprop.cpp @@ -5605,8 +5605,9 @@ Compiler::fgWalkResult Compiler::optVNConstantPropCurStmt(BasicBlock* block, Sta break; case GT_LCL_VAR: + case GT_LCL_FLD: // Make sure the local variable is an R-value. - if ((tree->gtFlags & (GTF_VAR_DEF | GTF_DONT_CSE))) + if ((tree->gtFlags & (GTF_VAR_USEASG | GTF_VAR_DEF | GTF_DONT_CSE)) != GTF_EMPTY) { return WALK_CONTINUE; }