Skip to content

Commit 8fe39db

Browse files
authored
Allow more permissive forward subbing into call arguments (#71161)
1 parent c6584b4 commit 8fe39db

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

src/coreclr/jit/forwardsub.cpp

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ class ForwardSubVisitor final : public GenTreeVisitor<ForwardSubVisitor>
187187
public:
188188
enum
189189
{
190-
ComputeStack = true,
191190
DoPostOrder = true,
192191
UseExecutionOrder = true
193192
};
@@ -197,7 +196,6 @@ class ForwardSubVisitor final : public GenTreeVisitor<ForwardSubVisitor>
197196
, m_use(nullptr)
198197
, m_node(nullptr)
199198
, m_parentNode(nullptr)
200-
, m_callAncestor(nullptr)
201199
, m_lclNum(lclNum)
202200
, m_useCount(0)
203201
, m_useFlags(GTF_EMPTY)
@@ -221,7 +219,7 @@ class ForwardSubVisitor final : public GenTreeVisitor<ForwardSubVisitor>
221219

222220
// Screen out contextual "uses"
223221
//
224-
GenTree* const parent = m_ancestors.Top(1);
222+
GenTree* const parent = user;
225223
bool const isDef = parent->OperIs(GT_ASG) && (parent->gtGetOp1() == node);
226224
bool const isAddr = parent->OperIs(GT_ADDR);
227225

@@ -243,19 +241,6 @@ class ForwardSubVisitor final : public GenTreeVisitor<ForwardSubVisitor>
243241
m_use = use;
244242
m_useFlags = m_accumulatedFlags;
245243
m_parentNode = parent;
246-
247-
// If this use contributes to a call arg we need to
248-
// remember the call and handle it specially when we
249-
// see it later in the postorder walk.
250-
//
251-
for (int i = 1; i < m_ancestors.Height(); i++)
252-
{
253-
if (m_ancestors.Top(i)->IsCall())
254-
{
255-
m_callAncestor = m_ancestors.Top(i)->AsCall();
256-
break;
257-
}
258-
}
259244
}
260245
}
261246
}
@@ -274,29 +259,6 @@ class ForwardSubVisitor final : public GenTreeVisitor<ForwardSubVisitor>
274259
}
275260
}
276261

277-
// Is this the use's call ancestor?
278-
//
279-
if ((m_callAncestor != nullptr) && (node == m_callAncestor))
280-
{
281-
// To be conservative and avoid issues with morph
282-
// reordering call args, we merge in effects of all args
283-
// to this call.
284-
//
285-
// Remove this if/when morph's arg sorting is fixed.
286-
//
287-
GenTreeFlags oldUseFlags = m_useFlags;
288-
289-
for (CallArg& arg : m_callAncestor->gtArgs.Args())
290-
{
291-
m_useFlags |= (arg.GetNode()->gtFlags & GTF_GLOB_EFFECT);
292-
}
293-
294-
if (oldUseFlags != m_useFlags)
295-
{
296-
JITDUMP(" [added other call arg use flags: 0x%x]", m_useFlags & ~oldUseFlags);
297-
}
298-
}
299-
300262
m_accumulatedFlags |= (node->gtFlags & GTF_GLOB_EFFECT);
301263

302264
return fgWalkResult::WALK_CONTINUE;
@@ -341,7 +303,6 @@ class ForwardSubVisitor final : public GenTreeVisitor<ForwardSubVisitor>
341303
GenTree** m_use;
342304
GenTree* m_node;
343305
GenTree* m_parentNode;
344-
GenTreeCall* m_callAncestor;
345306
unsigned m_lclNum;
346307
unsigned m_useCount;
347308
GenTreeFlags m_useFlags;

0 commit comments

Comments
 (0)