From 9e5bb6526f968ceb2223fe81e2ad84fcc290c778 Mon Sep 17 00:00:00 2001 From: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com> Date: Mon, 8 Nov 2021 14:30:55 +0300 Subject: [PATCH] Enable global constant propagation for GT_LCL_FLD (#61209) 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; }