From 1536b67b3a5746e1174c0760b16db85f882c2085 Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Fri, 17 Jun 2022 15:20:42 +0200 Subject: [PATCH] Allow more permissive forward subbing into call arguments --- src/coreclr/jit/forwardsub.cpp | 41 +--------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/src/coreclr/jit/forwardsub.cpp b/src/coreclr/jit/forwardsub.cpp index 4c3fae5f1d9f9..a05ef79fd572f 100644 --- a/src/coreclr/jit/forwardsub.cpp +++ b/src/coreclr/jit/forwardsub.cpp @@ -187,7 +187,6 @@ class ForwardSubVisitor final : public GenTreeVisitor public: enum { - ComputeStack = true, DoPostOrder = true, UseExecutionOrder = true }; @@ -197,7 +196,6 @@ class ForwardSubVisitor final : public GenTreeVisitor , m_use(nullptr) , m_node(nullptr) , m_parentNode(nullptr) - , m_callAncestor(nullptr) , m_lclNum(lclNum) , m_useCount(0) , m_useFlags(GTF_EMPTY) @@ -221,7 +219,7 @@ class ForwardSubVisitor final : public GenTreeVisitor // Screen out contextual "uses" // - GenTree* const parent = m_ancestors.Top(1); + GenTree* const parent = user; bool const isDef = parent->OperIs(GT_ASG) && (parent->gtGetOp1() == node); bool const isAddr = parent->OperIs(GT_ADDR); @@ -243,19 +241,6 @@ class ForwardSubVisitor final : public GenTreeVisitor m_use = use; m_useFlags = m_accumulatedFlags; m_parentNode = parent; - - // If this use contributes to a call arg we need to - // remember the call and handle it specially when we - // see it later in the postorder walk. - // - for (int i = 1; i < m_ancestors.Height(); i++) - { - if (m_ancestors.Top(i)->IsCall()) - { - m_callAncestor = m_ancestors.Top(i)->AsCall(); - break; - } - } } } } @@ -274,29 +259,6 @@ class ForwardSubVisitor final : public GenTreeVisitor } } - // Is this the use's call ancestor? - // - if ((m_callAncestor != nullptr) && (node == m_callAncestor)) - { - // To be conservative and avoid issues with morph - // reordering call args, we merge in effects of all args - // to this call. - // - // Remove this if/when morph's arg sorting is fixed. - // - GenTreeFlags oldUseFlags = m_useFlags; - - for (CallArg& arg : m_callAncestor->gtArgs.Args()) - { - m_useFlags |= (arg.GetNode()->gtFlags & GTF_GLOB_EFFECT); - } - - if (oldUseFlags != m_useFlags) - { - JITDUMP(" [added other call arg use flags: 0x%x]", m_useFlags & ~oldUseFlags); - } - } - m_accumulatedFlags |= (node->gtFlags & GTF_GLOB_EFFECT); return fgWalkResult::WALK_CONTINUE; @@ -341,7 +303,6 @@ class ForwardSubVisitor final : public GenTreeVisitor GenTree** m_use; GenTree* m_node; GenTree* m_parentNode; - GenTreeCall* m_callAncestor; unsigned m_lclNum; unsigned m_useCount; GenTreeFlags m_useFlags;