diff options
author | Brian Sullivan <briansul@microsoft.com> | 2021-02-16 03:27:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-16 03:27:18 +0300 |
commit | 02b7358cd5f07d0492e99a32c29544a62a292ad8 (patch) | |
tree | 378fd708075ff1fdb77eb8659f35f8b8aec9f60f /src/coreclr/jit/fgdiagnostic.cpp | |
parent | 2e36f1b3a81a2d43d0c0d3597a7ead1bcda35a27 (diff) |
Expand Virtual Call targets earlier in Morph and allow CSE of the indirections (#47808)
* Added GTF_CALL_M_EXPANDED_EARLY to flag virtual calls that should be expanded early during fgMorph
Added COMPlus_JitExpandCallsEarly variable to enable virtual calls to be expanded early on a per method basis
Set opts.compExpandCallsEarly to true when we are optimizing and have COMPlus_JitExpandCallsEarly enabled
Update gtSetEvalOrder to also include the call->gtControlExpr
Update morph to call fgExpandVirtualVtableCallTarget when we are expanding early
Update lower to not call LowerVirtualVtableCall when we have already expanded it early
Modify CheckTreeId to print the duplicated gtTreeID before it asserts.
All tests are passing when using COMPLUS_JitExpandCallsEarly=*
Expand the Virtual Call target after we morph the args
Fix an inadvertent change in the GT_CALL weights
* Changed the default for Virtual calls to be expanded early in Morph
Use COMPlus_JitExpandCallsEarly=0 to disable and use old behavior
* Code Review feedback
Added comment stating the the isRelative code path is never executed
* Fixes for propagating gtControlExpr->gtFlags
* Fix a few code size regressions when we perform a tail call
* Tailcall lower fix
* Code Review changes
* Fixes for the TAILCALL_HELPER path for x86
* Address the Arm/Linux failure
Diffstat (limited to 'src/coreclr/jit/fgdiagnostic.cpp')
-rw-r--r-- | src/coreclr/jit/fgdiagnostic.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/coreclr/jit/fgdiagnostic.cpp b/src/coreclr/jit/fgdiagnostic.cpp index c3323a3a194..67083e50d6d 100644 --- a/src/coreclr/jit/fgdiagnostic.cpp +++ b/src/coreclr/jit/fgdiagnostic.cpp @@ -2481,6 +2481,12 @@ void Compiler::fgDebugCheckFlags(GenTree* tree) chkFlags |= (call->gtCallAddr->gtFlags & GTF_SIDE_EFFECT); } + if ((call->gtControlExpr != nullptr) && call->IsExpandedEarly() && call->IsVirtualVtable()) + { + fgDebugCheckFlags(call->gtControlExpr); + chkFlags |= (call->gtControlExpr->gtFlags & GTF_SIDE_EFFECT); + } + if (call->IsUnmanaged() && (call->gtCallMoreFlags & GTF_CALL_M_UNMGD_THISCALL)) { if (call->gtCallArgs->GetNode()->OperGet() == GT_NOP) @@ -2968,15 +2974,28 @@ public: } //------------------------------------------------------------------------ - // CheckTreeId: Check that this tree was not visit before and memorize it as visited. + // CheckTreeId: Check that this tree was not visited before and memorize it as visited. // // Arguments: // gtTreeID - identificator of GenTree. // + // Note: + // This method causes an assert failure when we find a duplicated node in our tree + // void CheckTreeId(unsigned gtTreeID) { - assert(!BitVecOps::IsMember(&nodesVecTraits, uniqueNodes, gtTreeID)); - BitVecOps::AddElemD(&nodesVecTraits, uniqueNodes, gtTreeID); + if (BitVecOps::IsMember(&nodesVecTraits, uniqueNodes, gtTreeID)) + { + if (comp->verbose) + { + printf("Duplicate gtTreeID was found: %d\n", gtTreeID); + } + assert(!"Duplicate gtTreeID was found"); + } + else + { + BitVecOps::AddElemD(&nodesVecTraits, uniqueNodes, gtTreeID); + } } private: |