Skip to content

Commit

Permalink
Don't promote compCurStmt
Browse files Browse the repository at this point in the history
  • Loading branch information
hez2010 committed Jan 22, 2025
1 parent 03c0df5 commit 0042519
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/coreclr/jit/fginline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ bool Compiler::TypeInstantiationComplexityExceeds(CORINFO_CLASS_HANDLE handle, i
class SubstitutePlaceholdersAndDevirtualizeWalker : public GenTreeVisitor<SubstitutePlaceholdersAndDevirtualizeWalker>
{
bool m_madeChanges = false;
Statement* m_curStmt = nullptr;
Statement* m_firstNewStmt = nullptr;

public:
Expand Down Expand Up @@ -238,8 +239,9 @@ class SubstitutePlaceholdersAndDevirtualizeWalker : public GenTreeVisitor<Substi
Statement* WalkStatement(Statement* stmt)
{
m_firstNewStmt = nullptr;
WalkTree(stmt->GetRootNodePointer(), nullptr);
return m_firstNewStmt == nullptr ? stmt : m_firstNewStmt;
m_curStmt = stmt;
WalkTree(m_curStmt->GetRootNodePointer(), nullptr);
return m_firstNewStmt == nullptr ? m_curStmt : m_firstNewStmt;
}

fgWalkResult PreOrderVisit(GenTree** use, GenTree* user)
Expand Down Expand Up @@ -622,7 +624,7 @@ class SubstitutePlaceholdersAndDevirtualizeWalker : public GenTreeVisitor<Substi
if (parent != nullptr || call->gtReturnType != TYP_VOID)
{
Statement* stmt = m_compiler->gtNewStmt(call);
m_compiler->fgInsertStmtBefore(m_compiler->compCurBB, m_compiler->compCurStmt, stmt);
m_compiler->fgInsertStmtBefore(m_compiler->compCurBB, m_curStmt, stmt);
if (m_firstNewStmt == nullptr)
{
m_firstNewStmt = stmt;
Expand Down Expand Up @@ -806,8 +808,7 @@ PhaseStatus Compiler::fgInline()
// possible further optimization, as the (now complete) GT_RET_EXPR
// replacement may have enabled optimizations by providing more
// specific types for trees or variables.
compCurStmt = stmt;
stmt = walker.WalkStatement(stmt);
stmt = walker.WalkStatement(stmt);

GenTree* expr = stmt->GetRootNode();

Expand Down

0 comments on commit 0042519

Please sign in to comment.